-
Notifications
You must be signed in to change notification settings - Fork 272
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Enable Creation of Cleaned Movement Regressors #164
Conversation
Regress sICA noise components out of movement regressors to enable their use on sICA+FIX cleaned fMRI data. The files are present in text and .nii.gz formats and for both the concatinated and single runs
fix_3_clean.m code:
|
if [ -f ${concatfmrihp}.ica/mc/prefiltered_func_data_mcf_conf_hp_clean.nii.gz ] ; then | ||
fslmaths ${concatfmrihp}.ica/mc/prefiltered_func_data_mcf_conf_hp_clean.nii.gz -Tmean -mul 0 -add 1 ${concatfmrihp}.ica/mc/prefiltered_func_data_mcf_conf_hp_clean_mask.nii.gz | ||
fslmeants -i ${concatfmrihp}.ica/mc/prefiltered_func_data_mcf_conf_hp_clean.nii.gz -m ${concatfmrihp}.ica/mc/prefiltered_func_data_mcf_conf_hp_clean_mask.nii.gz -o ${ConcatFolder}/Movement_Regressors_hp${hp}_clean.txt --showall | ||
cat ${ConcatFolder}/Movement_Regressors_hp${hp}_clean.txt | tail -$(fslval ${concatfmrihp}.ica/mc/prefiltered_func_data_mcf_conf_hp_clean.nii.gz dim4) > ${ConcatFolder}/Movement_Regressors_hp${hp}_clean.txt |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
FYI, tail can take a filename as argument, and can be specified as "skip n lines" using +.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am comfortable with the existing usage.
ICAFIX/hcp_fix_multi_run
Outdated
if [ -f ${ConcatFolder}/${concatfmrihp}.ica/mc/prefiltered_func_data_mcf_conf_hp_clean.nii.gz ] ; then | ||
${Caret7_Command} -volume-merge ${fmriNoExt}_hp${hp}.ica/mc/prefiltered_func_data_mcf_conf_hp_clean.nii.gz -volume ${ConcatFolder}/${concatfmrihp}.ica/mc/prefiltered_func_data_mcf_conf_hp_clean.nii.gz -subvolume ${Start} -up-to ${Stop} | ||
fslmeants -i ${fmriNoExt}_hp${hp}.ica/mc/prefiltered_func_data_mcf_conf_hp_clean.nii.gz -m ${ConcatFolder}/${concatfmrihp}.ica/mc/prefiltered_func_data_mcf_conf_hp_clean_mask.nii.gz -o $(dirname $fmri)/Movement_Regressors_hp${hp}_clean.txt --showall | ||
cat $(dirname $fmri)/Movement_Regressors_hp${hp}_clean.txt | tail -$(fslval ${fmriNoExt}_hp${hp}.ica/mc/prefiltered_func_data_mcf_conf_hp_clean.nii.gz dim4) > $(dirname $fmri)/Movement_Regressors_hp${hp}_clean.txt | ||
fi |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Given that ${ConcatFolder}/Movement_Regressors_hp${hp}_clean.txt
has already been created, a seemingly much simpler way to accomplish this would be:
outFile=$(dirname $fmri)/Movement_Regressors_hp${hp}_clean.txt
sed -n "${Start},${Stop}p" ${ConcatFolder}/Movement_Regressors_hp${hp}_clean.txt > ${outFile}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wanted the intermediate NIFTI file in place with the current implementation.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do we want a NIFTI version of the movement regressors lying around? If it serves some purpose, can you add a comment explaining what its value is?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- Should we also be deriving a
_dt
version of the cleaned motion regressors? - Once we have
hcp_fix_multi_run
ready, we need to transfer the relevant code tohcp_fix
as well (for the single-run condition). - There is an oddity in that the "cleaned" version of the Movement_Regressors will be nTP x 24, whereas the original is nTP x 12. Not sure if we want to do anything about that, but raising the awareness of it...
Overall many of the above changes fall in the category of probably accomplishing the same thing with different code, which I am not really sure is necessary (as you may see, I generally don't make these kind of comments on pull requests as it seems like it just generates extra work for the person implementing the request requiring more code changes and testing for the same result).
|
Confusing code is bad code in that it makes it more challenging to work on the code later, especially if it is someone else that has to work on it. The suggested changes should be fairly easy to make and test. Part of the point of code review is to find simpler and less confusing code to do the same thing. |
Code readability and easy interpretability should be valued as well.
|
Well I responded to each comment above. I don't agree with any of them in this case. Both of you at times don't see that the costs of changing and testing stuff just for the sake of it are real. I likely also don't always see the costs of code that is quickly written being confusing to others. We do need to balance these things, but in this case the decisions I made above were well considered. |
|
@glasserm In this case, both @coalsont and myself are indicating that we don't have the right balance. The usage statement for |
Here is the usage of fslmeants: fslmeants -i filtered_func_data -o meants.txt -m my_mask As you can see, |
I tested --showall without -m for you, since you were unwilling. Unless the output format is different, it seems to have worked. None of the help examples use --showall, but you were willing to try that option and see what happened... I don't think changing the |
Address Mike and Tim's concerns
Unrelated, but Sri just coincidentally brought this to my attention, as he was attempting to ascertain some timing info from the log files. Can we move this bit of code in
down to just after here:
so that the message about "Running MELODIC" (and version info if thx |
I tested it without the mask and it worked, so I removed those lines. As for this other change, feel free to make it yourself and it does not require a pull request. I am going to merge this unless there is any last comment this evening. |
Regress sICA noise components out of movement regressors to enable their use on sICA+FIX cleaned fMRI data. The files are present in text and .nii.gz formats and for both the concatinated and single runs