questions > Extracting times slices when using dcm2niix
Showing 1-7 of 7 posts
Display:
Results per page:
May 29, 2024  09:05 PM | hr3260
Extracting times slices when using dcm2niix

Hello, 


I'm new to dcm2niix. I'm currently trying to convert .dcm files into .nii files. I would like to pull the protocol names and slice acqusition times also. I can't find in the options documentation how to derive acquisition times. Below is the command line I'm using. Is there an option combination I should include to extract slice acqusition times?


I should add that I've tried verbose (-v 2) but it doesn't include the protocol name. Also, I'm embedding the command line in python as well.


code: 


subprocess.call('dcm2niix -z n -f %p -o '+ExpLoc+' '+glob(Folder[Day])[0]+' > '+ExpLoc+'/conversion.txt', shell=True)

May 29, 2024  11:05 PM | Chris Rorden
RE: Extracting times slices when using dcm2niix

Slice timing depends on your manufacturer, for more details see:


https://github.com/rordenlab/dcm2niix/tree/master/GE


https://github.com/rordenlab/dcm2niix/tree/master/Philips


https://github.com/rordenlab/dcm2niix/tree/master/Siemens


 


With regards to protocol names,%p=protocol name (from 0018,1030). If 0018,1030 is empty, the SequenceName (0018,0024) is used.


  https://github.com/rordenlab/dcm2niix/bl...


It is possible your data is anonymized, and therefore lacks this. Note that for GE images, the protocol name is generic, so you will want to use a different tag.


 


I would suggest you use dcmdump or gdcmdump to create a text file with all your DICOM header meta data to determine what tags are most relevant for your needs. Assuming the DICOM image "img.dcm" you would run "dcmdump img.dcm > dcm.txt"


 


 

May 31, 2024  12:05 PM | hr3260
RE: Extracting times slices when using dcm2niix

Thanks! It seems that another means of obtaining the time slices and other metadata, atleast for siemens .dcm images, is to set the -b y in the command. Alhough this dumps the data into json files, but that's not really an issue. 

May 31, 2024  02:05 PM | Chris Rorden
RE: Extracting times slices when using dcm2niix

The `-b y` is the default behavior. You get the BIDS sidecar unless you disable it with `-b n`.

May 31, 2024  05:05 PM | hr3260
RE: Extracting times slices when using dcm2niix

On my system, the package indicates that b -n is the default, but for -ba y is the default

May 31, 2024  06:05 PM | Chris Rorden
RE: Extracting times slices when using dcm2niix

Either you are using a custom fork of dcm2niix, an ancient version of dcm2niix or your defaults file has been modified. You can observe the version, the default BIDS setting and the location of your defaults file by running "dcm2niix" from the command line without any parameters:


```


Chris Rorden's dcm2niiX version v1.0.20240202  Clang14.0.3 ARM (64-bit MacOS)


...


  -b : BIDS sidecar (y/n/o [o=only: no NIfTI], default y)


...


Defaults file : /Users/chris/.dcm2nii.ini


```


If you delete the default file (for Unix, "rm ~/.dcm2nii.ini") the default behavior should be "-b y".


 

May 31, 2024  06:05 PM | hr3260
RE: Extracting times slices when using dcm2niix

Would a new default file be generated once I run dcm2niix again?


 


EDIT: You can ignore this question.