Skip to content
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

Force generation of 3D volumes rather than 4D #646

Closed
ins0mniac2 opened this issue Nov 3, 2022 · 11 comments
Closed

Force generation of 3D volumes rather than 4D #646

ins0mniac2 opened this issue Nov 3, 2022 · 11 comments

Comments

@ins0mniac2
Copy link

I thought fourD=0 in the ini file should force dcm2niix (2022-07) to output 3d volumes instead of one 4D file, but that seems to not be the case. I have some multi-echo (2), multi-flip angle (11) data for which I want the output to be 2x11=22 3D volumes.

@neurolabusc
Copy link
Collaborator

This is by design. dcm2niix is designed to create BIDS-compatible NIfTI images. This requires that time (fMRI, resting state) and diffusion (DTI) series are saved as a single 4D file. On the other hand, differences in echo time or reconstruction (phase, real, imaginary, magnitude) are stored as separate files. If you want to break a 4D file into multiple 3D files you can write a simple Python or Matlab script or use fslspli.

@ins0mniac2
Copy link
Author

ins0mniac2 commented Nov 5, 2022

Thanks @neurolabusc . This is for TB1EPI B1-map acquisition, where there are different flip angles for different volumes that are supposed to be saved as separate volumes as shown in the example dataset here in BIDS. I can split the 4D image, but then the volume-specific information has to be entered manually, and some things (such as acquisition time and hence order) is lost. Is there a way to force 3D output ?

@neurolabusc
Copy link
Collaborator

This comment is underspecified. What manufacturer instrument are you using and what sequence? Feel free to share a sample dataset with my institutional email. Is this related to issue 641?

@ins0mniac2
Copy link
Author

ins0mniac2 commented Nov 5, 2022

Sorry -- the system is a Siemens Prisma_fit. The sequence is B1+ mapping with two TEs, not two TRs like issue 641. It is called mfc_seste_b1map_v1e , described in this paper about the example dataset mentioned above. I'll see if it is possible to share the data.

Also, it seems the fourD=0 option is ignored even when I say isBIDS=0, even for BOLD fMRI data. Does this mean splitting into 3D volumes at the time of conversion is not an option for any data at all ?

@neurolabusc
Copy link
Collaborator

dcm2niix can properly disambiguate Siemens DICOMs with multiple echo times. See here for VE11 DICOMs and here for XA30 enhanced DICOMs. I can not provide much guidance without a sample dataset. You may want to work with the Siemens Research Collaboration Manager associated with the site where data was acquired as it is their role to resolve such issues.

Please be aware that the dcm2niix initialization file is deprecated as described here and here. The number of attributes stored is very limited, with the full set of defaults being:

isGZ=0
isMaximize16BitRange=2
isBIDS=1
filename=%f_%p_%t_%s

dcm2niix does not have a fourD option. Rather, this was available in the fore runner dcm2nii which predates the BIDS format and enhanced DICOM. Development moved from dcm2nii to dcm2niix in 2016. The rationale for saving datasets as 3D was to support legacy versions of SPM, such as the now two decades old SPM2.

As described in issue 152 the community consensus has been to have dcm2niix behave predictably and reliably rather than having a huge number of optional behaviors. It is easy to wrap dcm2niix in scripts to fill specific niches. Alternatively, it is open source and you are free to fork the project to create a tool specialized for you application.

@ins0mniac2
Copy link
Author

Ah, I guess my initialization files are from the dcm2nii days!! Thanks for clarifying that. dcm2niix does distinguish the two echos and produces two 4D files, each with 11 volumes that have different FlipAngle. BIDS wants to distinguish these volumes for these data with the "flip" entity in filename as described here -- TB1EPI. Latest SPM will produce 3D files but neither SPM nor dcm2niix will extract the FlipAngle. I'll get back about possibility of data sharing.

@agahkarakuzu
Copy link

The TB1EPI was added to the specification as it was used by the hMRI toolbox, pinging @lazaral and @ChristophePhillips to see if they can provide DICOM files for this one.

@ins0mniac2 is that a WIP sequence you are using?

@lukeje
Copy link

lukeje commented Nov 8, 2022

Perhaps this comment I just made on the hMRI toolbox issues page helps to illuminate things. I think it won't be possible to extract these parameters generally from the DICOM headers without some sequence programming effort (which is kind of encompassed by this hMRI toolbox issue, but there hasn't been much movement on it for a while).

@agahkarakuzu
Copy link

Thank you so much for the pointer @lukeje !

I think some of these specifications encourage sequence development efforts more than format conversion.

@neurolabusc is there anything we can note in the spec to make your life easier for handling such cases?

@neurolabusc
Copy link
Collaborator

@agahkarakuzu it would help to have

  1. A dcm_qa style validation dataset with both DICOMs and BIDS sidecars, as well as a readme that explains how to derive the BIDS specification. For example, dcm_qa_ge shows how to derive slice timing for GE data by providing a sample dataset, text comments, as well as a minimal C program for calculating the value. This would help developers of SPM, dcm2niix, dicm2nii, etc support these BIDS tags.
  2. The validation dataset README could include the text details provided by @lukeje.
  3. I would reference the validation dataset from the BIDS dataset.
  4. After Prisma (and other Siemens scanners) are upgraded to XA30, the CSA shadow header will no longer exist. Has anyone ported these sequences to XA30 and do we know how these parameters are stored there? This may require working with the Siemens Research Collaboration manager associated with the sequence developers to make sure they get transferred.
  5. Does anyone have equivalent sequences from GE or Philips that could describe how to derive these parameters? Perhaps @mr-jaemin could acquire equivalent sequences on a GE simulator to allow provide both users and developers with an idea of how to acquire compatible datasets on their equipment.

@neurolabusc
Copy link
Collaborator

Closing this issue, as the core issue is with the DICOMs not dcm2niix. For this multi-flip angle sequence research sequence the FlipAngle field is set to zero in the DICOMs. A general assumption of dcm2niix is that the DICOM images are truthful. While we have included kludges to support sequences where this is not the case, support for these edge cases requires intimate knowledge of the sequence.

If sample DICOMs are provided with clear documentation, we can add a kludge to dcm2niix.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants