public class DicomReader
extends java.lang.Object
Constructor and Description |
---|
DicomReader() |
Modifier and Type | Method and Description |
---|---|
void |
addImageDecoder(DicomImageDecoder decoder)
Add a custom image decoder, the new decoder taking priority over existing
ones if multiple decoders can handle a given DICOM file
|
void |
addImageDecoderFirst(DicomImageDecoder decoder)
Add a custom image decoder, the new decoder taking priority over existing
ones if multiple decoders can handle a given DICOM file
|
void |
addImageDecoderLast(DicomImageDecoder decoder)
Add a custom image decoder, the new decoder will be the last to try,
prioritizing existing decoders if multiple can handle a given DICOM file
|
java.util.ArrayList<java.io.File> |
getAllFiles(java.io.File root,
java.util.regex.Pattern filePattern,
boolean recursive) |
DicomImage |
read(DicomImage im,
java.util.List<java.io.File> files)
Populates a DicomImage based on a given list of DICOM files.
|
DicomImage |
read(DicomImage im,
java.util.List<java.io.File> files,
int temporalPosition)
Populates a DicomImage based on a given list of DICOM files.
|
DicomImage |
read(DicomImage im,
java.lang.String directory)
Populates a DicomImage based on a given directory containing DICOM files
and a file pattern to restrict files to load.
|
DicomImage |
read(DicomImage im,
java.lang.String directory,
java.util.regex.Pattern filePattern,
boolean checkSubdirectories)
Populates a DicomImage based on a given directory containing DICOM files
and a file pattern to restrict files to load.
|
DicomImage |
read(DicomImage im,
java.lang.String directory,
java.util.regex.Pattern filePattern,
boolean checkSubdirectories,
int temporalPosition)
Populates a DicomImage based on a given directory containing DICOM files
and a file pattern to restrict files to load.
|
DicomHeader |
readHeader(IntHolder lastTagId,
BinaryFileInputStream in,
java.lang.String sourceName)
Reads a header from a single input stream (e.g.
|
DicomSlice[] |
readSlices(java.lang.String sliceTitle,
java.io.File file)
Reads a slice or set of slices from a single input stream (e.g.
|
public void addImageDecoder(DicomImageDecoder decoder)
decoder
- decoder to addpublic void addImageDecoderFirst(DicomImageDecoder decoder)
decoder
- decoder to addpublic void addImageDecoderLast(DicomImageDecoder decoder)
decoder
- decoder to addpublic DicomImage read(DicomImage im, java.lang.String directory) throws java.io.IOException
im
- DICOM image to populate, or null to generate a new imagedirectory
- directory from which to load filesjava.io.IOException
- if there is an error reading a DICOM filepublic DicomImage read(DicomImage im, java.lang.String directory, java.util.regex.Pattern filePattern, boolean checkSubdirectories) throws java.io.IOException
im
- DICOM image to populate, or null to generate a new imagedirectory
- directory from which to load filesfilePattern
- regular expression pattern for accepting files to load. The pattern is
applied to the full absolute file names of files found. If null, all files
are accepted.checkSubdirectories
- whether to recursively search sub-directories for matching filesjava.io.IOException
- if there is an error reading a DICOM filepublic DicomImage read(DicomImage im, java.lang.String directory, java.util.regex.Pattern filePattern, boolean checkSubdirectories, int temporalPosition) throws java.io.IOException
im
- DICOM image to populate, or null to generate a new imagedirectory
- directory from which to load filesfilePattern
- regular expression pattern for accepting files to load. The pattern is
applied to the full absolute file names of files found. If null, all files
are accepted.checkSubdirectories
- whether to recursively search sub-directories for matching filestemporalPosition
- temporal index of slice (identifies stack). If negative, a temporal
position will be extracted from each slice's header information. If
positive or zero, the temporal position will be manually assigned.java.io.IOException
- if there is an error reading a DICOM filepublic DicomImage read(DicomImage im, java.util.List<java.io.File> files) throws java.io.IOException
im
- image to populate (null to generate new image)files
- list of DICOM filesjava.io.IOException
- if there is a read failurepublic DicomImage read(DicomImage im, java.util.List<java.io.File> files, int temporalPosition) throws java.io.IOException
im
- image to populate (null to generate new image)files
- list of DICOM filestemporalPosition
- temporal indexjava.io.IOException
- if there is a read failurepublic java.util.ArrayList<java.io.File> getAllFiles(java.io.File root, java.util.regex.Pattern filePattern, boolean recursive)
public DicomSlice[] readSlices(java.lang.String sliceTitle, java.io.File file) throws java.io.IOException
sliceTitle
- title to assign slicefile
- input filejava.io.IOException
- if there is a read failurepublic DicomHeader readHeader(IntHolder lastTagId, BinaryFileInputStream in, java.lang.String sourceName) throws java.io.IOException
lastTagId
- if non-null, stores the last tagId read from the streamin
- input streamsourceName
- name of the stream source, for error messagesjava.io.IOException
- if there is a read failure