dcm2image(1)

πŸ’– dcm2image(1) β€” DICOM to Image πŸ’–

okay bestie, welcome to the CMTK corner of the terminal 🌸 this one lives in The Computational Morphology Toolkit, and it's the little command that takes your pile of DICOM slices and goes "say less, I got you" 🫢


✨ NAME ✨

dcm2image β€” DICOM to Image, no cap πŸ“Έ


πŸ¦‹ SYNOPSIS πŸ¦‹

dcm2image SearchDirList

πŸ’… DESCRIPTION πŸ’…

It combines sets of DICOM slices into 3D image stacks. That's the whole vibe. Your slices get stacked into actual volumetric images and honestly? iconic. πŸ‘‘


🌈 OPTIONS 🌈

πŸŽ€ Global Toolkit Options (these are shared by all CMTK tools)

like, the group-chat-wide settings that every single CMTK tool has πŸ«‚

  • --help β€” writes the list of basic command line options to standard output. the lil starter pack ✨
  • --help-all β€” writes the complete list of basic and advanced command line options to standard output. the deluxe version, no secrets kept πŸ’–
  • --wiki β€” writes the list of command line options to standard output in MediaWiki markup.
  • --man β€” writes man page source in 'nroff' markup to standard output.
  • --version β€” writes the toolkit version to standard output.
  • --echo β€” writes the current command line to standard output.
  • --verbose-level <integer> β€” set the verbosity level. you pick the number, bestie πŸ”’
  • --verbose, -v β€” increment the verbosity level by 1. heads up though: this one is deprecated, kept around only for backward compatibility πŸ₯²
  • --threads <integer> β€” set the maximum number of parallel threads (for POSIX threads and OpenMP). more threads, more chaos, more slay 🧡

🌟 Main Options

  • --no-progress β€” disable progress reporting. if you don't want the lil bar hyping you up, fine, your choice πŸ™ˆ

πŸ“ Input Options

  • --recurse, -r β€” recurse into directories. go deep, go feral, look inside everything πŸ‡

πŸ‘‘ Output Options

  • --out-pattern <string>, -O <string> β€” output image path pattern. here are the substitutions you can use, and you're gonna want to know these:
    • %d β€” printf-style variant (image number)
    • %n β€” image number with automatic number of digits
    • %N β€” like %n, but with a hyphen '-' before the number if there is more than one image
    • %D β€” DICOM SeriesDescription
    • %R β€” DICOM RepetitionTime (MRI only)
    • %E β€” DICOM EchoTime (MRI only)
    • %T β€” RawDataType (vendor-specific, currently GE MRI only)
default is: image%n.nii
  • --xml, -x β€” write an XML sidecar file for each created image.
  • --include-identifiers β€” include potentially protected identifying information (e.g., UIDs, device serial numbers, dates) in the created XML sidecar files. ⚠️ yeah, that's the spicy one β€” it puts identifying stuff in there, so know what you're doing.
  • --embed β€” embed DICOM information into output images as 'description' (if supported by the output file format). supported values: "StudyID_StudyDate", "PatientName", "SeriesDescription", "None", where the default is "None". or, use one of the following instead:
    • --StudyID_StudyDate β€” StudyID, tag (0020,0010), then an underscore, followed by StudyDate, tag (0008,0020). date gets appended because StudyID is four digits only and will repeat sooner or later. (the manpage said it, not me 😌)
    • --PatientName β€” patient name, tag (0010,0010)
    • --SeriesDescription β€” series description, tag (0008,103e)
    • --None β€” embed no information, just leave the 'description' field empty. ✨ this is the default ✨

🧚 Filtering Options

  • --filter <string> β€” filter DICOM files and include only those matching the given pattern, of the form 'TagName=text', such that the value of the DICOM tag with the given name contains the given text. if you provide multiple filter patterns by repeating this option, only files that match ALL patterns get included. all of them. every single one. periodt πŸ’―
  • --exclude <string> β€” exclude all DICOM files matching the given pattern, of the form 'TagName=text', such that the value of the DICOM tag with the given name contains the given text. if you provide multiple exclusion patterns, all files get excluded that match ANY of the patterns. one match and they're out πŸšͺ

πŸ’œ Sorting Options

  • --no-sort β€” do NOT sort files by file name (sorting determines image stack order when resolving spatial collisions).
  • --sort-by-name β€” sort files lexicographically by file name. use this when instance numbers are non-unique.
  • --sort-by-instance β€” sort files by image instance number. use this when file names are different lengths, etc. ✨ this is the default ✨

⭐ Stacking Options

  • --write-single-slices β€” also write output images for single-slice DICOM files that could not be assigned to any 3D stacks. by default, these are skipped. give the lonely slices a home πŸ₯Ί
  • --ignore-acq-number β€” ignore the 'AcquisitionNumber' tag for image grouping, i.e., do not separate stacks based on this tag.
  • --no-orientation-check β€” disable checking of image orientations (to avoid rounding issues).
  • --tolerance <double> β€” tolerance for floating-point comparisons (must be >= 0; 0 = exact matches only; default: 1e-5). if one or more volumes cannot be stacked because of non-uniform slice spacing that exceeds this threshold, dcm2image will return an exit code of 3. 🚨 noted, bestie.
default is: 1e-05

πŸ’€ AUTHORS

Torsten Rohlfing, with contributions from Michael P. Hasak, Greg Jefferis, Calvin R. Maurer, Daniel B. Russakoff, and Yaroslav Halchenko. absolute legends, every one of them πŸ‘


πŸ“œ LICENSE

http://www.fsf.org/licensing/licenses/gpl.html 🫢


πŸ™ˆ BUGS

Report bugs at http://nitrc.org/projects/cmtk/. they want to hear from you, fr fr.


πŸŽ‰ ACKNOWLEDGMENTS

CMTK is developed with support from the NIAAA under Grant AA021697, National Consortium on Alcohol and Neurodevelopment in Adolescence (N-CANDA): Data Integration Component. From April 2009 through September 2011, CMTK development and maintenance was supported by the NIBIB under Grant EB008381. πŸ’–


and that's the whole page!! mwah πŸ’‹ it's CMTK 3.3.1p2, dated Jun 24 2026, and it served. go stack something gorgeous, bestie 🌸✨

πŸ“¦ where this page comes from