DICOM command line utilities

analyze2dcm 

A tool to create a new DICOM series from an Analyze volume. 

When to useIn pipelines or standalone utility: use when your processing tools produce Analyze output that you want to be available in DICOM format on XNAT (for instance, for use with XNAT Gateway)
How it worksYou supply an original DICOM series A and Analyze volume B, and obtain a new DICOM series with metadata derived from A but with voxels derived from B. Then, you upload the new DICOM series to an appropriate XNAT experiment.
Requirements to input
  • Data dimensions in DICOM series and Analyze volume should match.
  • DICOM series should have "MONOCHROME2" for photometric interpretation (16 bits per sample, one sample per pixel monochrome). For example, most MR or CT scans should be OK, but many ultrasounds (e.g. 8 bits per sample, color or monochrome) may not be supported.
    • DICOM series should not be compressed.
Usage
analyze2dcm [options] <DICOM_dir> <analyze_root>

DICOM dir: a directory with original DICOM series
analyze_root: input Analyze volume name without extension.

Options

< -o <dir>

< output DICOM directory

< -u <SerInstUID>

< if input DICOM directory has more than one series, specify DICOM Series Instance UID

< -p <PatName>

< set new patient name for the created series

< -d <Descr>

< set new series description for the created series

< -n <int>

< set new series number for the created series

< -s <int>

< scale all data in original volume to a specified integer maximum value (e.g. for floating point data that has to be converted to integer in DICOM)

< -z <int>

< flip z axis for the new series.

Examples

Suppose you have original DICOM series in "series10" folder, and processed Analyze volume in "p7857oc_auto_b50.img" , "p7857oc_auto_b50.hdr" files. Suppose the series has the following DICOM tag values:

(0x0010, 0x0010) [Patient's name] "Subj001"
(0x0008, 0x1030) [Study description] "Left^ventricle"
(0x0008, 0x103e) [Series description] "AX^T1"
(0x0020, 0x0011) [Series number] "5"

Run:

1. analyze2dcm series10 p7857oc_auto_b50

Running the command without options will not change any DICOM tags used in determining XNAT/DICOM hierarchy:

XNAT hierarchy, original DICOM series: Subj001 (Subject ID) -> [Study ID] -> "5" [Scan ID], "AXT1" [Scan description]
XNAT hierarchy, derived DICOM series: Subj001 (Subject ID) -> [Study ID] -> "5" [Scan ID], "AXT1" [Scan description]

 In this example, not changing scan ID and description may be confusing for XNAT archiving tools - use only if you intend to replace an original scan with post-processed version.

2. analyze2dcm -d blood_flow -n 501 p7857oc_auto_b50

This will change series identification from the XNAT point of view:

XNAT hierarchy, original DICOM series: Subj001 (Subject ID) -> [Study ID] -> "5" [Scan ID], "AXT1" [Scan description]
XNAT hierarchy, derived DICOM series: Subj001 (Subject ID) -> [Study ID] -> "501" [Scan ID], "blood_flow" [Scan description]

This method is recommended for adding derived DICOM to the same XNAT experiment. In case of anonymized DICOM, you may also change patient name (subject ID) to match existing XNAT subject ID, using -p option.

dcminfo

This is a small utility for printing space-separated multiple DICOM tags. May be convenient in automated scripts.

Usage:

dcminfo -t <group> <elem> [<group> <elem> ... <group> <elem>] <DICOM dir>

e.g. using on DICOM series from previous example,

dcminfo -t 0x0010 0x0010 0x0008 0x008 0x103e 0x0020 0x0011 study10

will produce output:

Subj001 Left^ventricle AX^T1 5

$label.name