1GDCMRAW(1) DICOM Manipulation. GDCMRAW(1)
2
3
4
6 gdcmraw - Extract Data Element Value Field.
7
9 gdcmraw [options] file-in file-out
10
12 The gdcmraw tool is mostly used for development purpose. It is used to
13 extract a specific binary field from a DICOM DataSet.
14
16 file-in DICOM input filename
17
18 file-out output filename
19
21 -i --input Input filename
22 -o --output Output filename
23 -t --tag Specify tag to extract value from.
24
26 -S --split-frags Split fragments into multiple files.
27 -p --pattern Specify trailing file pattern (see split-frags).
28 -P --pixel-data Pixel Data trailing 0.
29
31 -h --help
32 print this help text and exit
33
34 -v --version
35 print version information and exit
36
37 -V --verbose
38 verbose mode (warning+error).
39
40 -W --warning
41 warning mode, print warning information
42
43 -E --error
44 error mode, print error information
45
46 -D --debug
47 debug mode, print debug information
48
50 Copy Attribute Value to file
51 This will extract the value at Tag (0025,101b):
52
53 $ gdcmraw -i GE_MR_0025xx1bProtocolDataBlock.dcm -t 25,101b -o pdb.raw
54
55 Extract Pixel Data
56 If you do not specify any tag, the Pixel Data element is the default
57 one. So for instance to grab the Pixel Data from an image:
58
59 $ gdcmraw -i test.acr -o test.raw
60
61 You can then for example compute the md5sum of this pixel data (very
62 useful):
63
64 $ md5sum test.raw
65 f845c8f283d39a0204c325654493ba53 test.raw
66
67 Encapsulated Syntax
68 When the Pixel Data is encapsulated, multiple fragments can be used to
69 store a single slice image:
70
71 $ gdcmdump D_CLUNIE_CT1_J2KR.dcm
72
73 ...
74 (7fe0,0010) OB # u/l,1 Pixel Data
75 (fffe,e000) ?? [] # 0,1 Item
76 (fffe,e000) ?? ff\\4f\\ff\\51\\00\\29\\00\\00\\00\\00\\02\\00\\00\\00\\02\\00\\00\\00\\00\\00\\00\\00\\00\\00\\00\\00\\02\\00\\00\\00\\02\\00 # 65536,1 Item
77 (fffe,e000) ?? 2c\\b7\\ee\\68\\de\\e3\\93\\2d\\b3\\b8\\ba\\90\\7b\\42\\3e\\f8\\42\\16\\64\\88\\46\\30\\37\\d4\\50\\95\\9b\\b6\\a5\\c7\\38\\9b # 65536,1 Item
78 (fffe,e000) ?? 48\\3c\\03\\e8\\c4\\3f\\44\\e1\\8a\\5c\\73\\3b\\02\\0a\\ad\\a5\\8f\\e4\\0c\\81\\76\\a2\\d7\\1b\\7f\\b7\\cd\\bc\\30\\c6\\6a\\6a # 43308,1 Item
79 (fffe,e0dd) 0
80
81 In order to create a J2K image out of it, we need to extract each
82 fragments and concatenate them:
83
84 $ gdcmraw -i D_CLUNIE_CT1_J2KR.dcm -o D_CLUNIE_CT1_J2KR.j2k
85
86 This is a valid J2K file, using the Kakadu software package:
87
88 $ kdu_expand -i D_CLUNIE_CT1_J2KR.j2k -o D_CLUNIE_CT1_J2KR.tiff -record D_CLUNIE_CT1_J2KR.txt
89
90 $ cat D_CLUNIE_CT1_J2KR.txt
91
92 Sprofile=PROFILE2
93 Scap=no
94 Sextensions=0
95 Ssize={512,512}
96 Sorigin={0,0}
97 Stiles={512,512}
98 Stile_origin={0,0}
99 Scomponents=1
100 Ssigned=yes
101 Sprecision=16
102 Ssampling={1,1}
103 Sdims={512,512}
104 Cycc=no
105 Cmct=0
106 Clayers=1
107 Cuse_sop=no
108 Cuse_eph=no
109 Corder=LRCP
110 Calign_blk_last={no,no}
111 Clevels=5
112 Cads=0
113 Cdfs=0
114 Cdecomp=B(-:-:-)
115 Creversible=yes
116 Ckernels=W5X3
117 Catk=0
118 Cuse_precincts=no
119 Cblk={64,64}
120 Cmodes=0
121 Qguard=1
122 Qabs_ranges=18,19,19,20,19,19,20,19,19,20,19,19,20,19,19,20
123
124 >> New attributes for tile 0:
125
126 Extract fragments as single file
127 Sometimes each fragments is in fact a single slice, so we would not
128 need to concatenate them:
129
130 $ gdcmdump 00191113.dcm
131
132 ...
133 (7fe0,0010) OB # u/l,1 Pixel Data
134 (fffe,e000) ?? 00\\00\\00\\00\\6b\\38\\01\\00\\10\\77\\02\\00\\37\\b6\\03\\00\\a7\\f4\\04\\00 # 20,1 Item
135 (fffe,e000) ?? ff\\d8\\ff\\c3\\00\\0b\\08\\02\\00\\02\\00\\01\\00\\11\\00\\ff\\c4\\00\\1b\\00\\01\\01\\01\\01\\01\\01\\01\\01\\00\\00\\00\\00 # 79970,1 Item
136 (fffe,e000) ?? ff\\d8\\ff\\c3\\00\\0b\\08\\02\\00\\02\\00\\01\\00\\11\\00\\ff\\c4\\00\\1b\\00\\01\\01\\01\\01\\01\\01\\01\\01\\00\\00\\00\\00 # 81564,1 Item
137 (fffe,e000) ?? ff\\d8\\ff\\c3\\00\\0b\\08\\02\\00\\02\\00\\01\\00\\11\\00\\ff\\c4\\00\\1b\\00\\01\\01\\01\\01\\01\\01\\01\\01\\00\\00\\00\\00 # 81694,1 Item
138 (fffe,e000) ?? ff\\d8\\ff\\c3\\00\\0b\\08\\02\\00\\02\\00\\01\\00\\11\\00\\ff\\c4\\00\\1b\\00\\01\\01\\01\\01\\01\\01\\01\\01\\00\\00\\00\\00 # 81511 (81512),1 Item
139 (fffe,e0dd) 0
140
141 Let's try to extract those 4 individual Lossless jpeg individually:
142
143 $ gdcmraw --split-frags -i 00191113.dcm -o jpeg --pattern %02d.ljpeg
144
145 This will output 4 files:
146
147 -rw-r--r-- 1 mathieu mathieu 81512 2008-08-08 22:10 jpeg03.ljpeg
148 -rw-r--r-- 1 mathieu mathieu 81694 2008-08-08 22:10 jpeg02.ljpeg
149 -rw-r--r-- 1 mathieu mathieu 81564 2008-08-08 22:10 jpeg01.ljpeg
150 -rw-r--r-- 1 mathieu mathieu 79970 2008-08-08 22:10 jpeg00.ljpeg
151
153 It is a common misunderstanding to interchange 'JPEG 8bits lossy' with
154 simply JPEG file. The JPEG specification is much broader than simply
155 the common lossy 8bits file (as found on internet).
156
157 You can have:
158
159 · JPEG Lossy 8bits
160
161 · JPEG Lossy 12bits
162
163 · JPEG Lossless 2-16bits
164
165 Those are what is defined in ITU-T T.81, ISO/IEC IS 10918-1.
166
168 gdcmdump(1), gdcmraw(1)
169
171 Mathieu Malaterre
172 Main developer
173
175 Copyright © 2006, 2011 Mathieu Malaterre
176
177
178
179GDCM 3.0.1 01/28/2020 GDCMRAW(1)