.TH "gdcmimg" 1 "Tue Feb 5 2013" "Version 2.2.0" "GDCM" \" -*- nroff -*- .ad l .nh .SH NAME gdcmimg \- Manipulate DICOM image file\&. .SH "SYNOPSIS" .PP .PP .nf gdcmimg [options] file-in file-out .fi .PP .SH "DESCRIPTION" .PP The \fBgdcmimg\fP command line tool can be used in two fashions: .PD 0 .IP "\(bu" 2 1\&. Converting a recognized file format into its encapsulated DICOM counterpart, .IP "\(bu" 2 2\&. Anonymizing a rectangular portion of a DICOM file\&. .PP .SH "PARAMETERS" .PP .PP .nf file-in input filename file-out output filename .fi .PP .SH "options" .PP .SS "PARAMETERS" .PP .nf -i --input Input filename -o --output Output filename .fi .PP .SS "options" .PP .nf --endian %s Endianness (LSB/MSB). -d --depth %d Depth (8/16/32). --sign %s Pixel sign (0/1). -s --size %d,%d Size. -C --sop-class-uid SOP Class UID (name or value). -T --study-uid Study UID. -S --series-uid Series UID. --root-uid Root UID. .fi .PP .SS "fill options" .PP .nf -R --region %d,%d Region. -F --fill %d Fill with pixel value specified. .fi .PP .SS "general options" .PP .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 .PP .SS "environment variable" .PP .nf GDCM_ROOT_UID Root UID .fi .PP .SH "Supported File Format (appropriate file extension)" .PP gdcmimg will base it's conversion process based on the file extension\&. Follows the list of recognized file extension\&. When no extension is found, DICOM file is assumed\&. .PP input format .PP .nf * RAW (raw, gray, rgb) * RLE (rle) * PNM (pgm, pnm, ppm) * JPEG-LS (jls) * JPEG 2000 (jp2, j2k, j2c, jpc) * JPEG (jpg, jpeg, ljpg, ljpeg) * DICOM () .fi .PP .PP output format: .PP .nf * PGM (pgm, pnm, ppm) * DICOM () .fi .PP .PP For RAW file format, you should take special care of the --endian option\&. For the (old) JPEG file format, both the lossy and lossless format are supported, user should pay attention to the --sign option\&. For file format such as RLE or RAW, user is expected to fill in information required to find the dimension and type of input data as there is no other way to find this information\&. For all other file format, the properties are derived from the file format itself\&. PNM file are supposed to be big endian\&. .SH "Typical usage" .PP .SS "Remove a rectangular part of the image" To fill the region [0,100]x[0,100] of a DICOM image simply do: .PP .PP .nf $ gdcmimg --fill 0 --region 0,100,0,100 -i input.dcm -o output_black.dcm .fi .PP .PP Warning: if the Pixel Data is compressed, the image is first decompressed so that pixel can be set to 0, but it is not recompressed\&. .SS "Convert RAW to DICOM" Recognized extension is \&.raw, \&.gray or \&.rgb (case insensitive) .PP .PP .nf $ gdcmimg --size 512,512 --depth 16 -i input.raw -o output.dcm .fi .PP .PP the image will be a Secondary Capture .PP When the input is 3 component, one need to specify explicitely the Samples Per Pixel: .PP .PP .nf $ gdcmimg --size 512,512 --spp 3 input_rgb.raw output_rgb.dcm .fi .PP .PP When the filename contains \&.rgb as file extension output is automatically recognized as RGB no need to specify --spp .PP .PP .nf $ gdcmimg --size 512,512 input.rgb output_rgb.dcm .fi .PP .PP You can use the \fBdd\fP cmd line to skip any header you would like to discard, for instance, if you would like to skip the first 108 bytes, simply do: .PP .PP .nf $ dd skip=108 bs=1 if=input.raw of=output.raw .fi .PP .SS "Convert PGM/PNM/PPM to DICOM" Recognized extensions are \&.pgm, \&.pnm, \&.ppm (case insensitive) .PP .PP .nf $ gdcmimg -i input.pgm -o output.dcm .fi .PP .PP the image will be a Secondary Capture .SS "Convert RLE to DICOM" Recognized extension is \&.rle (case insensitive) .PP .PP .nf $ gdcmimg --size 512,512 --depth 16 -i input.rle -o output.dcm .fi .PP .PP the image will be a Secondary Capture .SS "Convert JPEG to DICOM" Recognized extensions are \&.jpg, \&.jpeg, \&.ljpg, \&.ljpeg (case insensitive) .PP .PP .nf $ gdcmimg -i input.ljpeg -o output.dcm .fi .PP .PP the image will be a Secondary Capture .SS "Convert J2K to DICOM" Recognized extensions are \&.j2k, \&.jp2, \&.jpc (case insensitive) .PP .PP .nf $ gdcmimg -i input.j2k -o output.dcm .fi .PP .PP the image will be a Secondary Capture .SS "Specifying a SOP Class UID" Instead of the default Secondary Capture Image Storage, one may want to specify, say VL Photographic Image Storage\&. .PP .PP .nf $ gdcmimg --sop-class-uid 1.2.840.10008.5.1.4.1.1.77.1.4 input.jpg output.dcm .fi .PP .SH "Multiple Files" .PP gdcmimg handle nicely a set of files (for instance jpeg): .PP .PP .nf $ gdcmimg 1.jpg 2.jpg 3.jpg 4.jpg output.dcm .fi .PP .SH "Warning" .PP There are a couple of issues with gdcmimg implementation: For JFIF file and JP2 file (with header) the header is copied into the Pixel Data element which is illegal for JP2\&. Use gdcmconv to properly re-encode a JP2/JFIF file into J2K/JPG\&. .PP .PP .nf $ gdcmimg input.jp2 output_jp2.dcm $ gdcmconv --j2k --force output_jp2.dcm output_j2k.dcm .fi .PP .PP For RLE file, no check is done for crossing the row boundary\&. It is recommended to use gdcmconv --rle to re-encode into a proper RLE file in case of doubt\&. .PP Of course if the compression is not ok with your setup, you can always de-encapsulated the DICOM file (typically JPEG) to a non-encapsulated form, using gdcmconv: .PP .PP .nf $ gdcmconv --raw input_jpeg.dcm output_raw.dcm .fi .PP .SH "SEE ALSO" .PP \fBgdcmdump\fP(1), \fBgdcmdump\fP(1), \fBgdcmraw\fP(1), \fBconvert\fP(1), \fBdd\fP(1) .SH "COPYRIGHT" .PP Copyright (c) 2006-2011 Mathieu Malaterre