|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
dicom2 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
dicom2 is a free command-line driven program which allows you
to convert medical images and DICOM files to various other formats, while
optionally performing some rudimentary image processing tasks...
reads DICOM file, or raw data-sets (ACR/NEMA). converts non-encapsulated (native) syntax to PNG, BMP, TARGA, raw, DICOM (any syntax). lists DICOM tags in a human-readable form. allows batch conversion. extracts multiple-frame files. renames destination files using user-defined pattern based on DICOM tags. accumulates set of files into one image (to generate masks). provides some image processing functions: mask, crop, halve, flip, window. is small available for:
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Table of contents | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Changelog | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Version 1.9n, 19 February 2007:
This release fixes a minor bug that would occur when reading a few specific instances of Siemens NM files. Version 1.9m, 12 February 2007: This release fixes a few bugs people reported recently. Thank you for your feedback. Binaries are also about 13% smaller (not that they were really big, mind you). Version 1.9l, 7 March 2005: Wow, no update in a long time. This new release just fixes some bug people reported in the last few years (fortunately not too many). thank you guys. The only major change is that, at last, the DICOM dictionary file (dicom.din) is not needed anymore, it is bundled within the binary: no need to install it in awkward locations anymore, you can safely remove your old dictionary. Version 1.9h, 14 Jul. 2000: I wish I had some time to document the changes and update this site :( Maybe later in 2001. I'm still maintaining this software from time to time, removing bugs and adding some functions. Version 1.8, 21 Jan. 1998: PNG format supported (new -p option). New DICOM2 environment variable to set default options. New --compression option to control the compression method used by some destination formats. New --resample option to control the resampling process (to 8 or 16 bits). New --get=[max][:min][:mean] option to get maximum/minimum/mean pixel values in frame. New --timer option to time each call to dicom2 (returns elapsed time). I/Os have been optimized. Expect 30% to 100% speed-up in some cases. Check performance tests. New parameters [=il|el|eb] added to -d, allowing DICOM conversion to new syntax. New parameter [=n] added to --halve, allowing to halve many times in a single call. New parameters [=center:width] added to --win, allowing user-specified windowing arguments. New optional [y|n] parameters added to --name, --rank, --reverse, --sort. Option --nowarn has been replaced by option --warn[=y|n], but remains for backward compatibility. The resampling process has been slightly modified when dealing with monochrome images (no min). Win 95/NT users: the Borland Redistributable Run Time DLL is no more needed :) (see Download page) Fixed some very nice bugs and potential memory leaks (and introduced new one :). Version 1.7, 18 Dec. 1997: Independent version number added to the DICOM dictionary (displayed at start-up). Update it. Windows NT support (tested and updated to check dictionary in winnt/ directories). New accumulating mode --acc=min. New NT and Linux performancetests using a Pentium II @ 300 mhz, 96 meg RAM. Corrected
a small bug preventing Linux version to find the dictionary in some cases.
A minor bug corrupting MONOCHROME1conversion to TARGA has been fixed. Small changes in the DICOM dictionary. Update it. Version 1.5, 1 Oct. 1997: Files have been moved to a new location ! Planar configuration 1 (color-by-plane) is now supported. Conversion to true DICOM format is now supported. See -d. New "How to..." section describing how to extract frames from multiple-frame files. Converting a single frame from a multiple-frame file to DICOM is now supported. New renaming pattern fields: cur_fr and cur_fr0, related to the current frame number. A new --step=n option allows the user to process every n-th file only. The
--frame option has been enhanced,
allowing the specification of ranges. Conversion from RGB (color-by-pixel) is now supported, as well as samples/pixel > 1. Access to a particular frame in a multiple frames file is now allowed. See --frame. Images stored as a stream of bytes (VR = OB) are now handled correctly. Sequences Item (VR = SQ) are now stored correctly. BMP format is now better supported (an alignment bug has been fixed). TEXT conversion is now performed before any image processing functions. A VR =DA and VR=TM bug has been fixed. dicom2 performs a bit faster. |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Download | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
The dicom2 tool is a single executable file. Windows users can download this binary file directly. Linux users can download a gzip'ed compressed archive and decompress it accordingly. Note: there is no separate DICOM dictionary file anymore, it is bundled within the binary. You can safely remove your old DICOM dictionary (dicom.din).
WARNING: FireFox users (and others), please do check that the size in bytes of the file you downloaded is the same as the size reported above. If it is not, it is likely the transfer failed, the file got corrupted, or your browser is doing something tricky on your behalf. |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Install | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Just uncompress the executable if needed (Linux), and off you go. Unix users can run: gzip -d *.gz Note that dicom2 is a command line tool, you need to run it from a Windows command prompt or a Linux shell |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Usage | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Conversion
formats Conversion context Input files Frame selection Control output Renaming pattern Image processing Usage: dicom2 --help --config--acc=max|min[:file] --compression=no|default|fast|best --crop=x:y:w:h --fliph--flipv --frame=first[:last[:step]]|all[:step] --get=[max][:min][:mean] --halve[=n] --mask=zero[:file] --name[=y|n] --rank[=y|n] --rename=alias|field[:field...] --resample=no|shift|near|linear --reverse[=y|n] --sort[=y|n] --step=n --syntax=il|ib|el|eb --timer --to=path --warn[=y|n] --win[=center:width] -a -d[=il|ib|el|eb] -p[0|1] -r[0|1] -t[0|1] -w file(s) to convert |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Conversion formats | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
You may convert a file to many destination formats in the
same time.
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
-a -w: TARGA and BMP
conversions provide good ways to illustrate your documents and import medical
images to your favorite publishing softwares. Nevertheless, you shall not
forget that both formats do not support more than 8 bits per sample
or per color-component, which is not sufficient to achieve the precision
commonly encountered in standard medical image formats.
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
-d[=il|ib|el|eb]: it might
seem stupid to provide conversion to the DICOM format when the original
files already use that format, but it becomes quite practical when you
start performing some image processing
functions on the original files, try to extract
particuliar frames within multiple-frame files, or just want to change
the internal syntax of the files. Working continuously with the DICOM format
allows you to share the benefits of a simple tool like dicom2 with
other medical imaging softwares, while keeping most of the informations
described by this complex format.
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
-p[0|1] : The PNG
format (which stands for Portable Network Graphics)
was designed to be the successor to the popular GIF format, by providing
a free, loss-less and much-improved replacement framework. It provides
very interesting features: file integrity checking (through CRCs), better
compression than GIF, two-dimensional interlacing scheme, 1-, 2-, 4- and
8-bit palette support, 1-, 2-, 4-, 8- and 16-bit grayscale support,
8- and 16-bit-per-channel (that is, 24- and 48-bit) truecolor support,
full alpha blending in 8- and 16-bit modes, gamma correction for cross-platform
"brightness" control. The PNG format is supported by a growing number of
platforms and softwares, including word-processors and web browsers (MSIE
4 and Navigator 4), so I strongly recommend you to have a look at its interesting
capabilities.
This format also solves much of the problems raised by the TARGA and BMP formats: it particularly supports more than 8 bits per sample or per color-component. Therefore, it seems to be the right choice when dealing with medical images which most of the time use more than 8 bits per sample.
MONOCHROME1 files, where 0 is associated to white and the maximum value to black, are inverted first, so that 0 will be associated to black and the maximum value to white.
For example, the following tags:
Study Date (0008,0020) 1 DA [1995.06.26]
are dumped into the following tEXt chunks (pair keyword/text):
Study Date/1995.06.26
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
-r[0|1]: the DICOM format
provides a great flexibility regarding the organization and the structure
of the pixel data: every pixel is made of one or more samples, each one
of them is described by a given number of bits ("Bits Stored"), and is
packed in a cell that can use an even greater number of bits ("Bits Allocated"),
allowing the user to include overlay data within each sample or simply
pad each sample in a multiple of 8 bits.
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
-t[0|1]: the DICOM offline
format is not just a way to store medical images, it is a very complete
and opened format where hundreds of item and values may be stored. Nevertheless,
writing a DICOM decoder is not a simple task. The TEXT conversion will
therefore become quickly useful to explore the contents and understand
the complexity of DICOM files by providing a textual representation of
every element in a human-readable form.It is also helpful for these that
are just interested in the Pixel Data or a simple description of the image:
these items, as well as offsets to the pixel data (7FE0,0010)
are easily recognizable, for every element appears as :
Transfer Syntax UID (0002,0010)
1 UI [1.2.840.10008.1.2.1]
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Conversion context | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Each conversion format might define its own optional parameters
(ex: -p[0|1] for a PNG conversion, where 0 or 1
are optional), but most of them share common behaviours, which might be
controlled using global parameters. This set of global parameters
is called the conversion context, and it is applied to all destination
formats when converting to different formats in a single call to dicom2.
You might use these parameters in the DICOM2 environment variable
to set new default options.
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
--compression=no|default|fast|best:
some of the destination formats are compressed, but the compression process
might be very time-consumming. Therefore, you may control the compression
scheme by providing one of these parameters to the --compression
option:
When the --compression option is not used, or used in combination with the default parameter, the compression method will depend on the destination format (which implements its own default compression behaviour). The PNG format is for the moment the sole format that understands the --compression option through the well-known zlib compression library. |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
--resample=no|shift|near|linear:
most of the destination formats use a fixed bit-length to store monochrome
files (8 or 16 bits/sample). Therefore, when a DICOM sample is defined
by a bit-length different from 8 or 16, it has to be resampled. You might
control the resampling method by providing one of these parameters to the
--resample
option:
This option has no influence on images other than monochrome, or on formats which are able to store a sample with any bit-length (raw or DICOM). It is also overriden by the --win option, which is a remapping method by itself. |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
--to=path: the default behavior of dicom2 is to use the current directory to save the converted files, but you may specify another destination directory, as long as it is fully expanded (don't use ~ or $HOME). | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
--win[=center:width]:
enhance a particular range of values when resampling grayscale files to
8 or 16 bits/sample (PNG, BMP or TARGA). Windowing informations
are usually defined by the radiologist to enhance a particular part of
the image (a tissue) by remapping a range of values (defined
by the window center and the window width) through a color
look-up table (using linear scaling, therefore it overrides the --resample
option). Specify that option if you want dicom2 to use the settings
saved within the file (as HU elements (0028,1050) and (0028,1051)). You
may also provide your own center and width, but these have to be expressed
as SV (stored values) instead of the usual HU (Hounsfield unit) : you may
get a rough idea of the current SV range using the --get
option (tell me if you'd prefer specifying that kind of informations using
HU, and I will change that behaviour in the next version and add two parameters,
the rescale slope and rescale intercept).
dicom2
-t1 file1 | grep -i window And here is another example for a different and imaginary file2, where the previous elements (0028, 105x) were not found. Let's specify our own window width and center: dicom2
--get=max:min file2 |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Input files | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
The default behavior of dicom2 is to process each
file one after the other, but you are free to reverse that standard
order or sort the filenames by alphabetical order.
You can even restrict dicom2 to a sub-set of these files by providing a step n that will be used to read every n-th file only. This might be useful for testing purposes: suppose you plan to work on a set of 200 slices... by providing a step n = 20 you will get a rough idea of the final outcome by looking at these 10 resulting files. True DICOM files are preceded by a File Meta Information header made of a File Preamble, a DICOM prefix and File Meta Elements. This header shall be read using the standard DICOM Explicit VR Little Endian Syntax. One of the File Meta Elements found in that header provides the syntax to use for the following elements. On the other hand, raw data-sets do not have any header, and hence do not provide any syntax directive: the entire file shall be read using the standard DICOM default syntax (Implicit VR Little Endian Syntax). Nevertheless, both of these choices may be overridden by the user, allowing raw data-sets or the File Meta Information header of a true DICOM file (only the header, NOT the data-elements of the file) to be read using a different syntax. This might help you to avoid seldom cases where dicom2 may report an error while reading an old DICOM standard. Be aware that the the ib parameter (Implicit Big Endian syntax) was provided for backward compatibility only, and shall NOT be used (this syntax has no meaning regarding the DICOM standard). You might use these parameters in the DICOM2 environment variable
to set new default options.
dicom2
head.dcm stomach.dcm limb.dcm dicom2
--sort=y head.dcm stomach.dcm limb.dcm dicom2
--reverse=y head.dcm stomach.dcm limb.dcm dicom2
--reverse=y --sort=y head.dcm stomach.dcm limb.dcm dicom2
--step=2 file-1 file-2 file-3 file-4 file-5 file-6 dicom2
--step=3 file-1 file-2 file-3 file-4 file-5 file-6 dicom2
--step=3 --reverse=y file-1 file-2 file-3 file-4 file-5 file-6
dicom2
--step=10 file-1 file-2 file-3 file-4 file-5 file-6 |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Frame selection | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Although dicom2 is able to read multi-frame files,
its output is always made of single-frame files... Therefore, it is up
to the user to specify the frame(s) he wants to work with.
The default behavior of dicom2 is to process all frames: hence, by converting one multiple-frame file, you will probably get many single-frame files. As dicom2 uses the name of the original file to compute the name of the destination one, this might lead to overwriting problems: in that case, when no other renaming pattern is given, dicom2 adds a frame number to each resulting filename. Note that specifying a renaming pattern overrides this behavior: do not forget to use frame-related fields (cur_fr, cur_fr0) in the pattern if you want to be sure that you will save all frames. You are free to specify the frame(s) you want to process by providing
the index of a particular frame, or a range of frames starting from index
i
to index j (where i do not have to be <
j).
You can even provide a step n that will be used to read every n-th
frame only.
Note that the "all" keyword means "all frames". Let's have a look at some examples, using the file mframe, which stores 10 frames (you can use the -t1 option to find the number of frames): dicom2
-t1 mframe | grep -i frame dicom2
mframe dicom2
--frame=3 mframe dicom2
--frame=6:2 mframe dicom2
--frame=6:1:-2 mframe dicom2
--frame=all mframe dicom2
--frame=all:2 mframe dicom2
--frame=all:-2 mframe |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Control output | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
The default behavior of dicom2 is to display nothing
but warnings and errors, but processing hundreds of files may take some
time... Therefore, one may want to display the rank or the name of the
file that is currently processed, which will convey a rough evaluation
of the remaining operations. The name of the file may also be helpful to
locate the one that produced an error.
Warnings do not stop the conversion process, but it may be annoying to get the same messages hundreds of times. Hence, it is possible to prevent these warnings (prefixed with [W]) from being displayed. Errors (prefixed with [E]) will always be shown. For these willing to time each call to dicom2, the corresponding --timer option may be used. You might use these parameters in the DICOM2 environment variable to set new default options. Let's have a look at some examples, where mframe is a multi-frame file, which stores 5 frames: dicom2 --rank=y head.dcm stomach.dcm limb.dcm [1] [2] [3] dicom2
--rank=y head.dcm mframe stomach.dcm limb.dcm dicom2
--name=y head.dcm mframe stomach.dcm limb.dcm dicom2
--name=y --rank=y head.dcm mframe stomach.dcm limb.dcm dicom2
warn_err.dcm dicom2
--warn=n warn_err.dcm |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Renaming pattern | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
The default behavior of dicom2 is to use the name
of the file being processed to build the destination filename. The extension
of the destination format is added to that name (for example, .bmp,
.tga, .txt, etc., see conversion
formats). An optional frame number is added also if the file is a multi-frame
file.
Unfortunately, filenames automatically created by acquisition software's are most of the time hard to manage, and convey no special meanings in a human-readable form. It would be interesting to implement a simple mechanism able to rename the destination file depending on its contents (its DICOM tags) or its rank. This may be achieved by specifying a renaming pattern made of
fields separated by semi-colons (':'). A field is related to a
unit of information that may be found in the file: it is similar
to a DICOM data-element, although more meaningful.
Every field is processed one after the other, from the left to the right. If the field is found in the field-dictionary and if the information is available in the file, its value is used to build a part of the destination filename. Otherwise, it is copied as is in the name, allowing the user to include strings too. In both cases, fields are concatenated and separated by minus signs ('-') in the destination filename.
The frame-related fields (cur_fr, cur_fr0) have no influence on single-frame files. It is also safe to use them in any cases, as dicom2 do not output anything but single-frame files. Therefore, DO NOT forget to use these fields in the pattern if you want to be sure that you will save the frames stored in a multiple-frame file. If not, there won't be any difference between the filenames of each resulting frame, as they are computed from the name of the original multi-frame file: you will most probably overwrite all frames within the same single-frame file. Several aliases are available to specify the most usual combinations of fields. If the first field of the whole renaming pattern is a digit (0..9), the corresponding alias is used:
Do not be afraid about this syntax, and feel free to experiment, it is worth it :) Although the field dictionary may be hard to remember, all fields have been chosen to sound like their counterparts. Let's have a look at some examples, where mframe is a multi-frame file, which stores 5 frames. The -w conversion (BMP) adds .bmp to the filename. dicom2
-w --rename=frame:cur_fr mframe test.dcm contains these elements (description, tag, VM, VR, value):
Study Date (0008,0020) 1 DA [1997.05.29]
dicom2
-w --rename=pat_nm:ser_nb:acq_nb:img_da:img_tm test.dcm
dicom2
-w --rename=pat_nm:ser_da:stu_tm:img_nb test.dcm dicom2
-w --rename=cur_we:acq_tm test.dcm dicom2
--rename=result:cur_rk0 test.dcm test2.dcm test3.dcm |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Image processing | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Some very rudimentary image processing tasks may be performed
on the pixels before converting them to another format. Multiple tasks
may be applied during the same pass, allowing you to save a lot
of time... be aware that they are performed in the following order:
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Note that the resulting DICOM file is not a logic file in that it does not relate to any existing study or patient: it just contains the mandatory tags necessary to describe an image. Be aware that most modes do not support samples per pixel greater than 1, as they have to compare or order pixels based on their value. Therefore, do not forget that a pixel with a value = 0 is NOT always darker than a pixel with a value = 255, 1024, or higher. It depends on the Photometric Interpretation: it is true for MONOCHROME2, where 0 is black and higher values are lighter, but false for MONOCHROME1, where 0 is white and higher values are darker.
This buffer might be useful to create a mask by attributing a zero to the points that you want to save (using a painting program). Check the corresponding real-life examples in the "How to" section. Use the 'min' mode to achieve the same effect on MONOCHROME1 images.
Use the 'max' mode to achieve the same effect on MONOCHROME1 images.
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
--mask=zero[:file]:
mask every image (or frames). The contents of the resulting file is computed
from the combination of the original file and the mask, and vary depending
on the mode. You can specify the name of the mask, or dicom2
will use mask-mode.bmp as default (where mode
is actually replaced by the chosen mode). The mask has to be stored in
Window's BMP format, 8 bits/sample, 1 sample/pixel, which corresponds
to a 256 indexed-color picture (the color lookup table is ignored).
A 'zero' mask might have been created from an accumulation buffer after attributing a zero to the points that you wanted to save (using a painting program). Check the corresponding real-life examples in the "How to" section.
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
--crop=x:y:w:h: build
a destination frame that is a sub-part of the original frame. It
starts at pixel x:y and its width and height are w:h
(upper-left corner at 0:0).
Using accumulating, masking
and cropping together might become a very common way to clean images. Check
the corresponding real-life examples
in the "How to" section.
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
--halve[=n]: halve
the original frame. Both dimensions (width, height) must be even, but you
still can crop the frame a little to achieve the
right size. You may also provide a parameter n to halve the frame
n times instead of 1 (ex: --halve=3 will halve a 512x512
image to 64x64).
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
--fliph --flipv:
flip frame horizontally or vertically.
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
--get=[max][:min][:mean]:
get maximum/minimum/mean pixel values in the frame. Parameters are optional
and may be specified in any order. This option can not be used on image
where pixels are made of more than 1 sample (anything different from MONOCHROME).
dicom2 --get=max:min file [max: 4000] [min: 0] dicom2 --get=mean:min file [mean: 1273] [min: 0] |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
How to | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Understand
output Set default options Convert to PNG, BMP, TARGA Convert to raw (vtk) List DICOM tags Generate subsets Clean images Extract frames |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Understand output | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
The default behavior of dicom2 is to process your files silently and display nothing but warnings and errors... Warnings (prefixed with [W]) are most of the time harmless and do not stop the conversion process, whereas errors (prefixed with [E]) do. It is possible to prevent these warnings from being displayed or even control many other output features by using the corresponding output options. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Set default options | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Many default behaviours as well as default option-values
are used during the conversion process, but these might not fit your own
way to work. It is easy to redefine them, but you might getting tired of
always specifying the same destination directory (--to),
the same compression scheme (--compression),
the same control flags (--warn,
--rank), and so on. Put any
of your usual options in the DICOM2 environment variable, and
they will be used in every subsequent calls:
dicom2 --to=c:\temp --compression=fast --warn=n --rank=y -w *.dcm dicom2 --to=c:\temp --compression=fast --warn=n --rank=y -a test\*.dcm ... might be replaced by: set DICOM2=--to=c:\temp --compression=fast --warn=n --rank=y dicom2 -w *.dcm dicom2 -a test\*.dcm ... No worry, you may still override these options by redefining them on the command-line (the first set of files will be written to c:\temp, the second to c:\temp2): set DICOM2=--to=c:\temp dicom2 -w *.dcm dicom2 -w --to=c:\temp2 *.dcm The way you might set and save environment variables depends on your
operating system and your shell:
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Convert to PNG, BMP, TARGA | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Fairly simple. dicom2 is a command-line driven program.Therefore,
it shall be called using a set of options and arguments specifying its
tasks. See Usage for complete informations regarding these options.
Nevertheless, here are small examples: dicom2 -w knee.dcm will convert the medical file knee.dcm to Windows's BMP format. The resulting file will be called knee.dcm.bmp. dicom2 -a -p *.dcm will convert all files with extension .dcm to TARGA and PNG formats. The .tga extension will be appended to the resulting TARGA files (respectively .png to the PNG files). |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Convert to raw (vtk) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
The Visualization
Toolkit (vtk for short) is a very powerful library that
"covers dozens of graphics and visualization techniques". It provides
functions to read 16 bits/pixel images (optionally preceeded by a header
of fixed length) and automatically swaps and masks 16 bits words if needed.
Unfortunately, the organization and the structure of the DICOM format is
far from that expected format: there is no fixed-length header, and pixel
data shall be "padded" (and optionally "cleaned") first to be usable. This
whole stuff may be carried out by the conversion to RAW (have a look
at the -r option for more explanations
and diagrams regarding the resulting pixel structure). Here is a simple
way to create these raw files using dicom2:
mkdir rawdir dicom2 --to=rawdir -r * The --to=rawdir option is used to store the resulting files in the rawdir directory, although it might not be necessary as the .raw extension will be appended to each file. The --rank option might be useful if you plan to convert hundreds of files: it gives you a visual clue of the remaining files to process (in that situation you might use the --warn option too). |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Be aware that the vtk might be a bit demanding on
the syntax of the name of the raw files it uses... In the case where many
images should be read in the same time (and treated as a volume), these
names must be numbered (ex: ct-raw.1, ct-raw.2, ct-raw.3,
and so on). dicom2 may automagically append that kind of number,
or even build a much more sophisticated filename (including contents of
DICOM tags) by using a renaming pattern (see --rename).
dicom2 -r --rename=test:cur_rk ct1755621 ct23423 ct08234 will produce the files: test-1.raw test-2.raw test-3.raw |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
You might also need some informations about the image,
especially if you are working on series. It is very easy, as you just have
to perform a TEXT conversion on the image or one of the element of the
series, and look for the corresponding field (see option -t
for more explanations, and the "How To: List
DICOM tags" section).
dicom2 -t1 test.an2 | grep -i "slice thick" Slice Thickness (0018,0050) 1 DS [10.00] the value (within square brackets) is 10.0.
the pixel size is 0.859 mm in the horizontal dimension (columns), and the same along the vertical dimension (rows). dicom2
-t1 test.an2 | grep -i "bit"
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
If you plan to use DICOM files to work on 3D reconstruction,
you will surely have to look at the vtkVolume16Reader
class. This class inherits the members of the more general vtkVolumeReader
class.
vtkVolume16Reader reader
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
List DICOM tags | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
It might be interesting to list the contents of the data-set
stored in a DICOM file, in order to recover the most useful informations
in a human-readable form (the size of the image, the position of the patient,
the offset to the pixel data, and so on). Hence, you may use dicom2
to save a textual representation of this file (see option -t
for more explanations), where each element will be listed as [description,
tag, VM, VR, value]. But it might become a bit frustrating to create that
file, display it, and then remove it. Hopefully, this textual representation
might be redirected to the standard output:
dicom2 -t1 test.an2 ..... Transfer Syntax UID (0002,0010) 1 UI [1.2.840.10008.1.2.1] Image Type (0008,0008) 1-n CS [ORIGINAL\PRIMARY] Study Date (0008,0020) 1 DA [1995.06.26] Image Date (0008,0023) 1 DA [1995.06.26] Study Time (0008,0030) 1 TM [11:20:00] Modality (0008,0060) 1 CS [MR] Manufacturer (0008,0070) 1 LO [Philips] Patient's Name (0010,0010) 1 PN [Doe John] Slice Thickness (0018,0050) 1 DS [10.00] Series Number (0020,0011) 1 IS [1] Image Number (0020,0013) 1 IS [103] Samples per Pixel (0028,0002) 1 US [1] Photometric Interpretation (0028,0004) 1 CS [MONOCHROME2] Number of Frames (0028,0008) 1 IS [16] Frame Increment Pointer (0028,0009) 1-n AT [(0018,1063)] Rows (0028,0010) 1 US [256] Columns (0028,0011) 1 US [256] Bits Allocated (0028,0100) 1 US [8] Bits Stored (0028,0101) 1 US [8] High Bit (0028,0102) 1 US [7] Pixel Representation (0028,0103) 1 US [0] Pixel Data (7FE0,0010) 1 OB [1048576 bytes at offset 1022 (0x3fe)] ..... You can make an alias (depending on your shell) to improve the overall
efficiency :)
You might extract a single element by using the grep filter
(which is a very common tool in the unix world, and is also available for
Windows when working on the command prompt). grep will search
for an expression in a file or in the data available on the standard input.
or,
or,
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Generate subsets | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Dealing with hundred of files might become a very time
consuming task. Therefore, why not try to work with reduced data
before running the real job on full-sized images. Halving will achieve
this goal (see option --halve).
For example, one could build a 256x256 and a 64x64 set of DICOM files
from a 512x512 set of original DICOM files. As most options performs linearly,
it is obvious to see that dicom2 will carry out its tasks 4 (64)
times quicker on the 256x256 (respectively 64x64) set than on the 512x512
set.
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Clean images (accumulate, mask, crop) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Typical images may exhibit more than the desired body-structures.
Artefacts, as well as parts of the bed may be hard to locate and tend to
produce undesirable effects (while using 3D reconstruction for example).
Moreover, the form and location of these artefacts might change within
a series of images, preventing the user from building a hypothetical mask
based on a single image of the series. A rudimentary but better approach
may be applied with some of the dicom2 functions.
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
AccumulateFirst of all, you shall compute which of the pixels are used along all images within the series (which is quite similar to an accumulation buffer representing the maximum occupancy of the structures). See option --acc for more explanations and diagrams.dicom2 --acc=max * The resulting DICOM file (which defaults to acc-max.dcm) shall
be converted to BMP, in order to be recognized by any painting program.
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
MaskYou are now able to create a mask starting from this image, by attributing zero to the points that you want to save in each frame, and non-zero to these that you want to remove(set to 0). The mask will act like a kind of stencil: the zero-area being a "hole", the non-zero area covering the non-desired pixels. Have a look at the --mask option to get more coverage on the principles.We are quite finished: let's build up the new masked images, which will be stored in the masked directory: mkdir masked dicom2 --mask=zero:acc-max.bmp --to=masked -d * |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
CropThe resulting images will exhibit more zeros than the original ones (as pixels from removed structures are set 0). Hence you might consider using the --crop option to save the relevant part of the image only, and speed-up further processes. The coordinates of the cropping-window might be computed from the mask, which explicitly shows which parts of the resulting image will remain, and which won't.The --crop and --mask options may be used in the same time (as --mask occurs first). Forget the previous call to dicom2 and speed up the process with: mkdir masked dicom2 --mask=zero:acc-max.bmp --crop=44:70:400:400 --to=masked -d * |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Summarydicom2 --acc=max *dicom2 -w acc-max.dcm ... create the mask using acc-max.bmp... mkdir masked dicom2 --mask=zero:acc-max.bmp --crop=44:70:400:400 --to=masked -d * |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Extract frames | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
As the --frame
option has been enhanced since v1.5, it is now very easy to work on multiple-frame
files. Although dicom2 is able to read multi-frame files, you shall
not forget that its output is always made of single-frame files. Therefore,
you can not build multiple-frame files, but you can extract many
single-frame files from one multiple-frame file. See option --frame
to learn more about frame selection.
Let's have a look at some examples, using the file mframe, which stores 3 frames (you can use the -t1 option to find the number of frames): dicom2
-t1 mframe | grep -i frame dicom2
-w mframe dicom2
-d --frame=2:3
--rename=slice:cur_fr mframe
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Problems | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Too
many messages Missing tags Unable to write... Error while reading File Meta Elements If dicom2 exhibits a really strange behavior, you might consider checking if it is really working right with your implementation. Have a look at the medical image samples page and the Performance section to download some files and compare your results with these expected. |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Too many messages | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
You might be surprised by the number of messages output
by dicom2 while it is doing its work. Don't worry, most of them
are harmless... Warnings (prefixed with [W]) do not stop
the conversion process, whereas errors (prefixed with [E]) do.
>> [W] [14:13:25] bool SbMedicalFrame::UpdateFrom( const SbDicomDataElementSet&, ... ) missing tag: (0028,0004) Photometric Interpretation... >> [E] [14:13:26] bool SbMedicalFrame::UpdateFrom( const SbDicomDataElementSet&, ... ) encapsulated syntax 1.2.840.10008.1.2.4.70 is not supported! Don't forget that you can hide these annoying warning messages by using the --warn option ! |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Missing tags | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Some missing tags may be assumed (as they should be there),
and therefore introduce nothing but warnings. This kind of warning is usual
when reading old ACR/NEMA files. You should use --warn
to prevent your screen from being flooded while converting hundreds of
these files.
>> [W] [14:13:25] bool SbMedicalFrame::UpdateFrom( const SbDicomDataElementSet&, ... ) missing tag: (0028,0004) Photometric Interpretation. Assuming MONOCHROME2! >> [W] [14:13:25] bool SbMedicalFrame::UpdateFrom( const SbDicomDataElementSet&, ... ) missing tag: (0028,0002) Samples per Pixel. Assuming 1! Some other tags are mandatory for a given conversion task. These missing tags will produce an error, and stop the program. >> [E] [14:21:50] bool SbMedicalFrame::UpdateFrom( const SbDicomDataElementSet&, ... ) missing image mandatory tags in set! >> [E] [14:21:50] bool SbMedicalFrame::UpdateFrom( const SbDicomDataElementSet&, ... ) missing CLUT mandatory tags in set! >> [E] [14:21:50] bool SbMedicalFrame::UpdateFrom( const SbDicomDataElementSet&, ... ) missing Windowing mandatory tags in set! |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Unable to write... | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
If you encounter that kind of message ("unable to write
data..."), check that you are not trying to write the converted files
to a protected directory or to any place where you are not allowed to store
data (in multi-user systems). You should also check if your hard disk is
full, or your quota exhausted :)
If you are using the --to option, you might also check that you specified a fully expanded directory (don't use ~ or $HOME). |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Error while reading File Meta Elements | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
If you ever read that kind of message, you are probably
trying to load a true DICOM file (i.e. with a File Preamble) written according
to an old DICOM standard which stated that File Meta Elements stored at
the beginning of the file should be saved using the DICOM Implicit VR
Little Endian Syntax. This is no more the case: these elements have
to be written using the DICOM Explicit VR Little Endian Syntax.
Nevertheless, you can force dicom2 to conform to that old behavior
by specifying the desired syntax with the --syntax
option.
dicom2 mr.d3i >> [E] [00:19:47] VR TranslateVR( const char, const char ) unknown VR token >> [E] [00:19:47] ULONG SbDicomDataElementValue::ReadButValue( ifbstream& ) explicit VR of value is unknown! (0x8a) >> [E] [00:19:47] ifbstream& SbDicomDataElementValue::Read( ifbstream& ) while reading (optional) explicit VR and length of value! (0x8a) >> [E] [00:19:47] ifbstream& SbDicomDataElementSet::ReadFiltered( ifbstream&, const ...) while getting value of element (0002,0000)! (0x8a) >> [E] [00:19:48] bool SbDicomDataElementSet::Load( const SbFileName&, const ...) while reading File Meta Elements of file mr.d3i! (check syntax) >> [E] [00:19:48] int main(const int, const char**) while reading file mr.d3i! dicom2
mr.d3i --syntax=il |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Limitations | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Encapsulated
syntax Unsupported VR Photometric interpretation Planar configuration Bits allocated Color Lookup Tables Multiple-frame files Some of these limitations will also remain as long as I won't get samples containing the unsupported topics. If you own such samples, I would really appreciate working on them and maybe adding them to my medical image samples page. |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Encapsulated syntax | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
No encapsulated (compressed) syntax is supported. Sorry
;)
>> [E] [21:32:56] bool SbMedicalFrame::UpdateFrom( const SbDicomDataElementSet&, ... ) encapsulated syntax 1.2.840.10008.1.2.4.70 is not supported! |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Unsupported VR | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Some Value Representation are not supported.
The corresponding DICOM data-elements are skipped:
FL (floating point single) >> [W] [20:36:00] ifbstream& SbDicomDataElementValue::Read( ifbstream& ) AT length = 4, current = 12, multiple values not implemented :( |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Photometric interpretation | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Conversions from photometric interpretations (0x0028, 0x0004) other than MONOCHROME1, MONOCHROME2, PALETTE COLOR and RGB are not supported. Be aware that some image processing options support all photometric interpretation, as other do only support a restricted set ot them (--acc will ignore RGB images for example). | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Planar configuration | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
The planar configuration item is required when "Samples per Pixel" has a value greater than 1 (RGB files for example). Planar configuration values 0 (color-by-pixel) and 1 (color-by-plane) are supported, but color-by-plane data are automatically converted and reorganized to color-by-pixel (this might be important to say if you are converting back to DICOM). | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Bits allocated | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Bits allocated (0x0028, 0x0100) > 16 are not fully
supported (this number of bits is the size of the cell that is used to
store a pixel sample and optionally additional bits, see option -r
for diagrams). Nevertheless, I don't know if a such big size has
been ever used.
>> [E] [14:21:50] bool SbMedicalFrame::UpdateFrom( const SbDicomDataElementSet&, ... ) bits allocated 18 > 16 are not fully supported... (email me) |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Color Lookup Tables | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
When using PALETTE COLOR images, the color lookup
table descriptors (red (0x0028,0x1101), green (0x0028, 0x1102),
blue (0x0028, 0x1103)) must have the same structure (size, number
of entries and depth), so that the whole clut could be rebuilt (red/green/blue).
CLUT entries (red (0x0028,0x1201), green (0x0028, 0x1202),
blue (0x0028, 0x1203)) shall be "upsampled" to 16 bits (i.e. 0xFF
=> 0xFF00).
>> [E] [14:21:50] bool SbMedicalFrame::UpdateFrom( const SbDicomDataElementSet&, ... ) different clut descriptors are not allowed! |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Multiple-frame files | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
dicom2 is unfortunately not able to read
all types of multiple-frame files: to be honnest, it is not even able to
read the recommended DICOM organization (!), which states (see DICOM Part
5, section A.4c) that value representations OB or OW of files made of multiple
fragments shall meet some specific requirements (more or less a SQ organization):
But I have found a lot of multiple-frame files structured in a much simpler manner: the OB or OW value is made of the raw concatenation of each frame, one after the another, and that's what dicom2 is actually supporting. I you want to have a look at one of these multiple-frame files, check out my medical image samples page. |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Performance | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
WARNING: this page is old. I mean, really. Like 2000 or so. So take it with a pinch of salt. Or just skip it actually :) Although dicom2 should handle most combinations
of different size, bit structures and photometric interpretation, you can
check at the medical image samples
page if a particular type of file has already been successfully tested...
I recently removed the Windows 95 and Linux tests performed on a Pentium 120 : this configuration is no more available :) Moreover, these results would not be accurate enough regarding the new I/O optimizations implemented since version 1.8. Each test was run using a set of 100 files of different size, bit structures (where "[x, y | z]" means "x bits stored, y bits allocated and high bit z"), photometric interpretation and syntax. The following tables report the results, in second (the smaller, the faster), of each call to dicom2 with a different set of options and tasks. Numbers in brackets at the bottom of some tables report the results previously computed with version 1.7, when the difference with version 1.8 is noteworthy (the comparison is made between the total of each call, except these using -p or --get, which where not available in version 1.7).
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
A few observations | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
The
Linux system is a killer: it is definitely a good choice in this context.
The Windows NT results are very disappointing: 2 to 5 times slower than the Linux measures, on the same hardware, a Pentium II @ 300 mhz. I guess that the really low performances of the I/O functions or drivers may be the main cause. The quality of the code generated by the Borland C++ might be involved too. This is not a multi-tasking problem, as Windows 95 (which is not a true multi-tasking system) was performing poorly too. It is so bad that even the UltraSparc @ 170 mhz is running faster :( And do not ask me why the RGB files are processed 80% slower than MONOCHROME files :) Anyway, all NT results were mostly unstable: 10% to 30% difference between each benchmark session. The I/O functions have been enhanced since version 1.8. The algorithms used to read or write little-endian files on big-endian machine (and vice-versa) were not optimized, resulting in unnecessary slow latency. This is no more the case, and you might not notice any performance penalty resulting from byte-swapping. Have a look at the two set of tables (one is coded using Little Endian syntax, the other with Big Endian) : the difference, which ran from 40% to 100% with version 1.7, shall not exceed 5% with version 1.8 ! Although the first two sets have the same size (256x256), the same photometric interpretation (MONOCHROME2) and quite the same structure ([12 in 16 | 11] and [12 in 16 | 11]), dicom2 performs quicker on the first set: do not worry about this ! It has been optimized to work faster (10% to 90%) on samples stored in a multiple of 8 bits (i.e. when each cell starts at the beginning of a word or a byte). This optimization seems to have no effect with any Windows system ! It is obvious that converting the same file to many destination formats during a single call to dicom2 is more efficient than calling dicom2 for each destination format. Look at the table, and compare the -w -a -d -r -t test to the sum of the -w, -a, -d, -r, and -t tests. |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||