File: gdcmconv.xml

package info (click to toggle)
gdcm 3.0.21-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 26,880 kB
  • sloc: cpp: 203,477; ansic: 78,582; xml: 48,129; python: 3,459; cs: 2,308; java: 1,629; lex: 1,290; sh: 334; php: 128; makefile: 117
file content (415 lines) | stat: -rw-r--r-- 18,206 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
<?xml version='1.0' encoding='UTF-8' standalone='no'?>
<?xml-stylesheet type="text/xsl" href="http://docbook.sourceforge.net/release/xsl-ns/current/manpages/docbook.xsl" ?>
<!DOCTYPE Data [ <!ENTITY version SYSTEM 'version.txt'> ]>
<refentry xmlns="http://docbook.org/ns/docbook" version="5.0" xmlns:xlink="http://www.w3.org/1999/xlink">
<info>
<author><personname><firstname>Mathieu</firstname><surname>Malaterre</surname></personname><contrib>Main developer</contrib></author>
<copyright><year>2006</year><year>2011</year><holder>Mathieu Malaterre</holder></copyright>
</info>
  <refmeta>
    <refentrytitle>gdcmconv</refentrytitle>
    <manvolnum>1</manvolnum>
    <refmiscinfo class="source">GDCM</refmiscinfo>
    <refmiscinfo class="version">&version;</refmiscinfo>
    <refmiscinfo class="manual">DICOM Manipulation.</refmiscinfo>
  </refmeta>
  <refnamediv><refname>gdcmconv</refname>
    <refpurpose>Tool to convert DICOM to DICOM.</refpurpose>
</refnamediv>
<refsection xml:id="gdcmconv_1synopsis">
<title>SYNOPSIS</title>

<para><literallayout>gdcmconv [options] file-in file-out
</literallayout></para>
</refsection>
<refsection xml:id="gdcmconv_1description">
<title>DESCRIPTION</title>

<para>The <emphasis role="bold">gdcmconv</emphasis> command line program takes as input a DICOM file (file-in) and process it to generate an output DICOM file (file-out). The command line option dictate the type of operation(s) gdcmconv will use to generate the output file.</para>
</refsection>
<refsection xml:id="gdcmconv_1parameters">
<title>PARAMETERS</title>

<para><literallayout>file-in   DICOM input filename

file-out  DICOM output filename
</literallayout></para>
</refsection>
<refsection xml:id="gdcmconv_1options">
<title>OPTIONS</title>

<para><literallayout>  -i --input      DICOM filename
  -o --output     DICOM filename
</literallayout></para>
</refsection>
<refsection xml:id="gdcmconv_1specific_options">
<title>specific options</title>

<para><literallayout>  -X --explicit            Change Transfer Syntax to explicit.
  -M --implicit            Change Transfer Syntax to implicit.
  -U --use-dict            Use dict for VR (only public by default).
     --with-private-dict   Use private dict for VR (advanced user only).
  -C --check-meta          Check File Meta Information (advanced user only).
     --root-uid            Root UID.
     --remove-gl           Remove group length (deprecated in DICOM 2008).
     --remove-private-tags Remove private tags.
     --remove-retired      Remove retired tags.
</literallayout></para>
</refsection>
<refsection xml:id="gdcmconv_1image_options">
<title>image options</title>

<para><literallayout>  -l --apply-lut                      Apply LUT (non-standard, advanced user only).
  -8 --apply-lut8                     Apply LUT/RGB8 (non-standard, advanced user only).
     --decompress-lut                 Decompress LUT (linearize segmented LUT).
  -P --photometric-interpretation %s  Change Photometric Interpretation (when possible).
  -w --raw                            Decompress image.
  -d --deflated                       Compress using deflated (gzip).
  -J --jpeg                           Compress image in jpeg.
  -K --j2k                            Compress image in j2k.
  -L --jpegls                         Compress image in jpeg-ls.
  -R --rle                            Compress image in rle (lossless only).
  -F --force                          Force decompression/merging before recompression/splitting.
     --generate-icon                  Generate icon.
     --icon-minmax %d,%d              Min/Max value for icon.
     --icon-auto-minmax               Automatically compute best Min/Max values for icon.
     --compress-icon                  Decide whether icon follows main TransferSyntax or remains uncompressed.
     --planar-configuration [01]      Change planar configuration.
  -Y --lossy                          Use the lossy (if possible) compressor.
  -S --split %d                       Write 2D image with multiple fragments (using max size)
</literallayout></para>
</refsection>
<refsection xml:id="gdcmconv_1jpeg_options">
<title>JPEG options</title>

<para><literallayout>  -q --quality %*f           set quality.
</literallayout></para>
</refsection>
<refsection xml:id="gdcmconv_1jpegls_options">
<title>JPEG-LS options</title>

<para><literallayout>  -e --allowed-error %*i       set allowed error.
</literallayout></para>
</refsection>
<refsection xml:id="gdcmconv_1j2k_options">
<title>J2K options</title>

<para><literallayout>  -r --rate    %*f           set rate.
  -q --quality %*f           set quality.
  -t --tile %d,%d            set tile size.
  -n --number-resolution %d  set number of resolution.
     --irreversible          set irreversible.
</literallayout></para>
</refsection>
<refsection xml:id="gdcmconv_1general_options">
<title>general options</title>

<para><literallayout>  -h   --help
         print this help text and exit

  -v   --version
         print version information and exit

  -V   --verbose
         verbose mode (warning+error).

  -W   --warning
         warning mode, print warning information

  -E   --error
         error mode, print error information

  -D   --debug
         debug mode, print debug information
</literallayout></para>
</refsection>
<refsection xml:id="gdcmdump_1special_options">
<title>special options</title>

<para><literallayout>  -I --ignore-errors   convert even if file is corrupted (advanced users only, see disclaimers).
</literallayout></para>
</refsection>
<refsection xml:id="gdcmtar_1environment_variable">
<title>environment variable</title>

<para><literallayout>  GDCM_ROOT_UID Root UID
</literallayout></para>
</refsection>
<refsection xml:id="gdcmviewer_1simple_usage">
<title>Simple usage</title>

<para><emphasis role="bold">gdcmconv</emphasis> is a great tool to convert broken DICOM implementation into properly parsable DICOM file. Usage is simply:</para>

<para><literallayout>$ gdcmconv input.dcm output.dcm
</literallayout></para>

<para>or if you prefer being explicit:</para>

<para><literallayout>$ gdcmconv -i input.dcm -o output.dcm
</literallayout></para>

<para>Even though gdcmconv can overwrite directly on the same file (input.dcm = output.dcm), it is recommended that user should first convert into a different file to make sure the bug is properly handled by GDCM.</para>

<para>Typical cases where you would want to use gdcmconv in its simple form:</para>

<para><itemizedlist>
<listitem>
<para>convert non-cp246 conforming file into conforming cp246, </para>
</listitem>
<listitem>
<para>convert implicit little endian transfer syntax file meta header into proper explicit little endian transfer syntax, </para>
</listitem>
<listitem>
<para>convert the GE-13 bytes bug, </para>
</listitem>
<listitem>
<para>convert dual syntax file: implicit/explicit, </para>
</listitem>
<listitem>
<para>convert Philips dual Little Endian/Big Endian file, </para>
</listitem>
<listitem>
<para>convert GDCM 1.2.0 broken UN-2-bytes fields, </para>
</listitem>
<listitem>
<para>... </para>
</listitem>
<listitem>
<para>All other broken files listed in the supported refsection.</para>
</listitem>
</itemizedlist>
When no option other is used, only the dataset is inspected. So encapsulated Pixel Data, for instance, is not inspected for well known bugs.</para>

<para>When doing this kind of work, this is usually a good idea to perform some kind of quality control, see gdcmconv Quality Control refsection (down below).</para>
</refsection>
<refsection xml:id="gdcmviewer_1usage">
<title>Typical usage</title>
<refsection xml:id="gdcmconv_1file_meta">
<title>File Meta Header</title>

<para>Running</para>

<para><literallayout>$ gdcmconv input.dcm output.dcm
</literallayout></para>

<para>Is not enough to recompute file meta header, when input file is buggy. You may want to use: &#8211;check-meta</para>

<para><literallayout>$ gdcmconv --check-meta input.dcm output.dcm
</literallayout></para>

<para>See typical cases such as: GE_DLX-8-MONO2-PrivateSyntax.dcm or PICKER-16-MONO2-No_DicomV3_Preamble.dcm from gdcmData.</para>
</refsection>
<refsection xml:id="gdcmconv_1explicit">
<title>Conversion to Explicit Transfer Syntax</title>

<para>To convert a file that was written using Implicit Transfer Syntax into Explicit Transfer Syntax simply use:</para>

<para><literallayout>$ gdcmconv --explicit uncompressed.dcm compressed.dcm
</literallayout></para>
</refsection>
<refsection xml:id="gdcmconv_1lossless_jpeg">
<title>Compressing to lossless JPEG</title>

<para>To compress an uncompressed DICOM file to a JPEG Lossless encapsulated format:</para>

<para><literallayout>$ gdcmconv --jpeg uncompressed.dcm compressed.dcm
</literallayout></para>
</refsection>
<refsection xml:id="gdcmconv_1lossy_jpeg">
<title>Compressing to lossy JPEG</title>

<para>To compress an uncompressed DICOM file to a JPEG Lossy encapsulated format:</para>

<para><literallayout>$ gdcmconv --lossy --jpeg -q 90 uncompressed.dcm compressed.dcm
</literallayout></para>

<para>Note: <literallayout>  -q is just one of the many way to specify lossy quality, you need to inspect the other cmd line flag to specify lossyness properties.
</literallayout></para>
</refsection>
<refsection xml:id="gdcmconv_1lossless_jpegls">
<title>Compressing to lossless JPEG-LS</title>

<para>To compress an uncompressed DICOM file to a JPEG-LS Lossless encapsulated format:</para>

<para><literallayout>$ gdcmconv --jpegls uncompressed.dcm compressed.dcm
</literallayout></para>
</refsection>
<refsection xml:id="gdcmconv_1lossy_jpegls">
<title>Compressing to lossy JPEG-LS</title>

<para>To compress an uncompressed DICOM file to a JPEG-LS Lossy encapsulated format:</para>

<para><literallayout>$ gdcmconv --lossy --jpegls -e 2 uncompressed.dcm lossy_compressed.dcm
</literallayout></para>

<para>Note:</para>

<para>-e (or &#8211;lossy-error) means that the maximum tolerate error is 2 for each pixel value</para>
</refsection>
<refsection xml:id="gdcmconv_1lossless_j2k">
<title>Compressing to lossless J2K</title>

<para>To compress an uncompressed DICOM file to a JPEG-2000 Lossless encapsulated format:</para>

<para><literallayout>$ gdcmconv --j2k uncompressed.dcm compressed.dcm
</literallayout></para>
</refsection>
<refsection xml:id="gdcmconv_1lossy_j2k">
<title>Compressing to lossy J2K</title>

<para>To compress an uncompressed DICOM file to a JPEG-2000 Lossy encapsulated format:</para>

<para><literallayout>$ gdcmconv --lossy -q 55,50,45 --j2k uncompressed.dcm lossy_compressed.dcm
</literallayout></para>

<para>Note: <literallayout>  -q is just one of the many way to specify lossy quality, you need to inspect the other cmd line flag to specify lossyness properties.
</literallayout></para>
</refsection>
<refsection xml:id="gdcmconv_1lossless_rle">
<title>Compressing to lossless RLE</title>

<para>To compress an uncompressed DICOM file to a RLE Lossless encapsulated format:</para>

<para><literallayout>$ gdcmconv --rle uncompressed.dcm compressed.dcm
</literallayout></para>

<para>There is no such thing as lossy RLE compression.</para>
</refsection>
<refsection xml:id="gdcmconv_1split_encapsulated">
<title>Split encapsulated DICOM:</title>

<para>To split an encapsulated stream into smaller chunk (1024 bytes each):</para>

<para><literallayout>$ gdcmconv --split 1024 rle.dcm rle_1024.dcm
</literallayout></para>

<para>If an odd number of bytes is passed it will be rounded down to the next even number (eg. 1025 -&gt; 1024) since DICOM only allow even number for Value Length.</para>
</refsection>
<refsection xml:id="gdcmconv_1force">
<title>Forcing (re)compression</title>

<para>Sometime it is necessary to use the &#8211;force option. By default when user specify &#8211;j2k and input file is already in JPEG 2000 encapsulated DICOM format then no operation takes places. By using &#8211;force you make sure that (re)compression operation takes places.</para>

<para>Real life example of why you would use &#8211;force: <itemizedlist>
<listitem>
<para>When Pixel Data is missing data / is padded with junk </para>
</listitem>
<listitem>
<para>When you would like to make sure GDCM can handle decompression &amp; recompression cycle</para>
</listitem>
</itemizedlist>
</para>
</refsection>
<refsection xml:id="gdcmconv_1decompress_raw">
<title>Decompressing a Compressed DICOM</title>

<para><literallayout>$ gdcmconv --raw compressed.dcm uncompressed.dcm
</literallayout></para>
<para>In the case of uncompress file (Explicit and Implicit) the behavior is to keep the original Transfer Syntax (so Implicit remains Implit)</para>
</refsection>
<refsection xml:id="gdcmconv_1decompress_raw_imp">
<title>Decompressing a Compressed DICOM as implicit</title>

<para><literallayout>$ gdcmconv --raw --implicit compressed.dcm uncompressed_implicit.dcm
</literallayout></para>
<para>By symmetry it is also possible to use gdcmconv --raw --explicit to make sure that target file is always Explicit TS.</para>
</refsection>
<refsection xml:id="gdcmconv_1compress_icon">
<title>Compressing an uncompressed Icon</title>

<para>By default when compressing a DICOM Image file, gdcmconv will not compress the icon. A user option needs to be turned on to explicitly force the compression of the Icon Image Sequence Pixel Data</para>

<para>For example, by default we will not compress the Icon Image Sequence Pixel Data attribute:</para>

<para><literallayout>$ gdcmconv --jpeg gdcmData/simpleImageWithIcon.dcm uncompressed_icon.dcm
</literallayout></para>

<para>In the following example we will explicitly compress the Icon Image Sequence Pixel Data attibute. In that case the same Transfer Syntax is being used for both the main Pixel Data and the Pixel Data from the Icon Image Sequence:</para>

<para><literallayout>$ gdcmconv --jpeg --compress-icon gdcmData/simpleImageWithIcon.dcm compressed_icon.dcm
</literallayout></para>
</refsection>
<refsection xml:id="gdcmconv_1generate_icon">
<title>Generating an Icon</title>

<para>For some application it might be necessary to produce a small preview of the main image to be able to quickly load that short preview instead of the main image. In that case:</para>

<para><literallayout>$ gdcmconv --raw --generate-icon gdcmData/test.acr test_icon.dcm
</literallayout></para>

<para>In some cases the main Pixel Data element is expressed as pixel defined on 16bits. Since Icon can only store at most pixel of size 8bits, a rescale operation needs to take place. In order to properly select a better interval for doing the rescale operation user can specify the min max used for the rescale operation:</para>

<para><literallayout>$ gdcmconv --raw --generate-icon --icon-minmax 0,192 gdcmData/012345.002.050.dcm icon_minmax.dcm
</literallayout></para>
</refsection>
<refsection xml:id="gdcmconv_1planar_configuration">
<title>Changing the planar Configuration</title>

<para>Often RLE files are compressed using a different Planar Configuration (RRR ... GGG... BBB...) instead of the usual triplet (RGB ... RGB ... RGB ). So upon decompression the Planar Configuration is 1. This is perfectly legal in DICOM, however this is unconventional, and thus it may be a good idea to also change the planar configuration and set it to the default :</para>

<para><literallayout>$ gdcmconv --raw --planar-configuration 0 compressed.dcm uncompressed1.dcm
</literallayout></para>

<para>To reinvert the planar configuration of file &apos;uncompressed1.dcm&apos;, simply do:</para>

<para><literallayout>$ gdcmconv --raw --planar-configuration 1 uncompressed1.dcm uncompressed2.dcm
</literallayout></para>
</refsection>
</refsection>
<refsection xml:id="gdcmconv_1lossless_conversion">
<title>Lossless Conversion</title>

<para>When talking about lossless conversion, there is an ambiguity that need to be understood. To achieve higher compression ratio, the RGB color space is usually not used, in favor of a YBR one. Changing from one color space to the other is (bit level) not lossless.</para>

<para>For more detail, see what are the true lossless transformations as described:</para>

<para><link xlink:href="http://gdcm.sourceforge.net/wiki/index.php/Color_Space_Transformations">http://gdcm.sourceforge.net/wiki/index.php/Color_Space_Transformations</link></para>
</refsection>
<refsection xml:id="gdcmconv_1quality_control">
<title>Quality Control</title>

<para>One important part when using gdcmconv it to have a way to quality control the output.</para>

<para>You can use 3rd party tool to check the output of gdcmconv is correct.</para>
<refsection xml:id="gdcmconv_1other_toolkit">
<title>DCMTK / dicom3tools</title>

<para>Using another DICOM implementation such as the one from DCMTK or dicom3tools can be a good process to check the output of gdcmconv. <itemizedlist>
<listitem>
<para>For DCMTK use: dcmdump </para>
</listitem>
<listitem>
<para>For dicom3tools use: dcdump</para>
</listitem>
</itemizedlist>
For reference, gdcmconv --raw will act as dcmdjpeg +cn +px, since it never tries to convert color space.</para>
</refsection>
<refsection xml:id="gdcmconv_1vim">
<title>VIM: vimdiff</title>

<para>You can setup your favorite editor to compare the output, for instance in vim:</para>

<para><literallayout><computeroutput>autocmd&#32;BufReadPre&#32;*.dcm&#32;set&#32;ro
autocmd&#32;BufReadPost&#32;*.dcm&#32;silent&#32;%!dcmdump&#32;-M&#32;+uc&#32;"%"
</computeroutput></literallayout></para>

<para>then simply do:</para>

<para><literallayout><computeroutput>$&#32;vimdiff&#32;input.dcm&#32;output.dcm
</computeroutput></literallayout></para>
</refsection>
<refsection xml:id="gdcmconv_1binary_diff">
<title>vbindiff</title>

<para>On UNIX you can visually compare binary file using the vbindiff command:</para>

<para><literallayout><computeroutput>$&#32;vbindiff&#32;input.dcm&#32;output.dcm
</computeroutput></literallayout></para>
</refsection>
</refsection>
<refsection xml:id="gdcmconv_1see_also">
<title>SEE ALSO</title>

<para><emphasis role="bold">gdcmdump</emphasis>(1), <emphasis role="bold">gdcmraw</emphasis>(1), <emphasis role="bold">gdcminfo</emphasis>(1), <emphasis role="bold">gdcmdiff</emphasis>(1)</para>
</refsection>
</refentry>