public class DicomInputStream extends BinaryInputStream
A class that extends BinaryInputStream
by adding
the concept of transfer syntaxes, for a (possible) meta information header and a data set.
Note this class does not automatically switch from meta information header to data set
transfer syntaxes. That is the responsibility of the caller parsing the individual attributes
(such as by reaching the end of the meta information group length, and then calling
setReadingDataSet()
.
AttributeList
,
DicomOutputStream
in
Constructor and Description |
---|
DicomInputStream(File file)
Construct a stream to read DICOM data sets from the supplied stream.
|
DicomInputStream(File file,
String transferSyntaxUID,
boolean tryMeta)
Construct a stream to read DICOM data sets from the supplied stream.
|
DicomInputStream(InputStream i)
Construct a stream to read DICOM data sets from the supplied stream.
|
DicomInputStream(InputStream i,
String transferSyntaxUID,
boolean tryMeta)
Construct a stream to read DICOM data sets from the supplied stream.
|
Modifier and Type | Method and Description |
---|---|
boolean |
areReadingDataSet()
Are we reading the dataset?
|
boolean |
areReadingMetaHeader()
Are we reading the meta information header?
|
long |
getByteOffsetOfStartOfData()
Get the byte offset of the start of the dataset or meta information header.
|
TransferSyntax |
getTransferSyntaxInUse()
Get the transfer syntax currently in use.
|
TransferSyntax |
getTransferSyntaxToReadDataSet()
Get the transfer syntax to be used for reading the data set.
|
TransferSyntax |
getTransferSyntaxToReadMetaHeader()
Get the transfer syntax to be used for reading the meta information header.
|
void |
guessTransferSyntaxToReadDataSet() |
boolean |
haveMetaHeader()
Do we have a meta information header?
|
void |
setReadingDataSet()
Switch to the transfer syntax for reading the dataset.
|
void |
setReadingMetaHeader()
Switch to the transfer syntax for reading the meta information header.
|
void |
setTransferSyntaxToReadDataSet(TransferSyntax ts)
Specify what transfer syntax to use when switching from reading
the meta information header to reading the data set.
|
getFile, isBigEndian, isLittleEndian, main, readComplexDouble, readComplexFloat, readDouble, readDouble, readFloat, readFloat, readInsistently, readSigned16, readSigned32, readSigned64, readUnsigned16, readUnsigned16, readUnsigned16, readUnsigned32, readUnsigned32, readUnsigned32, readUnsigned64, readUnsigned64, readUnsigned64, readUnsigned8, setBigEndian, setEndian, setFile, setLittleEndian, skipInsistently
available, close, mark, markSupported, read, read, read, reset, skip
public DicomInputStream(File file) throws IOException
Construct a stream to read DICOM data sets from the supplied stream.
Look for a meta information header; if absent guess at a transfer syntax based on the contents.
file
- the file to read fromIOException
- if an I/O error occurspublic DicomInputStream(File file, String transferSyntaxUID, boolean tryMeta) throws IOException
Construct a stream to read DICOM data sets from the supplied stream.
file
- the file to read fromtransferSyntaxUID
- use this transfer syntax (may be null)tryMeta
- if true, try to find a meta information headerIOException
- if an I/O error occurspublic DicomInputStream(InputStream i) throws IOException
Construct a stream to read DICOM data sets from the supplied stream.
Look for a meta information header; if absent guess at a transfer syntax based on the contents.
i
- the input stream to read fromIOException
- if an I/O error occurspublic DicomInputStream(InputStream i, String transferSyntaxUID, boolean tryMeta) throws IOException
Construct a stream to read DICOM data sets from the supplied stream.
i
- the input stream to read fromtransferSyntaxUID
- use this transfer syntax (may be null)tryMeta
- if true, try to find a meta information headerIOException
- if an I/O error occurspublic boolean areReadingDataSet()
Are we reading the dataset?
public boolean areReadingMetaHeader()
Are we reading the meta information header?
public long getByteOffsetOfStartOfData()
Get the byte offset of the start of the dataset or meta information header.
Will be 0 if no preamble, 132 if a preamble.
public TransferSyntax getTransferSyntaxInUse()
Get the transfer syntax currently in use.
public TransferSyntax getTransferSyntaxToReadDataSet()
Get the transfer syntax to be used for reading the data set.
public TransferSyntax getTransferSyntaxToReadMetaHeader()
Get the transfer syntax to be used for reading the meta information header.
public void guessTransferSyntaxToReadDataSet() throws IOException
IOException
public boolean haveMetaHeader()
Do we have a meta information header?
public void setReadingDataSet()
Switch to the transfer syntax for reading the dataset.
public void setReadingMetaHeader()
Switch to the transfer syntax for reading the meta information header.
public void setTransferSyntaxToReadDataSet(TransferSyntax ts)
Specify what transfer syntax to use when switching from reading the meta information header to reading the data set.
ts
- transfer syntax to use for data set