public class DicomReader
extends java.lang.Object
TagReadListener
,
TagReadEvent
Constructor and Description |
---|
DicomReader() |
Modifier and Type | Method and Description |
---|---|
void |
addSequenceItemReadListener(SequenceItemReadListener listener)
adds a SequenceItemReadListener for every data element read
|
void |
addSequenceItemReadListener(SequenceItemReadListener listener,
int tag)
adds a SequenceItemReadListener for a specific data element specified by a
tag constant.
|
void |
addSequenceItemReadListener(SequenceItemReadListener listener,
int group,
int element)
adds a SequenceItemReadListener for a specific data element specified by a
group element pair
|
void |
addTagReadListener(TagReadListener listener)
adds a TagReadListener for every data element read
|
void |
addTagReadListener(TagReadListener listener,
int tag)
adds a TagReadListener for a specific data element specified by a
tag constant.
|
void |
addTagReadListener(TagReadListener listener,
int group,
int element)
adds a TagReadListener for a specific data element specified by a
group element pair
|
boolean |
checkIfDicomFile(java.io.InputStream f)
Deprecated.
Newer implementatations should use
readPreamble(InputStream) |
DicomObject |
read(java.io.InputStream in)
reads a DICOM dataset from an InputStream.
|
DicomObject |
read(java.io.InputStream in,
boolean readpixels)
reads a raw DICOM dataset or DICOM file from an InputStream.
|
DicomObject |
read(java.io.InputStream in,
int transfersyntax)
reads a DICOM dataset from an InputStream.
|
DicomObject |
read(java.io.InputStream in,
int transfersyntax,
boolean readpixels)
reads a DICOM dataset from an InputStream.
|
static DicomObject |
readFileMetaInformation(java.io.InputStream in)
Utility method to read only the only the file meta information (group 0x0002) of a DICOM Part 10 file.
|
static byte[] |
readPreamble(java.io.InputStream in)
reads the preamble (128 bytes) of a DICOM file and subsequently the 4 byte DICOM prefix (DICM).
|
DicomObject |
readSequenceItem(java.io.InputStream in,
int transferSyntax)
reads a single sequence item and returns it as an independent DicomObject
without a parent.
|
void |
removeSequenceItemReadListener(SequenceItemReadListener listener)
removes a SequenceItemReadListener.
|
void |
removeSequenceItemReadListener(SequenceItemReadListener listener,
int tag)
removes a SequenceItemReadListener.
|
void |
removeSequenceItemReadListener(SequenceItemReadListener listener,
int group,
int element)
removes a SequenceItemReadListener.
|
void |
removeTagReadListener(TagReadListener listener)
removes a TagReadListener.
|
void |
removeTagReadListener(TagReadListener listener,
int tag)
removes a TagReadListener.
|
void |
removeTagReadListener(TagReadListener listener,
int group,
int element)
removes a TagReadListener.
|
protected JdtLogger log
public void addTagReadListener(TagReadListener listener, int tag)
listener
- TagReadListenertag
- intpublic void addTagReadListener(TagReadListener listener, int group, int element)
listener
- the TagReadListenergroup
- group valueelement
- element valuepublic void addTagReadListener(TagReadListener listener)
listener
- TagReadListenerpublic void removeTagReadListener(TagReadListener listener, int tag)
listener
- the TagListenertag
- DDict constantpublic void removeTagReadListener(TagReadListener listener, int group, int element)
listener
- TagListenergroup
- group valueelement
- element valuepublic void removeTagReadListener(TagReadListener listener)
listener
- TagReadListenerpublic void addSequenceItemReadListener(SequenceItemReadListener listener, int tag)
listener
- SequenceItemReadListenertag
- intpublic void addSequenceItemReadListener(SequenceItemReadListener listener, int group, int element)
listener
- SequenceItemListenergroup
- group valueelement
- element valuepublic void addSequenceItemReadListener(SequenceItemReadListener listener)
listener
- SequenceItemReadListenerpublic void removeSequenceItemReadListener(SequenceItemReadListener listener, int tag)
listener
- SequenceItemListenertag
- DDict constantpublic void removeSequenceItemReadListener(SequenceItemReadListener listener, int group, int element)
listener
- SequenceItemListenergroup
- group valueelement
- element valuepublic void removeSequenceItemReadListener(SequenceItemReadListener listener)
listener
- SequenceItemReadListenerpublic DicomObject read(java.io.InputStream in) throws java.io.IOException, DicomException
read(in, readpixels)
,
with the 'readpixels' boolean set to true.java.io.IOException
DicomException
public DicomObject read(java.io.InputStream in, boolean readpixels) throws java.io.IOException, DicomException
Note: Any registered TagReadListeners that modify or skip the pixeldata may override the behaviour of the boolean property readpxels.
in
- an InputStream to a DICOM dataset or DICOM filereadpixels
- A boolean indicating whether to parse the Pixel Data or notjava.io.IOException
DicomException
public DicomObject read(java.io.InputStream in, int transfersyntax) throws java.io.IOException, DicomException
read(in, readpixels)
,
with the 'readpixels' boolean set to true.in
- an InputStream to a DICOM datasettransfersyntax
- the transfer syntax with which this Dataset is encodedjava.io.IOException
DicomException
TransferSyntax
public DicomObject read(java.io.InputStream in, int transfersyntax, boolean readpixels) throws java.io.IOException, DicomException
Note: Any registered TagReadListeners that modify or skip the pixeldata may override the behaviour of the boolean property readpxels.
in
- an InputStream to a DICOM datasettransfersyntax
- the transfer syntax with which this Dataset is encodedreadpixels
- boolean indicating whether to parse the pixel data or notjava.io.IOException
DicomException
TransferSyntax
public DicomObject readSequenceItem(java.io.InputStream in, int transferSyntax) throws java.io.IOException, DicomException
java.io.IOException
DicomException
public static DicomObject readFileMetaInformation(java.io.InputStream in) throws java.io.IOException, DicomException
readPreamble(InputStream)
method
to read the preamble and position the stream properly at the start of group 0x0002.
The specified InputStream must support the usage of mark/reset with a 4 byte buffer.
When the method returns, the stream is positioned at the beginning of the next group of the DICOM file.
in
- InputStream (must support mark)java.io.IOException
- thrown when the underlying read() methods throws an IOExceptionDicomException
- -public static byte[] readPreamble(java.io.InputStream in) throws java.io.IOException, DicomException
This method can be used both to read the preamble and check if arbitrary files are DICOM files. The method will throw a DicomException when end-of-stream is reached before 132 bytes or when there is no 4 byte DICOM prefix starting at offset 128.
in
- InputStreamjava.io.IOException
- thrown when the underlying read() methods throws an IOExceptionDicomException
- when there is no valid 4 byte DICOM prefixpublic boolean checkIfDicomFile(java.io.InputStream f) throws java.io.IOException, DicomException
readPreamble(InputStream)
java.io.IOException
DicomException