questions > Custom DICOM tag for naming NIFTI
Showing 1-2 of 2 posts
Nov 2, 2020 10:11 AM | Max R
Custom DICOM tag for naming NIFTI
Hi Chris,
I would like to append a custom DICOM tag (namely, 0008,0033) to the NIFTI-file during conversion. In the naming manual I couldn't find an option to append a custom DICOM tag to the naming (nor the DICOM tag that I want).
The problem that I specifically want to solve is that I have a dynamic sequence with some post-processing performed (they made subtraction images) and the time of the study, series number, etc. in the DICOM tag are the same. Therefore, dcm2niix appends -a, -b, -c, etc to the files, but they are not in the correct order, i.e. -a is not the second scan of the dynamic sequence.
I found that the Content Time (0008,0033) differs among the individual 3D images and want to name the NIFTI accordingly (so I know the order).
Is there a way to do this?
Thanks!
Max
Edit: I realized I can also identify them with their series UID (0020,000E), but then I will still have to check the order, so my original question still stands.
I would like to append a custom DICOM tag (namely, 0008,0033) to the NIFTI-file during conversion. In the naming manual I couldn't find an option to append a custom DICOM tag to the naming (nor the DICOM tag that I want).
The problem that I specifically want to solve is that I have a dynamic sequence with some post-processing performed (they made subtraction images) and the time of the study, series number, etc. in the DICOM tag are the same. Therefore, dcm2niix appends -a, -b, -c, etc to the files, but they are not in the correct order, i.e. -a is not the second scan of the dynamic sequence.
I found that the Content Time (0008,0033) differs among the individual 3D images and want to name the NIFTI accordingly (so I know the order).
Is there a way to do this?
Thanks!
Max
Edit: I realized I can also identify them with their series UID (0020,000E), but then I will still have to check the order, so my original question still stands.
Nov 2, 2020 11:11 AM | Chris Rorden
RE: Custom DICOM tag for naming NIFTI
Seeing this is a custom usage of DICOM, you probably want to make a
custom DICOM to NIfTI converter. You could make a simple fork of
dcm2niix and modify it to alias ContentTime (0008,0033) as
your time of study (e.g. 0008,0020; 0008,0030) so that -f
%s_%t would create a filename based on series number and content
time. The code includes a commented out "kContentTime" that makes
this a simple operation:
https://raw.githubusercontent.com/rordenlab/dcm2niix/master/console/nii_dicom.cpp
Alternatively, you might want to modify the Matlab-based. dicm2nii. Being based in Matlab scripts, it is easy to modify:
https://github.com/xiangruili/dicm2nii
https://raw.githubusercontent.com/rordenlab/dcm2niix/master/console/nii_dicom.cpp
Alternatively, you might want to modify the Matlab-based. dicm2nii. Being based in Matlab scripts, it is easy to modify:
https://github.com/xiangruili/dicm2nii