dtoa - DICOM to ACR/NEMA and Analyze
Command line program to convert DICOM format to ACR/NEMA and then to
Analyze v7 format.
dtoa [-ana | -nif | -nii [-delses | -nodelses] [-over] [-isfil] [-rcv] [-noge] [-notime] [-scale]
[-diff [-fdt] [-fnomask] [-fnoeddy] [-pq] [-gfa] [-medinria]]
[-scracr] [-acr] [-fpv] [-dv] [-quiet] [-gz]] [-add] [-noadd] [-anon] [-date] [-datefirst] [-s<num>]
[-c] [-float] [-spos] [-itime] [-[no]spmo] [-exe <path>] [-v] [-time] [-coil] [-meta] [-mono] [-clip]
[DICOM_source_directory_root [ACR/NEMA or Analyze_destination_directory_root]]
- -ana
-
Converts ACR/NEMA files to Analyze format. If this flag has been specified, the
following indented flags will also become active. If this flag is present with
-nif or -nii flags then the last flag specified takes
priority.
- -nif
-
Converts ACR/NEMA files to NIFTI-1 format, with separate .hdr and .img files.
If this flag has been specified, the following indented flags will also become
active. If this flag is present with
-ana or -nii flags then the last flag specified takes
priority.
- -nii
-
Converts ACR/NEMA files to NIFTI-1 format as a combined .nii file.
If this flag has been specified, the following indented flags will also become
active. If this flag is present with
-ana or -nif flags then the last flag specified takes
priority.
- -delses
-
After conversion, delete the temporary ACR/NEMA or DICOM
files created during conversion (this is now the default). The source ACR/NEMA
or DICOM files will not be deleted.
- -nodelses
-
After conversion, do not delete the temporary ACR/NEMA or DICOM. They will
remain in a subdirectory named session_1.
- -over
-
This flag is passed to
acrtoana.
The converted Analyze files will overwrite existing Analyze files with the same
name. If this option is not specified, existing Analyze files should not be
overwritten but will be named with subsequent series numbers to the previously
existing files. Also see the -date option, below.
- -gz
-
This flag is passed to
acrtoana.
The converted files will be compressed using gzip with resulting filename
extensions .gz. This option is only available if the zlib libraries have been
included during compilation with an ANSI C compiler.
- -isfil
-
This flag is passed to
acrtoana.
While converting to Analyze, try to determine whether images are in Siemens
mosaic format and if so, split them into individual images.
- -rcv
-
Rotate coronal VENDIE. This flag is passed to
acrtoana.
If the images appear to be a coronal VENDIE acquisition
(according to the sequence filename or protocol name stored in the ACR/NEMA
header) then call the
mirrot program to produce an additional Analyze
file containing axial images.
- -noge
-
Do not perform additional slice reordering on GE DICOM files. This flag is
passed to
acrtoana.
- -notime
-
This flag is passed to
acrtoana.
The acquisition time ACR/NEMA message is ignored in the algorithm that
determines which images belong togther in an acquisition series. This may be
useful when converted Analyze files are created with one image per file while
the desire is to produce a combined Analyze file. This may occur from some
manufacturer's images for dynamic acquisitions or when images have been
post-processed on the scanner, e.g., a cardiac cine or rotating MIP.
- -scale
-
This flag is passed to
acrtoana.
If the intensity scaling factor stored in the ACR/NEMA header changes then
start a new Analyze file. If this flag is not specified then changes in
intensity scaling factor are ignored in the algorithm that determines
which images belong together in an acquisition series.
- -diff
-
This flag is passed to
acrtoana
which attempts to recognise diffusion weighted acquisitions from information in
the ACR/NEMA header. If a diffusion acquisition is detected, write the
diffusion gradient vectors to an associated text file _dgv.txt,
write a second Analyze file in which the images are ordered correctly for
FSL's diffusion toolbox and
also write associated the _bvecs, _bvals files, and write
a text file containing the diffusion b matrices _bmat.
Appears to work for Philips (normal and overplus), Siemens, and GE product
sequences although largely untested for mainly sagittal or coronal acquisitions.
- -fdt
- This flag is passed to
acrtoana.
If a diffusion acquisition is detected then after all file conversion has
finished, perform basic post-processing using
FSL's diffusion toolbox to
perform eddy current correction, calculate the diffusion tensor, produce maps
of Mean Diffusivity, Fractional Anisotropy, and an isotropic diffusion
weighted image. This options requires that FSL is installed correctly and that
the detected diffusion acquisition contained at least six diffusion directions.
The processing is set running in the background and may take some time; no
confirmation is given when processing is complete (other than appearence of the
relevant image files) and this must be taken into consideration when rebooting
the computer, especially if using Cygwin. Under UNIX or GNU/Linux, the
background jobs are batched to run one after another which should prevent the
system running too slowly, however, this feature is not available under
Cygwin so be aware that converting DICOM images with more than one diffusion
acquisition at any one time will slow down the computer significantly.
- -fnomask
- This flag is passed to
acrtoana.
- -fnoeddy
- This flag is passed to
acrtoana.
- -pq
- This flag is passed to
acrtoana.
- -gfa
- This flag is passed to
acrtoana.
- -medinria
- This flag is passed to
acrtoana.
- -mtr
- This flag is passed to
acrtoana.
- -srcacr
- This flag is passed to
acrtoana.
- -acr
- This flag is passed to
acrtoana.
- -fpv
-
This flag is passed to
acrtoana.
Philips DICOM files contain two intensity scaling/offset values, a floating
point scaling factor/offset and a display value scaling factor/offset. The
floating point scaling factor/offset should best represent the MR signal. If
the ACR/NEMA file contains Philips data then the floating point scale/offset
will be stored in the Analyze header as funused1 and funused2
respectively, else the display value scaling factor/offset values will be
stored in the Analyze header instead. This option is currently on by default.
- -dv
-
This flag is passed to
acrtoana.
The intensity scaling factor/offset stored in the Analyze header as
funused1 and funused2 will always be the display value
scale/offset regardless of whether the ACR/NEMA file contains Philips data
or not. This is the current default for non-Philips data.
- -float
-
This flag is passed to
acrtoana.
Converted Analyze files are saved as scaled floats (32 bits-per-pixel) with
the intensity scaling and offset applied to the intensities in the image file.
- -spos
-
This flag is passed to
acrtoana.
Writes an additional text file containing slice positions for each slice in an
Analyze file. If the DICOM header indicates a multistack acquisition, then
examines the slice positions to determine whether the volume may contain
overlapping stacks (with an integer number of overlapping slices). If so, then
also write another text file containing command like options for
mergestacks
although
mergestacks
is not run automatically.
This option works for multistack anatomicals style acquisitions, however it may
not work in a general case involving multivolume, multiecho, etc.,
acquisitions, so interpret the results carefully.
- -itime
-
This flag is passed to
acrtoana.
Writes an additional text file containing image acquisition time for each slice
in the Analyze file. This information may be useful when attempting to
synchronise image acquisition time with other recordings, such as fMRI
stimulus delivery systems or physiological signal recordings.
This option works for standard fMRI style acquisitions, however it may
not work in a general case involving multiecho, etc.,
acquisitions, so interpret the results carefully.
- -spmo or -nospmo
-
These flags are passed to
acrtoana
and specifies what information is written to the Originator field in the
Analyze header.
- -pl
-
This flag is passed to
acrtoana
and indicates whether a CSV file of the key acquisition parameters, extracted
from the DICOM headers, should also be saved.
- -quiet
-
This flag is passed to
acrtoana
and suppresses most of the output describing the conversion progress.
- -add
-
By default the converted ACR/NEMA files will be named 0.img, 1.img, 2.img, ...
as required by the old conversion software provided by
Radionics. However, this results in
the images being ordered incorrectly if they are sorted by filename alone
which may cause problems for some other software (although not
acrtoana). If this flag is specified, the
ACR/NEMA filenames will be padded by zeroes to solve this problem, i.e.,
000.img, 001.img, 002.img, ...
- -noadd
-
Disable the -add option, above. Currently, this is the default. If both
options are specified, the last occurence takes precedence.
- -date
-
As well as naming the subdirectory containing the Analyze files after the
patient name (from the DICOM header), the acquisition date and time are also
appended to the directory name. This allows images acquired in different
sessions on the same patient to be separated into different directories. If
this option is not specified and the -over option, above, is
specified then
the images from the later scanning sessions may overwrite images from earlier
acquisitions if the patient name has been entered exactly the same for both
scanning sessions.
- -datefirst
-
Same as above except that the date is prefixed to the directory name rather than
appended.
- -s<num>
-
Specifies how the ACR/NEMA files are organised in subdirectories. <num>
is one of the following, entered with no space between it and the preceeding
s -
- 0
- Files from each acquisition series will be stored in separate sub-directories
where the sub-directory will be named after the series number in the DICOM
header. If the series number is not present or stated incorrectly in the
DICOM header then converted ACR/NEMA files may get overwritten. The ACR/NEMA
file are named after the image number stated in the ACR/NEMA header file and as
such may not be numbered contiguously.
- 1
-
As above but all series and image names are renamed to be in ascending order.
- 2
-
All ACR/NEMA files are combined in one subdirectory named session_1
and renamed to be in ascending order, with images from later series
following on from image numbers of earlier acquisitions. This replicates how
ACR/NEMA files were named after being receieved on the old
Radionics workstation from the
Merge PC. This is the default.
- -c
-
Before reading the DICOM header of each file, first copies the DICOM file to
a temporary file on the hard disk. This should speed up conversion where the
source DICOM files are on a slow medium, e.g., a CDROM with a small
cache or a slow network drive.
- -anon
-
Pseudo-anonymization of patient identification is achieved by replacing the
patient's name by the numeric date and time of the first acquisition in each
scanning session. The patient name is replaced by the date and time where
ever it appears.
- -anon2
-
As above, except the real patient name remains in the .txt file associated with
each Analyze file pair.
- -srcacr
-
By default, dtoa converts DICOM format to ACR/NEMA. Specifying this
flag allows both DICOM and ACR/NEMA files to be considered as input. It is
useful to sort ACR/NEMA images into patient-by-patient subdirectories.
Currently, this option doesn't work reliably.
- -destacr
-
This options explicitly forces conversion of DICOM images into ACR/NEMA format
regardless of whether subsequent conversion to Analyze format has been
requested (see below). This is the default unless the -ana flag has
been specified.
- -destdicom
-
By default, dtoa convert DICOM to ACR/NEMA format. If the
-ana flag is specified then these ACR/NEMA files are subsequently
converted to Analyze. If dtoa is just being using to convert DICOM to
Analyze, there is no need for the intermediate conversion to ACR/NEMA as
acrtoana can convert both ACR/NEMA and DICOM to
Analyze. Also, the conversion to ACR/NEMA may result in the lose of some
information from the header which may be useful, especially for interpreting
private company messages, SQ messages, and explicit VR. If this flag is
specified then no conversion to ACR/NEMA is performed; however the DICOM images
are still sorted into patient subdirectories, sorted by image number and
renamed. This flag is implied if the -ana flag has been supplied,
unless the -destacr flag is also present, see above.
- -exepath <path>
-
dtoa converts to Analyze format by calling
acrtoana. By default it assumes that
acrtoana is in the current PATH. If not, its
location may be defined explicitly by including the directory containing
acrtoana as part of this flag. If the path contains
spaces it must be enclosed in double quotes. Note, enclosing a PATH in quotes
in Windows may cause problems if the back-slash separator is taken as an
escape character.
- -d
-
Displays additional diagnostic output.
- -v
-
Displays the date and time that dtoa was compiled, and exits.
- -time
-
Displays additional information about the duration that the various stages of
the program took to perform.
- -coil
-
Appends the MR receive RF coil name to the patient's name when creating output
subdirectories for the converted image files. Note, this may not work as
expected on all configurations of RF coil selections on Siemens MR scanners.
- -meta
-
This flag is passed to
acrtoana
which then saves an additional text file containing some information from
the DICOM header which may be required for subsequent scripting.
- -mono
-
This flag is passed to
acrtoana
to indicate that any colour DICOM files should be
converted
and saved as a monochrome image.
- -clip
-
This flag is passed to
acrtoana
and sets any intesity values greater than 32767 to be 32767. This ensures that
unsigned data spanning all 16 bits will fit within signed short intensities.
('Unsigned short' is not a valid data type in the Analyze format, only in
NIFTI, and as such,
acrtoana
would otherwise promote full range 16 bit unsigned short DICOM data to 'signed
int', which is a valid Analyze datatype although twice the size.)
- DICOM_source_directory_root
-
The top level subdirectory containing the DICOM files to be converted. All files
in this directory and all subdirectories are examined to see if they in the
DICOM format and if so, included in the conversion. As such, do not specify this
to be the top-level directory else the entire hard disk will be searched for
DICOM files, all of which will then be converted. If no directory is specified
then the current directory is used by default. If only one directory is
specified on the command line then it is assumed to be the DICOM source
directory.
- ACR/NEMA or Analyze_destination_directory_root
-
The subdirectory under which the converted ACR/NEMA or Analyze files will be
saved. The user must have write permission on this directory. If no directory
is specified then the current directory is used.
dtoa was originally written to convert DICOM images into the previous
incarnation of DICOM format, ACR/NEMA 2, in order to support old software which
would only accept ACR/NEMA format. As such, the a in dtoa
stands for ACR/NEMA. However, the most common use of the program is to
convert DICOM to Analyze format, requiring the -ana command line
flag, which in turn calls the ACR/NEMA to Analyze conversion program
acrtoana, which must be in the PATH.
The conversion is performed in three stages. First, a list of all files in all
subdirectories under the DICOM source directory is constructed. Then
each file is opened and examined in turn to see if it is in DICOM format. Files
in DICOM format are converted to ACR/NEMA and copied to the destination
directory, renamed according to information read from the DICOM header
(patient name, series number, image number).
Finally, if the -ana flag was specified then
acrtoana is called in each new subdirectory in the
destination directory to convert the ACR/NEMA files to Analyze. For
details of the Analyze conversion see the page for
acrtoana.
dtoa and
acrtoana
are similar programs with considerable overlap. Use dtoa routinely to
convert DICOM to ACR/NEMA or Analyze format especially
from a DICOM CD or DVD containing several patients' scans which need to be
sorted and separated into unique subdirectories. Use
acrtoana
to convert DICOM or ACR/NEMA to Analyze format in a single subdirectory
without sorting the input files in any way other than their filename. If
conversion using dtoa fails then trying to identify the troublesome
DICOM files may be more successful using
acrtoana directly.
Examples
dtoa -ana
Converts all DICOM images found under the current directory to Analyze format,
also saved under the current directory.
dtoa -ana -datefirst -c -diff /cdrom /data/exp1
Converts all DICOM images found under the directory /cdrom to Analyze
format. The converted Analyze images will be saved under /data/exp1.
The -datefirst option prefixes each patient subdirectory with the
date and time of the scan which is useful when converting DICOM files from
multiple patients (or the same patient ID scanned multiple times).
As the source images are on a CD, the -c
flag results in each DICOM image being copied to the hard disk before
interegating the header, which should speed up conversion. The -diff
flag is also used while converting to Analyze which results in any diffusion
weighted acquisitions being converted further into a suitable format for FSL.
References