'\" t .\" Title: gdcmraw .\" Author: Mathieu Malaterre .\" Generator: DocBook XSL Stylesheets v1.79.2 .\" Date: 07/31/2021 .\" Manual: DICOM Manipulation. .\" Source: GDCM 3.0.8 .\" Language: English .\" .TH "GDCMRAW" "1" "07/31/2021" "GDCM 3\&.0\&.8" "DICOM Manipulation\&." .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- .\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ .\" http://bugs.debian.org/507673 .\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html .\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" ----------------------------------------------------------------- .\" * set default formatting .\" ----------------------------------------------------------------- .\" disable hyphenation .nh .\" disable justification (adjust text to left margin only) .ad l .\" ----------------------------------------------------------------- .\" * MAIN CONTENT STARTS HERE * .\" ----------------------------------------------------------------- .SH "NAME" gdcmraw \- Extract Data Element Value Field\&. .SH "SYNOPSIS" .PP .if n \{\ .RS 4 .\} .nf gdcmraw [options] file\-in file\-out .fi .if n \{\ .RE .\} .SH "DESCRIPTION" .PP The \fBgdcmraw\fR tool is mostly used for development purpose\&. It is used to extract a specific binary field from a DICOM DataSet\&. .SH "PARAMETERS" .PP .if n \{\ .RS 4 .\} .nf file\-in DICOM input filename file\-out output filename .fi .if n \{\ .RE .\} .SH "OPTIONS" .PP .if n \{\ .RS 4 .\} .nf \-i \-\-input Input filename \-o \-\-output Output filename \-t \-\-tag Specify tag to extract value from\&. .fi .if n \{\ .RE .\} .SH "SPECIFIC OPTIONS" .PP .if n \{\ .RS 4 .\} .nf \-S \-\-split\-frags Split fragments into multiple files\&. \-p \-\-pattern Specify trailing file pattern (see split\-frags)\&. \-P \-\-pixel\-data Pixel Data trailing 0\&. .fi .if n \{\ .RE .\} .SH "GENERAL OPTIONS" .PP .if n \{\ .RS 4 .\} .nf \-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 .fi .if n \{\ .RE .\} .SH "TYPICAL USAGE" .SS "Copy Attribute Value to file" .PP This will extract the value at Tag (0025,101b): .PP .if n \{\ .RS 4 .\} .nf $ gdcmraw \-i GE_MR_0025xx1bProtocolDataBlock\&.dcm \-t 25,101b \-o pdb\&.raw .fi .if n \{\ .RE .\} .SS "Extract Pixel Data" .PP If you do not specify any tag, the Pixel Data element is the default one\&. So for instance to grab the Pixel Data from an image: .PP .if n \{\ .RS 4 .\} .nf $ gdcmraw \-i test\&.acr \-o test\&.raw .fi .if n \{\ .RE .\} .PP You can then for example compute the md5sum of this pixel data (very useful): .PP .if n \{\ .RS 4 .\} .nf $ md5sum test\&.raw f845c8f283d39a0204c325654493ba53 test\&.raw .fi .if n \{\ .RE .\} .SS "Encapsulated Syntax" .PP When the Pixel Data is encapsulated, multiple fragments can be used to store a single slice image: .PP .if n \{\ .RS 4 .\} .nf $ gdcmdump D_CLUNIE_CT1_J2KR\&.dcm .fi .if n \{\ .RE .\} .PP .if n \{\ .RS 4 .\} .nf \&.\&.\&. (7fe0,0010) OB # u/l,1 Pixel Data (fffe,e000) ?? [] # 0,1 Item (fffe,e000) ?? ff\e\e4f\e\eff\e\e51\e\e00\e\e29\e\e00\e\e00\e\e00\e\e00\e\e02\e\e00\e\e00\e\e00\e\e02\e\e00\e\e00\e\e00\e\e00\e\e00\e\e00\e\e00\e\e00\e\e00\e\e00\e\e00\e\e02\e\e00\e\e00\e\e00\e\e02\e\e00 # 65536,1 Item (fffe,e000) ?? 2c\e\eb7\e\eee\e\e68\e\ede\e\ee3\e\e93\e\e2d\e\eb3\e\eb8\e\eba\e\e90\e\e7b\e\e42\e\e3e\e\ef8\e\e42\e\e16\e\e64\e\e88\e\e46\e\e30\e\e37\e\ed4\e\e50\e\e95\e\e9b\e\eb6\e\ea5\e\ec7\e\e38\e\e9b # 65536,1 Item (fffe,e000) ?? 48\e\e3c\e\e03\e\ee8\e\ec4\e\e3f\e\e44\e\ee1\e\e8a\e\e5c\e\e73\e\e3b\e\e02\e\e0a\e\ead\e\ea5\e\e8f\e\ee4\e\e0c\e\e81\e\e76\e\ea2\e\ed7\e\e1b\e\e7f\e\eb7\e\ecd\e\ebc\e\e30\e\ec6\e\e6a\e\e6a # 43308,1 Item (fffe,e0dd) 0 .fi .if n \{\ .RE .\} .PP In order to create a J2K image out of it, we need to extract each fragments and concatenate them: .PP .if n \{\ .RS 4 .\} .nf $ gdcmraw \-i D_CLUNIE_CT1_J2KR\&.dcm \-o D_CLUNIE_CT1_J2KR\&.j2k .fi .if n \{\ .RE .\} .PP This is a valid J2K file, using the Kakadu software package: .PP .if n \{\ .RS 4 .\} .nf $ kdu_expand \-i D_CLUNIE_CT1_J2KR\&.j2k \-o D_CLUNIE_CT1_J2KR\&.tiff \-record D_CLUNIE_CT1_J2KR\&.txt .fi .if n \{\ .RE .\} .PP .if n \{\ .RS 4 .\} .nf $ cat D_CLUNIE_CT1_J2KR\&.txt .fi .if n \{\ .RE .\} .PP .if n \{\ .RS 4 .\} .nf Sprofile=PROFILE2 Scap=no Sextensions=0 Ssize={512,512} Sorigin={0,0} Stiles={512,512} Stile_origin={0,0} Scomponents=1 Ssigned=yes Sprecision=16 Ssampling={1,1} Sdims={512,512} Cycc=no Cmct=0 Clayers=1 Cuse_sop=no Cuse_eph=no Corder=LRCP Calign_blk_last={no,no} Clevels=5 Cads=0 Cdfs=0 Cdecomp=B(\-:\-:\-) Creversible=yes Ckernels=W5X3 Catk=0 Cuse_precincts=no Cblk={64,64} Cmodes=0 Qguard=1 Qabs_ranges=18,19,19,20,19,19,20,19,19,20,19,19,20,19,19,20 >> New attributes for tile 0: .fi .if n \{\ .RE .\} .SS "Extract fragments as single file" .PP Sometimes each fragments is in fact a single slice, so we would not need to concatenate them: .PP .if n \{\ .RS 4 .\} .nf $ gdcmdump 00191113\&.dcm .fi .if n \{\ .RE .\} .PP .if n \{\ .RS 4 .\} .nf \&.\&.\&. (7fe0,0010) OB # u/l,1 Pixel Data (fffe,e000) ?? 00\e\e00\e\e00\e\e00\e\e6b\e\e38\e\e01\e\e00\e\e10\e\e77\e\e02\e\e00\e\e37\e\eb6\e\e03\e\e00\e\ea7\e\ef4\e\e04\e\e00 # 20,1 Item (fffe,e000) ?? ff\e\ed8\e\eff\e\ec3\e\e00\e\e0b\e\e08\e\e02\e\e00\e\e02\e\e00\e\e01\e\e00\e\e11\e\e00\e\eff\e\ec4\e\e00\e\e1b\e\e00\e\e01\e\e01\e\e01\e\e01\e\e01\e\e01\e\e01\e\e01\e\e00\e\e00\e\e00\e\e00 # 79970,1 Item (fffe,e000) ?? ff\e\ed8\e\eff\e\ec3\e\e00\e\e0b\e\e08\e\e02\e\e00\e\e02\e\e00\e\e01\e\e00\e\e11\e\e00\e\eff\e\ec4\e\e00\e\e1b\e\e00\e\e01\e\e01\e\e01\e\e01\e\e01\e\e01\e\e01\e\e01\e\e00\e\e00\e\e00\e\e00 # 81564,1 Item (fffe,e000) ?? ff\e\ed8\e\eff\e\ec3\e\e00\e\e0b\e\e08\e\e02\e\e00\e\e02\e\e00\e\e01\e\e00\e\e11\e\e00\e\eff\e\ec4\e\e00\e\e1b\e\e00\e\e01\e\e01\e\e01\e\e01\e\e01\e\e01\e\e01\e\e01\e\e00\e\e00\e\e00\e\e00 # 81694,1 Item (fffe,e000) ?? ff\e\ed8\e\eff\e\ec3\e\e00\e\e0b\e\e08\e\e02\e\e00\e\e02\e\e00\e\e01\e\e00\e\e11\e\e00\e\eff\e\ec4\e\e00\e\e1b\e\e00\e\e01\e\e01\e\e01\e\e01\e\e01\e\e01\e\e01\e\e01\e\e00\e\e00\e\e00\e\e00 # 81511 (81512),1 Item (fffe,e0dd) 0 .fi .if n \{\ .RE .\} .PP Let\*(Aqs try to extract those 4 individual Lossless jpeg individually: .PP .if n \{\ .RS 4 .\} .nf $ gdcmraw \-\-split\-frags \-i 00191113\&.dcm \-o jpeg \-\-pattern %02d\&.ljpeg .fi .if n \{\ .RE .\} .PP This will output 4 files: .PP .if n \{\ .RS 4 .\} .nf \-rw\-r\-\-r\-\- 1 mathieu mathieu 81512 2008\-08\-08 22:10 jpeg03\&.ljpeg \-rw\-r\-\-r\-\- 1 mathieu mathieu 81694 2008\-08\-08 22:10 jpeg02\&.ljpeg \-rw\-r\-\-r\-\- 1 mathieu mathieu 81564 2008\-08\-08 22:10 jpeg01\&.ljpeg \-rw\-r\-\-r\-\- 1 mathieu mathieu 79970 2008\-08\-08 22:10 jpeg00\&.ljpeg .fi .if n \{\ .RE .\} .SH "FOOTNOTE ABOUT JPEG FILES" .PP It is a common misunderstanding to interchange \*(AqJPEG 8bits lossy\*(Aq with simply JPEG file\&. The JPEG specification is much broader than simply the common lossy 8bits file (as found on internet)\&. .PP You can have: .PP .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ .sp -1 .IP \(bu 2.3 .\} JPEG Lossy 8bits .RE .sp .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ .sp -1 .IP \(bu 2.3 .\} JPEG Lossy 12bits .RE .sp .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ .sp -1 .IP \(bu 2.3 .\} JPEG Lossless 2\-16bits .RE .sp Those are what is defined in ITU\-T T\&.81, ISO/IEC IS 10918\-1\&. .SH "SEE ALSO" .PP \fBgdcmdump\fR(1), \fBgdcmraw\fR(1) .SH "AUTHOR" .PP \fBMathieu Malaterre\fR .RS 4 Main developer .RE .SH "COPYRIGHT" .br Copyright \(co 2006, 2011 Mathieu Malaterre .br