public class DicomInputStream extends FilterInputStream implements DicomInputHandler
Modifier and Type | Class and Description |
---|---|
static class |
DicomInputStream.IncludeBulkData |
in
Constructor and Description |
---|
DicomInputStream(File file) |
DicomInputStream(InputStream in) |
DicomInputStream(InputStream in,
String tsuid) |
available, markSupported
private static final String UNEXPECTED_NON_ZERO_ITEM_LENGTH
private static final String UNEXPECTED_ATTRIBUTE
private static final String MISSING_TRANSFER_SYNTAX
private static final String MISSING_FMI_LENGTH
private static final String NOT_A_DICOM_STREAM
private static final String IMPLICIT_VR_BIG_ENDIAN
private static final String DEFLATED_WITH_ZLIB_HEADER
private static final int ZLIB_HEADER
private static final int DEF_ALLOCATE_LIMIT
private int allocateLimit
private byte[] preamble
private Attributes fileMetaInformation
private boolean hasfmi
private boolean bigEndian
private boolean explicitVR
private DicomInputStream.IncludeBulkData includeBulkData
private DicomInputStream.IncludeBulkData includeFragmentBulkData
private long pos
private long fmiEndPos
private long tagPos
private long markPos
private int tag
private int length
private DicomInputHandler handler
private BulkDataDescriptor bulkDataDescriptor
private final byte[] buffer
private ItemPointer[] itemPointers
private boolean decodeUNWithIVRLE
private boolean addBulkDataReferences
private boolean catBlkFiles
private String blkFilePrefix
private String blkFileSuffix
private File blkDirectory
private FileOutputStream blkOut
private long blkOutPos
public DicomInputStream(InputStream in, String tsuid) throws IOException
IOException
public DicomInputStream(InputStream in) throws IOException
IOException
public DicomInputStream(File file) throws IOException
IOException
public final String getTransferSyntax()
public final int getAllocateLimit()
setAllocateLimit(int)
public final void setAllocateLimit(int allocateLimit)
DicomInputStream
, the byte array is reallocated with
twice the previous length and filled again. That continues until
the twice of the previous length exceeds the actual value length. Then
the byte array is reallocated with actual value length and filled with
the remaining bytes for the value from this DicomInputStream
.
The rational of the incrementing allocation of byte arrays is to avoid
OutOfMemoryErrors on parsing corrupted DICOM streams.
By default, the limit is set to 67108864 (64 MiB).allocateLimit
- limit of initial allocated memory or -1 for no limitpublic final DicomInputStream.IncludeBulkData getIncludeBulkData()
public final void setIncludeBulkData(DicomInputStream.IncludeBulkData includeBulkData)
public final DicomInputStream.IncludeBulkData getIncludeFragmentBulkData()
public final BulkDataDescriptor getBulkDataDescriptor()
public final void setBulkDataDescriptor(BulkDataDescriptor bulkDataDescriptor)
public final String getBulkDataFilePrefix()
public final void setBulkDataFilePrefix(String blkFilePrefix)
public final String getBulkDataFileSuffix()
public final void setBulkDataFileSuffix(String blkFileSuffix)
public final File getBulkDataDirectory()
public final void setBulkDataDirectory(File blkDirectory)
public final boolean isConcatenateBulkDataFiles()
public final void setConcatenateBulkDataFiles(boolean catBlkFiles)
public final List<File> getBulkDataFiles()
public final void setDicomInputHandler(DicomInputHandler handler)
public boolean isDecodeUNWithIVRLE()
public void setDecodeUNWithIVRLE(boolean decodeUNWithIVRLE)
public boolean isAddBulkDataReferences()
public void setAddBulkDataReferences(boolean addBulkDataReferences)
public final void setFileMetaInformationGroupLength(byte[] val)
public final byte[] getPreamble()
public Attributes getFileMetaInformation() throws IOException
IOException
public final int level()
public final int tag()
public final int length()
public final long getPosition()
public void setPosition(long pos)
public long getTagPosition()
public final boolean bigEndian()
public final boolean explicitVR()
public void close() throws IOException
close
in interface Closeable
close
in interface AutoCloseable
close
in class FilterInputStream
IOException
public void mark(int readlimit)
mark
in class FilterInputStream
public void reset() throws IOException
reset
in class FilterInputStream
IOException
public final int read() throws IOException
read
in class FilterInputStream
IOException
public final int read(byte[] b, int off, int len) throws IOException
read
in class FilterInputStream
IOException
public final int read(byte[] b) throws IOException
read
in class FilterInputStream
IOException
public final long skip(long n) throws IOException
skip
in class FilterInputStream
IOException
public void skipFully(long n) throws IOException
IOException
public void readFully(byte[] b) throws IOException
IOException
public void readFully(byte[] b, int off, int len) throws IOException
IOException
public int readHeader() throws IOException
IOException
public Attributes readCommand() throws IOException
IOException
public DatasetWithFMI readDatasetWithFMI() throws IOException
IOException
public DatasetWithFMI readDatasetWithFMI(int len, int stopTag) throws IOException
len
- maximum length to read in bytes, use -1 for no limitstopTag
- stop reading at the given Tag, use -1 for no stop tagIOException
public Attributes readDataset(int len, int stopTag) throws IOException
IOException
public Attributes readFileMetaInformation() throws IOException
IOException
public void readAttributes(Attributes attrs, int len, int stopTag) throws IOException
IOException
public void readValue(DicomInputStream dis, Attributes attrs) throws IOException
readValue
in interface DicomInputHandler
IOException
public BulkData createBulkData() throws IOException
IOException
public boolean isBulkData(Attributes attrs)
public void readValue(DicomInputStream dis, Sequence seq) throws IOException
readValue
in interface DicomInputHandler
IOException
public void readValue(DicomInputStream dis, Fragments frags) throws IOException
readValue
in interface DicomInputHandler
IOException
public void startDataset(DicomInputStream dis)
startDataset
in interface DicomInputHandler
public void endDataset(DicomInputStream dis)
endDataset
in interface DicomInputHandler
private void checkIsThis(DicomInputStream dis)
private void skipAttribute(String message) throws IOException
IOException
private void readSequence(int len, Attributes attrs, int sqtag) throws IOException
IOException
public Attributes readItem() throws IOException
IOException
private void readFragments(Attributes attrs, int fragsTag, VR vr) throws IOException
IOException
public byte[] readValue() throws IOException
IOException
private void switchTransferSyntax(String tsuid) throws IOException
IOException
private boolean hasZLIBHeader() throws IOException
IOException
private void guessTransferSyntax() throws IOException
IOException
private boolean guessTransferSyntax(byte[] b128, int rlen, boolean bigEndian) throws DicomStreamException
DicomStreamException
Copyright © 2017 dcm4che.org. All rights reserved.