/
Reading DICOM files
Reading DICOM files
Introduction
DICOM files can be read from Java java.io.InputStream
objects, and java.io.File
objects. This is done through the org.dcm4che2.io.DicomInputStream
class, which extends java.io.FilterInputStream
. The DICOM file is typically read into a org.dcm4che2.data.DicomObject
implementation. For example:
DicomObject dcmObj; DicomInputStream din = null; try { din = new DicomInputStream(new File("image.dcm")); dcmObj = din.readDicomObject(); } catch (IOException e) { e.printStackTrace(); return; } finally { try { din.close(); } catch (IOException ignore) { } }
The DicomObject
may then be worked with.
When creating DicomInputStream
objects, the Transfer Syntax of the DICOM file will be extrapolated from the file contents. There may be cases where you need to read a raw dataset or when you already know the Transfer Syntax of the DICOM object. In these cases case you should use one of the constructors that specifies the Transfer Syntax as an argument. For example:
din = new DicomInputStream(new BufferedInputStream(new FileInputStream("image.dcm")), TransferSyntax.ImplicitVRLittleEndian);
This page has been viewed
Unknown macro: {tracking-info}
zero
times.
, multiple selections available,
Related content
DICOM Resources
DICOM Resources
Read with this
A Very Basic DICOM Introduction
A Very Basic DICOM Introduction
Read with this
DICOM network operations
DICOM network operations
Read with this
Building dcm4che2
Building dcm4che2
Read with this
Using dcm4che2 from JRuby
Using dcm4che2 from JRuby
Read with this
dcmqr
dcmqr
Read with this