FCP-INDI / C-PAC

Configurable Pipeline for the Analysis of Connectomes
https://fcp-indi.github.io/
GNU Lesser General Public License v3.0
64 stars 41 forks source link

✨ Potential idea: repopulate certain Nifti header fields #2139

Open sgiavasis opened 3 months ago

sgiavasis commented 3 months ago

Related problem

Certain unused Nifti header fields can sometimes be overwritten by a tool somewhere in the pipeline. For example, the TR value can be stored in pixdim4 and then overwritten with something like the number of TRs/timepoints later on, depending on the tool.

C-PAC relies on the BIDS sidecars for the TR and other usual Nifti header information, not the Nifti headers, so processing is not impacted by this. However, users who may rely on older tools that do not use BIDS may need the Nifti headers intact when running those tools for post-processing analysis.

Proposed feature

We could possibly implement a feature where we simply make sure or copy over the original Nifti header to the final pipeline outputs, as appropriate - as long as this information remains accurate by the end of the pipeline. At the very least, the TR can be held stable.

Acceptance criteria

Alternatives

No response

Additional context

No response

birajstha commented 2 months ago

Following AFNI tools found to reset pixdim[4] to the Time Step value in 3dinfo.

  1. 3dTproject
  2. 3dcalc
  3. TCat

raw file (pixdim4=0.8) -> split -> TCat = preserved (pixdim4 = 0.8) desc_preproc (pixdim=1) -> update_pixdim=0.8 -> split -> TCat = reset (pixdim4 = 1)

birajstha commented 2 months ago

Looking into output of CPAC for a particular sub, ses, scan, whose native TR and pixdim[4] = 0.8. It was obvious that this happened at different places in the pipeline.

File Name Status
sub-PA001_ses-V1W1_task-facesmatching_run-1_space-MNI152NLin2009cAsym_desc-head_bold.nii.gz "0.0, needs updating"
sub-PA001_ses-V1W1_task-facesmatching_run-1_space-MNI152NLin2009cAsym_reg-noGSR_desc-preproc1_bold.nii.gz "1.0, needs updating"
sub-PA001_ses-V1W1_task-facesmatching_run-1_desc-preproc_bold.nii.gz Already 0.8
sub-PA001_ses-V1W1_task-facesmatching_run-1_space-MNI152NLin2009cAsym_reg-GSR_desc-preproc2_bold.nii.gz "1.0, needs updating"
sub-PA001_ses-V1W1_task-facesmatching_run-1_desc-mean_bold.nii.gz "None, needs updating"

So, @sgiavasis suggested to build in functionality to check the pixdim4 field of input raw bold files, then at the end, check the pixdim4 and update it if it has changed.