dcm2niix

If I have a set of subdirectories that contain subject DICOM files, how do I use dcm2niix to convert all subject-specific files (in Users/me/all_subject_data/subjectX to nifti format and save in a new directory (output_dir)? What is the specific command?

Hi-

The AFNI-distributed version of this code is “dcm2niix_afni”; the “dcm2niix” program is written and maintained by Chris Rorden, and probably detailed questions on it are best directed to him. This one can probably be fielded OK here…

To see the help file for the program, run it without any options. E.g., “dcm2niix_afni”, which produces:


Compression will be faster with 'pigz' installed
Chris Rorden's dcm2niiX version v1.0.20181125  GCC9.3.0 (64-bit Linux)
usage: dcm2niix_afni [options] <in_folder>
 Options :
  -1..-9 : gz compression level (1=fastest..9=smallest, default 6)
  -b : BIDS sidecar (y/n/o [o=only: no NIfTI], default y)
   -ba : anonymize BIDS (y/n, default y)
  -c : comment stored in NIfTI aux_file (up to 24 characters)
  -d : directory search depth. Convert DICOMs in sub-folders of in_folder? (0..9, default 5)
  -f : filename (%a=antenna (coil) name, %b=basename, %c=comments, %d=description, %e=echo number, %f=folder name, %i=ID of patient, %j=seriesInstanceUID, %k=studyInstanceUID, %m=manufacturer, %n=name of patient, %p=protocol, %r=instance number, %s=series number, %t=time, %u=acquisition number, %v=vendor, %x=study ID; %z=sequence name; default '%f_%p_%t_%s')
  -g : generate defaults file (y/n/o/i [o=only: reset and write defaults; i=ignore: reset defaults], default n)
  -h : show help
  -i : ignore derived, localizer and 2D images (y/n, default n)
  -l : losslessly scale 16-bit integers to use dynamic range (y/n, default n)
  -m : merge 2D slices from same series regardless of study time, echo, coil, orientation, etc. (y/n, default n)
  -n : only convert this series number - can be used up to 16 times (default convert all)
  -o : output directory (omit to save to input folder)
  -p : Philips precise float (not display) scaling (y/n, default y)
  -r : rename instead of convert DICOMs (y/n, default n)
  -s : single file mode, do not convert other images in folder (y/n, default n)
  -t : text notes includes private patient details (y/n, default n)
  -u : up-to-date check
  -v : verbose (n/y or 0/1/2 [no, yes, logorrheic], default 0)
  -x : crop (y/n, default n)
  -z : gz compress images (y/i/n/3, default n) [y=pigz, i=internal:miniz, n=no, 3=no,3D]
 Defaults file : /home/ptaylor/.dcm2nii.ini
 Examples :
  dcm2niix_afni /Users/chris/dir
  dcm2niix_afni -c "my comment" /Users/chris/dir
  dcm2niix_afni -o /users/cr/outdir/ -z y ~/dicomdir
  dcm2niix_afni -f %p_%s -b y -ba n ~/dicomdir
  dcm2niix_afni -f mystudy%s ~/dicomdir
  dcm2niix_afni -o "~/dir with spaces/dir" ~/dicomdir

Of the examples there, I think this one is the most relevant to you:


dcm2niix_afni -o /users/cr/outdir/ -z y ~/dicomdir

… using the “-o …” option is mainly what you want, and the “~/dicomdir” would be what you would replace with “Users/me/all_subject_data/subjectX” or “/Users/me/all_subject_data/subjectX”.

–pt

Thank you! Also, what is the difference between dcm2niix vs. td3d? I’m trying to preprocess the ADNI data, but am not sure what the difference is between the two functions and which I should be using.