1gdcmconv(1) GDCM gdcmconv(1)
2
3
4
6 gdcmconv - Tool to convert DICOM to DICOM.
7
9 gdcmconv [options] file-in file-out
10
12 The gdcmconv command line program takes as input a DICOM file (file-in)
13 and process it to generate an output DICOM file (file-out). The command
14 line option dictate the type of operation(s) gdcmconv will use to
15 generate the output file.
16
18 file-in DICOM input filename
19
20 file-out DICOM output filename
21
23 PARAMETERS
24 -i --input DICOM filename
25 -o --output DICOM filename
26
27 OPTIONS
28 -X --explicit Change Transfer Syntax to explicit.
29 -M --implicit Change Transfer Syntax to implicit.
30 -U --use-dict Use dict for VR (only public by default).
31 --with-private-dict Use private dict for VR (advanced user only).
32 -C --check-meta Check File Meta Information (advanced user only).
33 --root-uid Root UID.
34 --remove-gl Remove group length (deprecated in DICOM 2008).
35 --remove-private-tags Remove private tags.
36 --remove-retired Remove retired tags.
37
38 image options
39 -l --apply-lut Apply LUT (non-standard, advanced user only).
40 -P --photometric-interpretation %s Change Photometric Interpretation (when possible).
41 -w --raw Decompress image.
42 -d --deflated Compress using deflated (gzip).
43 -J --jpeg Compress image in jpeg.
44 -K --j2k Compress image in j2k.
45 -L --jpegls Compress image in jpeg-ls.
46 -R --rle Compress image in rle (lossless only).
47 -F --force Force decompression/merging before recompression/splitting.
48 --compress-icon Decide whether icon follows main TransferSyntax or remains uncompressed.
49 --planar-configuration [01] Change planar configuration.
50 -Y --lossy Use the lossy (if possible) compressor.
51 -S --split %d Write 2D image with multiple fragments (using max size)
52
53 JPEG options
54 -q --quality %*f set quality.
55
56 JPEG-LS options
57 -e --lossy-error %*i set error.
58
59 J2K options
60 -r --rate %*f set rate.
61 -q --quality %*f set quality.
62 -t --tile %d,%d set tile size.
63 -n --number-resolution %d set number of resolution.
64 --irreversible set irreversible.
65
66 general options
67 -h --help
68 print this help text and exit
69
70 -v --version
71 print version information and exit
72
73 -V --verbose
74 verbose mode (warning+error).
75
76 -W --warning
77 warning mode, print warning information
78
79 -E --error
80 error mode, print error information
81
82 -D --debug
83 debug mode, print debug information
84
85 special options
86 -I --ignore-errors convert even if file is corrupted (advanced users only, see disclaimers).
87
88 environment variable
89 GDCM_ROOT_UID Root UID
90
92 gdcmconv is a great tool to convert broken DICOM implementation into
93 properly parsable DICOM file. Usage is simply:
94
95 gdcmconv input.dcm output.dcm
96
97 or if you prefer being explicit:
98
99 gdcmconv -i input.dcm -o output.dcm
100
101 Eventhough gdcmconv can overwrite directly on the same file (input.dcm
102 = output.dcm), it is recommended that user should first convert into a
103 different file to make sure the bug is properly handled by GDCM.
104
105 Typical cases where you would want to use gdcmconv in its simple form:
106
107 · convert non-cp246 conforming file into conforming cp246,
108 · convert implicit little endian transfer syntax file meta header into
109 proper explicit little endian transfer syntax,
110 · convert the GE-13 bytes bug,
111 · convert dual syntax file: implicit/explicit,
112 · convert Philips dual Little Endian/Big Endian file,
113 · convert GDCM 1.2.0 broken UN-2-bytes fields,
114 · &...
115 · All other broken files listed in the supported section.
116 When no option other is used, only the dataset is inspected. So
117 encapsulated Pixel Data, for instance, is not inspected for well known
118 bugs.
119 When doing this kind of work, this is usually a good idea to perform
120 some kind of quality control, see gdcmconv Quality Control section
121 (down below).
123 File Meta Header
124 Running
125 gdcmconv input.dcm output.dcm
126 Is not enough to recompute file meta header, when input file is buggy.
127 You may want to use: --check-meta
128 $ gdcmconv --check-meta input.dcm output.dcm
129 See typical cases such as: GE_DLX-8-MONO2-PrivateSyntax.dcm or
130 PICKER-16-MONO2-No_DicomV3_Preamble.dcm from gdcmData.
131 Conversion to Explicit Transfer Syntax
132 To convert a file that was written using Implicit Transfer Syntax into
133 Explicit Transfer Syntax simply use:
134 $ gdcmconv --explicit uncompressed.dcm compressed.dcm
135 Compressing to lossless JPEG
136 To compress an uncompressed DICOM file to a JPEG Lossless encapsulated
137 format:
138 $ gdcmconv --jpeg uncompressed.dcm compressed.dcm
139 Compressing to lossy JPEG
140 To compress an uncompressed DICOM file to a JPEG Lossy encapsulated
141 format:
142 $ gdcmconv --lossy --jpeg -q 90 uncompressed.dcm compressed.dcm
143 Note:
144 -q is just one of the many way to specify lossy quality, you need to
145 inspect the other cmd line flag to specify lossyness properties.
146 Compressing to lossless JPEG-LS
147 To compress an uncompressed DICOM file to a JPEG-LS Lossless
148 encapsulated format:
149 $ gdcmconv --jpegls uncompressed.dcm compressed.dcm
150 Compressing to lossy JPEG-LS
151 To compress an uncompressed DICOM file to a JPEG-LS Lossy encapsulated
152 format:
153 $ gdcmconv --lossy --jpegls -e 2 uncompressed.dcm lossy_compressed.dcm
154 Note:
155 -e (or --lossy-error) means that the maximum tolerate error is 2 for
156 each pixel value
157 Compressing to lossless J2K
158 To compress an uncompressed DICOM file to a JPEG-2000 Lossless
159 encapsulated format:
160 $ gdcmconv --j2k uncompressed.dcm compressed.dcm
161 Compressing to lossy J2K
162 To compress an uncompressed DICOM file to a JPEG-2000 Lossy
163 encapsulated format:
164 $ gdcmconv --lossy -q 55,50,45 --j2k uncompressed.dcm lossy_compressed.dcm
165 Note:
166 -q is just one of the many way to specify lossy quality, you need to
167 inspect the other cmd line flag to specify lossyness properties.
168 Compressing to lossless RLE
169 To compress an uncompressed DICOM file to a RLE Lossless encapsulated
170 format:
171 $ gdcmconv --rle uncompressed.dcm compressed.dcm
172 There is no such thing as lossy RLE compression.
173 Forcing (re)compression
174 Sometime it is necessary to use the --force option. By default when
175 user specify --j2k and input file is already in JPEG 2000 encapsulated
176 DICOM format then no operation takes places. By using --force you make
177 sure that (re)compression operation takes places.
178 Real life example of why you would use --force:
179
180 · When Pixel Data is missing data / is padded with junk
181 · When you would like to make sure GDCM can handle decompression &
182 recompression cycle
183 Decompressing a Compressed DICOM
184 $ gdcmconv --raw compressed.dcm uncompressed.dcm
185 Changing the planar Configuration
186 Often RLE files are compressed using a different Planar Comnfiguration
187 (RRR ... GGG... BBB...) instead of the usual triplet (RGB ... RGB ...
188 RGB ). So upon decompression the Planar Configuration is 1. This is
189 perfectly legal in DICOM, however this is unconventional, and thus it
190 may be a good idea to also change the planar configuration and set it
191 to the default :
192 $ gdcmconv --raw --planar-configuration 0 compressed.dcm uncompressed1.dcm
193 To reinvert the planar configuration of file 'uncompressed1.dcm',
194 simply do:
195 $ gdcmconv --raw --planar-configuration 1 uncompressed1.dcm uncompressed2.dcm
197 When talking about lossless conversion, there is an ambiguity that need
198 to be understood. To achieve higher compression ratio, the RGB color
199 space is usually not used, in favor of a YBR one. Changing from one
200 color space to the other is (bit level) not lossless.
201 For more detail, see what are the true lossless transformations as
202 described:
203 http://sourceforge.net/apps/mediawiki/gdcm/index.php?title=Color_Space_Transformations
205 One important part when using gdcmconv it to have a way to quality
206 control the output.
207 You can use 3rd party tool to check the output of gdcmconv is correct.
208 DCMTK / dicom3tools
209 Using another DICOM implementation such as the one from DCMTK or
210 dicom3tools can be a good process to check the output of gdcmconv.
211
212 · For DCMTK use: dcmdump
213 · For dicom3tools use: dcdump
214 For reference, gdcmconv --raw will act as dcmdjpeg +cn +px, since it
215 never tries to convert color space.
216 VIM: vimdiff
217 You can setup your favorite editor to compare the output, for instance
218 in vim:
219 autocmd BufReadPre *.dcm set ro
220 autocmd BufReadPost *.dcm silent %!dcmdump -M +uc '%'
221 then simply do:
222 $ vimdiff input.dcm output.dcm
223 vbindiff
224 On unix you can visually compare binary file using the vbindiff
225 command:
226 $ vbindiff input.dcm output.dcm
228 gdcmdump(1), gdcmraw(1), gdcminfo(1)
230 Copyright (c) 2006-2010 Mathieu Malaterre
231
232
233
234Version 2.0.16 Tue Jul 26 2011 gdcmconv(1)