PNMTODC(1)

NAME
pnmtodc - ACR/NEMA DICOM PS3 ... DICOM PS3 - Create DICOM from PNM file

SYNOPSIS

pnmtodc [ -little|-l|-big|-b ] [ -imagepixelmoduleonly ] [ -v|verbose ]

DESCRIPTION

pnmtodc reads the named PNM input file and copies the information and pixel data to a new dicom file, creating a Secondary Capture SOP Class instance.

The output encoding of the file will be the default or explicitly requested transfer syntax, as described in dcintro(1) under output options. The byte order of the pixel data will be changed as necessary.

During the translation, specific attributes may be deleted, added or replaced, class and instance unique identifiers generated or removed, group lengths added, or private attributes removed, as specified by the replacement options described in dcintro(1). This allows the specification of additional DICOM attributes, such as the patient's name, necessary to make a complete and useful SC instance.

Photometric Interpretation will be MONOCHROME2 for PGM and RGB for PPM images.

Pixel Representation will always be unsigned.

Bits Stored will depend on maxval, and may be less than 8 or 16.

OPTIONS
The verbose output goes to standard error.

The basic input switches are described in dcintro(1). Options specific to this program are:

-little|-big
    Required if the maxval in the input file is greater than 255 (bit depth is greater than 8). Originally the PGM and PPM binary formats did not support more than one byte; in earlier versions of the dicom3tools the non-standard convention of using little endian two byte raw binary values was supported, but later the maintainers of netpbm added the same capability, but using big-endian. In order to force the issue in case one behavior or the other is assumed, it is now mandatory to specify this on the command line whenever more than 8 bits are used.

-imagepixelmoduleonly
    Write only the image pixel data module and not the basic mandatory secondary capture and composite IOD modules as well (e.g., prior to dcmerge'ing with an existing SOP instance that has its pixel data deleted); use the -nodisclaimer switch to avoid generating Image Comments and the -n switch to avoid adding a meta-information header (will fail if you do not since there is no SOP Class UID to use in the meta-information header).

-verbose
    Display contents after creation, during replacement, and before writing.

ENVIRONMENT

EXAMPLES

% head gray.256.256.12.pgm
P5
256 256
4095
% pnmtodc -v -little -r PatientName "Smith^Harry^^^"
        gray.256.256.12.pgm gray.dc3
Converting ...
******** As read ... ********
(0x0008,0x0020) DA Study Date ...
 ...
(0x0010,0x0010) PN Patient's Name <^^^^>
 ...
(0x0028,0x0002) US Samples per Pixel [0x0001]
(0x0028,0x0004) CS Photometric Interpretation <MONOCHROME2>
(0x0028,0x0008) IS Number of Frames <1 >
(0x0028,0x0010) US Rows [0x0100]
(0x0028,0x0011) US Columns [0x0100]
(0x0028,0x0100) US Bits Allocated [0x0010]
(0x0028,0x0101) US Bits Stored [0x000c]
(0x0028,0x0102) US High Bit [0x000b]
(0x0028,0x0103) US Pixel Representation [0x0000]
 ...
******** After replace before... ********
 ...
(0x0010,0x0010) PN Patient's Name <Smith^Harry^^^>
 ...
******** As written ... ********
(0x0002,0x0000) UL Meta Element Group Length ...
(0x0002,0x0001) OB File Meta Information Version ...
 ...
% dciodvfy gray.dc3
SCImage
% head rgb.256.256.8.ppm
P6
256 256
255
% pnmtodc -v rgb.256.256.8.ppm rgb.dc3
Converting ...
******** As read ... ********
 ...
(0x0028,0x0002) US Samples per Pixel [0x0003]
(0x0028,0x0004) CS Photometric Interpretation <RGB>
(0x0028,0x0008) IS Number of Frames <1 >
(0x0028,0x0010) US Rows [0x0100]
(0x0028,0x0011) US Columns [0x0100]
(0x0028,0x0100) US Bits Allocated [0x0008]
(0x0028,0x0101) US Bits Stored [0x0008]
(0x0028,0x0102) US High Bit [0x0007]
(0x0028,0x0103) US Pixel Representation [0x0000]
 ...

FILES

SEE ALSO
dccp(1), dctoraw(1), rawtodc(1), dciodvfy(1), dcintro(1), dcmerge(1)

AUTHOR
Copyright (c) 1993-2022, David A. Clunie DBA PixelMed Publishing. All rights reserved.

BUGS
Only raw grayscale PGM (P5) and RGB PPM (P6) PNM files are supported, not text or PBM files.

The number of Columns (horizontal pixels) must be an even number.