Reading DICOM Files and Data Sets

Skip to end of metadata
Go to start of metadata
Table of Contents

DICOM files and raw Data Sets (without the 128 byte preamble and group 0x0002) can be read from arbitrary inputstreams using the com.archimed.dicom.DicomReader class. The DicomReader class has a number of methods for reading DICOM data.

DicomObject read ( in)

This method can read both raw data sets and DICOM files and will return a DicomObject containing all the data elements within the DICOM file or raw data set. When the supplied inputstream points a to DICOM File, the File Meta Information is also read and stored in a separate DicomObject retrievable with getFileMetaInformation(). When the supplied inputstream points to a raw data set, the transfer syntax of the data set is assumed to be Implicit VR Little Endian. See the other read methods for reading raw data sets in other transfer syntaxes.

The simplest way of using this method is with the following code:

FileInputStream fin = new FileInputStream ();
DicomReader dcmReader = new DicomReader();
DicomObject dcm =;

DicomObject read ( in,boolean readpixels)

This method does the same as the previous one but in addition allows you to specify whether to parse or skip pixel data during the reading. This method is mainly here for backwards compatibility. Skipping arbitrary tags can also be achieved by registering a TagReadListener on the DicomReader.

DicomObject read ( in, int transfersyntax , boolean readpixels)

Use this method to read a raw data set. The transfer syntax is not detected but must be specified.

Note: The DicomObject class also contains a number of read methods. These methods are maintained for backwards compatibility. New implementations should use the DicomReader class to read DICOM files and data sets.

Enter labels to add to this page:
Please wait 
Looking for a label? Just start typing.