1GDCMIMG(1)                    DICOM Manipulation.                   GDCMIMG(1)
2
3
4

NAME

6       gdcmimg - Manipulate DICOM image file.
7
8       gdcmimg is a low level tool to allow de-/encapsulation from/to DICOM
9       image. This tool does not understand Transfer Syntax conversion. It
10       will encapsulate the raw data as-is. This has some impact in some
11       cases, see special warnings below.
12
13       It is important to note that gdcmimg can only encapsulate proper input
14       file, for instance JPG and or JP2 are accepted since an associated
15       DICOM Transfer Syntax can be found. However input such as TIFF and/or
16       PNG are not, since DICOM does not support those. See instead a tool
17       such as gdcm2vtk.
18

SYNOPSIS

20           gdcmimg [options] file-in file-out
21

DESCRIPTION

23       The gdcmimg command line tool can be used in two fashions:
24
25       •   1. Converting a recognized file format into its encapsulated DICOM
26           counterpart,
27
28       •   2. Anonymizing a rectangular portion of a DICOM file.
29
30

PARAMETERS

32           file-in   input filename (non-DICOM)
33
34           file-out  DICOM output filename
35

OPTIONS

37             -i --input     Input filename
38             -o --output    Output filename
39

SPECIFIC OPTIONS

41                --endian %s       Endianness (LSB/MSB).
42             -d --depth %d        Depth (Either 8/16/32 or BitsAllocated eg. 12 when known).
43                --sign %s         Pixel sign (0/1).
44                --spp  %d         Sample Per Pixel (1/3).
45                --pc [01]         Change planar configuration.
46                --pi [str]        Change photometric interpretation.
47                --pf %d,%d,%d     Change pixel format: (BA,BS,HB).
48             -s --size %d,%d      Size.
49                --offset %ull     Start Offset.
50             -C --sop-class-uid   SOP Class UID (name or value).
51             -T --study-uid       Study UID.
52             -S --series-uid      Series UID.
53                --template        Template DICOM file.
54                --keep-meta       Keep meta info from template file (advanced users only).
55                --root-uid        Root UID.
56

FILL OPTIONS

58             -R --region %d,%d    Region.
59             -F --fill %d         Fill with pixel value specified.
60

GENERAL OPTIONS

62             -h   --help
63                    print this help text and exit
64
65             -v   --version
66                    print version information and exit
67
68             -V   --verbose
69                    verbose mode (warning+error).
70
71             -W   --warning
72                    warning mode, print warning information
73
74             -E   --error
75                    error mode, print error information
76
77             -D   --debug
78                    debug mode, print debug information
79

ENVIRONMENT VARIABLE

81             GDCM_ROOT_UID Root UID
82

SUPPORTED FILE FORMAT (APPROPRIATE FILE EXTENSION)

84       gdcmimg will base it's conversion process based on the file extension.
85       Follows the list of recognized file extension. When no extension is
86       found, DICOM file is assumed.
87
88       input format
89
90             * RAW       (raw, rawl, gray, rgb)
91             * RLE       (rle)
92             * PNM       (pgm, pnm, ppm)
93             * JPEG-LS   (jls)
94             * JPEG 2000 (jp2, j2k, j2c, jpx, jpc)
95             * JPEG      (jpg, jpeg, ljpg, ljpeg)
96             * DICOM     ()
97
98       output format:
99
100             * PGM       (pgm, pnm, ppm)
101             * DICOM     ()
102
103       For RAW file format, you should take special care of the –endian
104       option. For the (old) JPEG file format, both the lossy and lossless
105       format are supported, user should pay attention to the –sign option.
106       For file format such as RLE or RAW, user is expected to fill in
107       information required to find the dimension and type of input data as
108       there is no other way to find this information. For all other file
109       format, the properties are derived from the file format itself.
110
111       PNM file are supposed to be big endian (important for depth > 8)
112

TYPICAL USAGE

114   Remove a rectangular part of the image
115       To fill the region [0,100]x[0,100] of a DICOM image simply do:
116
117           $ gdcmimg --fill 0 --region 0,100,0,100 -i input.dcm -o output_black.dcm
118
119       Warning: if the Pixel Data is compressed, the image is first
120       decompressed so that pixel can be set to 0, but it is not
121       re-compressed.
122
123   Convert RAW to DICOM
124       Recognized extension is .raw, .rawl, .gray or .rgb (case insensitive)
125
126           $ gdcmimg --size 512,512 --depth 16 -i input.raw -o output.dcm
127
128       the image will be a Secondary Capture.
129
130       When the input is 3 component, one need to specify explicitly the
131       Samples Per Pixel:
132
133           $ gdcmimg --size 512,512 --spp 3  input_rgb.raw output_rgb.dcm
134
135       When the filename contains .rgb as file extension output is
136       automatically recognized as RGB no need to specify –spp
137
138           $ gdcmimg --size 512,512 input.rgb output_rgb.dcm
139
140       You can use the dd cmd line to skip any header you would like to
141       discard, for instance, if you would like to skip the first 108 bytes,
142       simply do:
143
144           $ dd skip=108 bs=1 if=input.raw of=output.raw
145
146       .raw and .rawl extension are equivalent. You need to explicitly specify
147       the endianness manually:
148
149           $ gdcmimg --endian MSB --size 512,512 --depth 16 -i input.raw -o output.dcm
150
151       or
152
153           $ gdcmimg --endian LSB --size 512,512 --depth 16 -i input.raw -o output.dcm
154
155   Convert PGM/PNM/PPM to DICOM
156       Recognized extensions are .pgm, .pnm, .ppm (case insensitive)
157
158           $ gdcmimg -i input.pgm -o output.dcm
159
160       the image will be a Secondary Capture
161
162   Convert RLE to DICOM
163       Recognized extension is .rle (case insensitive)
164
165           $ gdcmimg --size 512,512 --depth 16 -i input.rle -o output.dcm
166
167       the image will be a Secondary Capture
168
169   Convert JPEG to DICOM
170       Recognized extensions are .jpg, .jpeg, .ljpg, .ljpeg (case insensitive)
171
172           $ gdcmimg -i input.ljpeg -o output.dcm
173
174       the image will be a Secondary Capture
175
176   Convert J2K to DICOM
177       Recognized extensions are .j2k, .jp2, .jpc, jpx, j2c (case insensitive)
178
179           $ gdcmimg -i input.j2k -o output.dcm
180
181       the image will be a Secondary Capture.
182
183       All Pixel information (Bits Stored/Allocated...) will be derived from
184       the image itself, and not from the command line options.
185
186   Specifying a SOP Class UID
187       Instead of the default Secondary Capture Image Storage, one may want to
188       specify, say VL Photographic Image Storage.
189
190           $ gdcmimg --sop-class-uid 1.2.840.10008.5.1.4.1.1.77.1.4 input.jpg output.dcm
191
192   Specifying a template DICOM file
193       Instead of the default Secondary Capture Image Storage, generated with
194       default values, one may want to specify a DICOM file that will serve as
195       template to fill in the DICOM attributes.
196
197           $ gdcmimg --sign 1 --template template.dcm input.jpg output.dcm
198
199       Pay attention that any values from template.dcm that are not consistent
200       with what is found inside the reference image will be overridden (eg.
201       image size). On particular case should be of concern: the Pixel
202       Representation for the JPEG family.
203

MULTIPLE FILES

205       gdcmimg handle nicely a set of files (for instance jpeg):
206
207           $ gdcmimg -C 1.2.840.10008.5.1.4.1.1.12.1 1.jpg 2.jpg 3.jpg 4.jpg output.dcm
208
209       It is important to specify an SOP Class that supports multi-frames
210       images otherwise gdcmimg will fail.
211

START OFFSET

213       In some case, one may want to create a 2D slice from an arbitrary
214       volume (e.g 3D). In which case –offset becomes handy:
215
216           $ gdcmimg --offset 4954104330 --size 1673,1673 Input3D_1673_1673_1775.raw slice_1770.dcm
217

WARNING

219       There are a couple of issues with gdcmimg implementation:
220
221       For RAW file, one should pay attention that when using –endian MSB the
222       Pixel Data will be encapsulated as is (not touched by gdcmimg).
223       Therefore the only possible transfer syntax available is Implicit VR
224       Big Endian DLX (G.E Private). GDCM does handle this private Transfer
225       Syntax. So if you need to convert this Transfer Syntax to another one
226       (and allow Pixel Data manipulation), you can use:
227
228           $ gdcmconv --raw --force input_big_endian_dlx.raw -o output_implicit_vr_little_endian.dcm
229
230       For JFIF file and JP2 file (with header) the header is copied into the
231       Pixel Data element which is illegal for JP2. Use gdcmconv to properly
232       re-encode a JP2/JFIF file into J2K/JPG.
233
234           $ gdcmimg input.jp2 output_jp2.dcm
235           $ gdcmconv --j2k --force output_jp2.dcm output_j2k.dcm
236
237       For RLE file, no check is done for crossing the row boundary. It is
238       recommended to use gdcmconv –rle to re-encode into a proper RLE file in
239       case of doubt.
240
241       Of course if the compression is not ok with your setup, you can always
242       de-encapsulated the DICOM file (typically JPEG) to a non-encapsulated
243       form, using gdcmconv:
244
245           $ gdcmconv --raw input_jpeg.dcm output_raw.dcm
246

SEE ALSO

248       gdcmdump(1), gdcm2vtk(1), gdcmraw(1), convert(1), dd(1)
249

AUTHOR

251       Mathieu Malaterre
252           Main developer
253
255       Copyright © 2006, 2011 Mathieu Malaterre
256
257
258
259GDCM 3.0.22                       08/07/2023                        GDCMIMG(1)
Impressum