-
-
Notifications
You must be signed in to change notification settings - Fork 41
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
✨Feature/update pixdim4 for the final *bold outputs #2154
base: develop
Are you sure you want to change the base?
Conversation
|
||
|
||
def update_pixdim4(file_path, new_pixdim4): | ||
"""Update the pixdim4 value of a NIfTI file using 3drefit. |
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.
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 not sure about this one. May be @sgiavasis could advise on this.
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.
The reason to use AFNI 3drefit
instead of nibabel
is to change the Time step
in 3dinfo
as well along with pixdim4
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 looked into this further. It seems that it only refers to, and impacts, an AFNI-specific slice-timing setting in the header, which can be checked using 3dinfo -slice_timing
.
I ran this on several different datasets and found all of them to be unset:
0.000000|0.000000|0.000000|0.000000|0.000000|0.000000|... etc.
This was both raw data and final outputs, just to make sure C-PAC wasn't clearing this setting as well.
I am pretty sure this is an esoteric and rarely-used setting. As we know, slice-timing offsets and sequences are now contained in BIDS sidecars. But in the interest in keeping up with the theme of this issue and PR, where we maintain the old header information in case a user wants to run post-processing using some non-BIDS-enabled tools, I would still want to avoid inadvertently changing an AFNI header slice-timing offset to something wrong.
So the question remains, how often is this setting actually populated? Again, I think rarely. But if it is, when a tool invoked by C-PAC clobbers the TR value in the pixdim4
header field, is it also clobbering this field? I doubt it, and if we run 3drefit -TR
and it scales newTR/oldTR
like the 3drefit
docs say, it might scale by, let's say, 0.8/1.0
as it would in our recent specific case.
Also curious about -Tslices
- can this be used blankly with no parameter, to keep it the same, but prevent the scaling? May be worth manually setting this AFNI header field with the offsets from the sidecar, then trying a few of these permutations out.
6680c32
to
9262d74
Compare
9262d74
to
0788215
Compare
Fixes
Fixes/Related to #2139 by @sgiavasis
Description
Added a node at the very end just before data-sink to compare and update/match the
pixdim4
of the CPAC processed output with the native raw source bold image, as in figure below.Technical details
Tests
Run this branch and check the final CPAC outputs with following command
for file in *preproc_bold.nii.gz; do echo $file; fslinfo "$file"| grep pixdim4; done
For the outputs below, the value should be
0.8
sub-PA001_ses-V1W1_task-facesmatching_run-1_desc-preproc_bold.nii.gz
pixdim4 0.800000
sub-PA001_ses-V1W1_task-facesmatching_run-1_space-MNI152NLin2009cAsym_desc-preproc_bold.nii.gz
pixdim4 0.800000
sub-PA001_ses-V1W1_task-poke_run-1_desc-preproc_bold.nii.gz
pixdim4 0.800000
sub-PA001_ses-V1W1_task-poke_run-1_space-MNI152NLin2009cAsym_desc-preproc_bold.nii.gz
pixdim4 0.800000
sub-PA001_ses-V1W1_task-poke_run-2_desc-preproc_bold.nii.gz
pixdim4 0.800000
sub-PA001_ses-V1W1_task-poke_run-2_space-MNI152NLin2009cAsym_desc-preproc_bold.nii.gz
pixdim4 0.800000
sub-PA001_ses-V1W1_task-REST_run-1_desc-preproc_bold.nii.gz
pixdim4 0.800000
sub-PA001_ses-V1W1_task-REST_run-1_space-MNI152NLin2009cAsym_desc-preproc_bold.nii.gz
pixdim4 0.800000
Screenshots
Checklist
Update index.md
).develop
branch of the repository.Developer Certificate of Origin
Developer Certificate of Origin