questions
questions > RE: dcm2nii converting resting state files error
Feb 7, 2017 02:02 PM | Chris Rorden
RE: dcm2nii converting resting state files error
Hello-
dcm2niix is a file format converter that converts DICOM to NIfTI. It is not a datatype converter: it losslessly converts images preserving the original data type where ever possible. Therefore, the way to get FLOAT32 output is to provide input images that use the FLOAT32 data type. I have two suggestions: first, see if the subsequent tools you are using can be upgraded to support integer data. This will substantially reduce the amount of disk space. Further, many tools (like my MRIcron and MRIcroGL) use substantially less RAM when dealing with 16-bit data and are substantially quicker (using integer rather than floating point math and exploiting lookup tables). There are no benefits from upsampling beyond compatibility with tools that do not support the more compact format.
If you really want to want to upsample data to FLOAT32, here are options (listed from easiest to hardest):
1.) Leverage the fact that fslmaths defaults to the FLOAT32 datatype:
fslmaths chris_t1 -add 0.0 fchris_t1
2.) Use a simple SPM script
https://github.com/rordenlab/spmScripts/blob/master/nii_change_datatype.m
3.) Modify the dcm2niix code to save as FLOAT32. In particular, you would want to edit the nii_saveNII3D() function of nii_dicom_batch.cpp. If you want to share your solution you can submit a pull request.
dcm2niix is a file format converter that converts DICOM to NIfTI. It is not a datatype converter: it losslessly converts images preserving the original data type where ever possible. Therefore, the way to get FLOAT32 output is to provide input images that use the FLOAT32 data type. I have two suggestions: first, see if the subsequent tools you are using can be upgraded to support integer data. This will substantially reduce the amount of disk space. Further, many tools (like my MRIcron and MRIcroGL) use substantially less RAM when dealing with 16-bit data and are substantially quicker (using integer rather than floating point math and exploiting lookup tables). There are no benefits from upsampling beyond compatibility with tools that do not support the more compact format.
If you really want to want to upsample data to FLOAT32, here are options (listed from easiest to hardest):
1.) Leverage the fact that fslmaths defaults to the FLOAT32 datatype:
fslmaths chris_t1 -add 0.0 fchris_t1
2.) Use a simple SPM script
https://github.com/rordenlab/spmScripts/blob/master/nii_change_datatype.m
3.) Modify the dcm2niix code to save as FLOAT32. In particular, you would want to edit the nii_saveNII3D() function of nii_dicom_batch.cpp. If you want to share your solution you can submit a pull request.
Threaded View
Title | Author | Date |
---|---|---|
landsmbarbara | Sep 4, 2015 | |
Chris Rorden | Sep 4, 2015 | |
Kai-Chun Yang | Feb 6, 2017 | |
Chris Rorden | Feb 7, 2017 | |
Kai-Chun Yang | Feb 9, 2017 | |
lucero pacheco | Sep 11, 2016 | |
Chris Rorden | Sep 14, 2016 | |
Chris Rorden | Sep 12, 2016 | |
landsmbarbara | Sep 7, 2015 | |