public class DicomReader extends FormatReader
Modifier and Type | Field and Description |
---|---|
private static int |
AE |
private static int |
AS |
private static int |
AT |
private boolean |
bigEndianTransferSyntax |
private static int |
BITS_ALLOCATED |
private int |
bitsPerPixel
Bits per pixel.
|
private int |
centerPixelValue |
private static int |
COLUMNS |
private java.util.List<java.lang.String> |
companionFiles |
private static int |
CS |
private static int |
DA |
private java.lang.String |
date |
static java.lang.String |
DICOM_MAGIC_STRING |
private static java.lang.String[] |
DICOM_SUFFIXES |
private static int |
DS |
private static int |
DT |
private int |
elementLength |
private static int |
FD |
private java.util.Map<java.lang.Integer,java.util.List<java.lang.String>> |
fileList |
private static int |
FL |
private DicomReader |
helper |
private static int |
ICON_IMAGE_SEQUENCE |
private int |
imagesPerFile |
private java.lang.String |
imageType |
private static int |
IMPLICIT_VR |
private boolean |
inSequence |
private boolean |
inverted |
private static int |
IS |
private boolean |
isDeflate |
private boolean |
isJP2K |
private boolean |
isJPEG |
private boolean |
isRLE |
private static int |
ITEM |
private static int |
ITEM_DELIMINATION |
private static int |
LO |
private int |
location |
private static int |
LT |
private byte[][] |
lut |
private int |
maxPixelRange |
private static int |
NUMBER_OF_FRAMES |
private static int |
OB |
private boolean |
oddLocations |
private long[] |
offsets |
private java.lang.String |
originalDate |
private java.lang.String |
originalInstance |
private int |
originalSeries |
private java.lang.String |
originalTime |
private int |
originalX |
private int |
originalY |
private static int |
OW |
private static int |
PHOTOMETRIC_INTERPRETATION |
private static int |
PIXEL_DATA |
private static int |
PIXEL_REPRESENTATION |
private static int |
PIXEL_SIGN |
private static int |
PIXEL_SPACING |
private java.lang.String |
pixelSizeX |
private java.lang.String |
pixelSizeY |
private java.lang.Double |
pixelSizeZ |
private static int |
PLANAR_CONFIGURATION |
private static int |
PN |
private java.util.List<java.lang.Double> |
positionX |
private java.util.List<java.lang.Double> |
positionY |
private java.util.List<java.lang.Double> |
positionZ |
private static int |
QQ |
private static int |
RESCALE_INTERCEPT |
private static int |
RESCALE_SLOPE |
private double |
rescaleIntercept |
private double |
rescaleSlope |
private static int |
ROWS |
private static int |
SAMPLES_PER_PIXEL |
private static int |
SEQUENCE_DELIMINATION |
private static int |
SH |
private short[][] |
shortLut |
private static int |
SL |
private static int |
SLICE_SPACING |
private static int |
SQ |
private static int |
SS |
private static int |
ST |
private java.lang.String |
time |
private static int |
TM |
private static int |
TRANSFER_SYNTAX_UID |
private static com.google.common.collect.ImmutableMap<java.lang.Integer,java.lang.String> |
TYPES |
private static int |
UI |
private static int |
UL |
private static int |
UN |
private static int |
US |
private static int |
UT |
private int |
vr |
private static int |
WINDOW_CENTER |
private static int |
WINDOW_WIDTH |
core, coreIndex, datasetDescription, domains, filterMetadata, flattenedResolutions, group, hasCompanionFiles, in, indexedAsRGB, metadata, metadataStore, normalizeData, resolution, saveOriginalMetadata, series, suffixNecessary, suffixSufficient, THUMBNAIL_DIMENSION
COMPRESSION_SUFFIXES, currentId, format, LOGGER, metadataOptions, suffixes
CAN_GROUP, CANNOT_GROUP, MUST_GROUP
Constructor and Description |
---|
DicomReader()
Constructs a new DICOM reader.
|
Modifier and Type | Method and Description |
---|---|
private void |
addFileToList(java.lang.String file,
boolean checkSeries)
Determine if the given file belongs in the same dataset as this file.
|
private void |
addInfo(int tag,
int value) |
private void |
addInfo(int tag,
java.lang.String value) |
private void |
attachCompanionFiles()
DICOM datasets produced by:
http://www.ct-imaging.de/index.php/en/ct-systeme-e/mikro-ct-e.html
contain a bunch of extra metadata and log files.
|
private static com.google.common.collect.ImmutableMap<java.lang.Integer,java.lang.String> |
buildTypes()
Assemble the data dictionary.
|
void |
close(boolean fileOnly)
Closes the currently open file.
|
int |
fileGroupOption(java.lang.String id)
Returns an indication of whether the files in a multi-file dataset can
be handled individually.
|
private java.lang.String |
formatTag(int tag) |
short[][] |
get16BitLookupTable()
Gets the 16-bit color lookup table associated with
the most recently opened image.
|
byte[][] |
get8BitLookupTable()
Gets the 8-bit color lookup table associated with
the most recently opened image.
|
private java.lang.String |
getHeaderInfo(int tag,
java.lang.String value) |
private int |
getLength(loci.common.RandomAccessInputStream stream,
int tag) |
private int |
getNextTag(loci.common.RandomAccessInputStream stream) |
private int |
getNextTag(loci.common.RandomAccessInputStream stream,
boolean setMetadata) |
int |
getRequiredDirectories(java.lang.String[] files)
Returns the number of parent directories that are important when
processing the given list of files.
|
java.lang.String[] |
getSeriesUsedFiles(boolean noPixels)
Returns an array of filenames needed to open the current series.
|
protected void |
initFile(java.lang.String id)
Initializes the given file (parsing header information, etc.).
|
boolean |
isThisType(loci.common.RandomAccessInputStream stream)
Checks if the given stream is a valid stream for this file format.
|
boolean |
isThisType(java.lang.String name,
boolean open)
Checks if a file matches the type of this format reader.
|
private void |
makeFileList() |
byte[] |
openBytes(int no,
byte[] buf,
int x,
int y,
int w,
int h)
Obtains a sub-image of the specified image plane
into a pre-allocated byte array.
|
private void |
scanDirectory(loci.common.Location dir,
boolean checkSeries)
Scan the given directory for files that belong to this dataset.
|
addGlobalMeta, addGlobalMeta, addGlobalMeta, addGlobalMeta, addGlobalMeta, addGlobalMeta, addGlobalMeta, addGlobalMeta, addGlobalMeta, addGlobalMetaList, addMeta, addMetaList, addSeriesMeta, addSeriesMeta, addSeriesMeta, addSeriesMeta, addSeriesMeta, addSeriesMeta, addSeriesMeta, addSeriesMeta, addSeriesMeta, addSeriesMetaList, close, coreIndexToSeries, flattenHashtables, getAcquisitionMode, getAdvancedSeriesUsedFiles, getAdvancedUsedFiles, getArcType, getBinning, getBitsPerPixel, getCompression, getContrastMethod, getCoreIndex, getCoreMetadataList, getCorrection, getCurrentCore, getCurrentFile, getDatasetStructureDescription, getDetectorType, getDimensionOrder, getDimensionOrder, getDomains, getEffectiveSizeC, getExperimentType, getFilamentType, getFillRule, getFilterType, getFontFamily, getFontStyle, getGlobalMeta, getGlobalMetadata, getIlluminationType, getImageCount, getImmersion, getIndex, getIndex, getLaserMedium, getLaserType, getMarker, getMedium, getMetadataStore, getMetadataStoreRoot, getMetadataValue, getMicrobeamManipulationType, getMicroscopeType, getModuloC, getModuloT, getModuloZ, getNamingConvention, getOptimalTileHeight, getOptimalTileWidth, getPixelType, getPixelType, getPossibleDomains, getPulse, getResolution, getResolutionCount, getRGBChannelCount, getRotationTransform, getSeries, getSeriesCount, getSeriesMeta, getSeriesMetadata, getSeriesMetadataValue, getSeriesUsedFiles, getSizeC, getSizeT, getSizeX, getSizeY, getSizeZ, getThumbSizeX, getThumbSizeY, getUnderlyingReaders, getUsedFiles, getUsedFiles, getZCTCoords, getZCTModuloCoords, hasCompanionFiles, hasFlattenedResolutions, isFalseColor, isGroupFiles, isIndexed, isInterleaved, isInterleaved, isLittleEndian, isMetadataComplete, isMetadataFiltered, isNormalized, isOrderCertain, isOriginalMetadataPopulated, isRGB, isSingleFile, isThisType, isThisType, isThumbnailSeries, isUsedFile, makeFilterMetadata, openBytes, openBytes, openBytes, openPlane, openThumbBytes, readPlane, readPlane, reopenFile, seriesToCoreIndex, setCoreIndex, setFlattenedResolutions, setGroupFiles, setId, setMetadataFiltered, setMetadataStore, setNormalized, setOriginalMetadataPopulated, setResolution, setSeries, updateMetadataLists
checkSuffix, checkSuffix, getFormat, getMetadataOptions, getNativeDataType, getSuffixes, getSupportedMetadataLevels, setMetadataOptions
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getFormat, getNativeDataType, getSuffixes
getMetadataOptions, getSupportedMetadataLevels, setMetadataOptions
public static final java.lang.String DICOM_MAGIC_STRING
private static final java.lang.String[] DICOM_SUFFIXES
private static final com.google.common.collect.ImmutableMap<java.lang.Integer,java.lang.String> TYPES
private static final int PIXEL_REPRESENTATION
private static final int PIXEL_SIGN
private static final int TRANSFER_SYNTAX_UID
private static final int SLICE_SPACING
private static final int SAMPLES_PER_PIXEL
private static final int PHOTOMETRIC_INTERPRETATION
private static final int PLANAR_CONFIGURATION
private static final int NUMBER_OF_FRAMES
private static final int ROWS
private static final int COLUMNS
private static final int PIXEL_SPACING
private static final int BITS_ALLOCATED
private static final int WINDOW_CENTER
private static final int WINDOW_WIDTH
private static final int RESCALE_INTERCEPT
private static final int RESCALE_SLOPE
private static final int ICON_IMAGE_SEQUENCE
private static final int ITEM
private static final int ITEM_DELIMINATION
private static final int SEQUENCE_DELIMINATION
private static final int PIXEL_DATA
private static final int AE
private static final int AS
private static final int AT
private static final int CS
private static final int DA
private static final int DS
private static final int DT
private static final int FD
private static final int FL
private static final int IS
private static final int LO
private static final int LT
private static final int PN
private static final int SH
private static final int SL
private static final int SS
private static final int ST
private static final int TM
private static final int UI
private static final int UL
private static final int US
private static final int UT
private static final int OB
private static final int OW
private static final int SQ
private static final int UN
private static final int QQ
private static final int IMPLICIT_VR
private int bitsPerPixel
private int location
private int elementLength
private int vr
private boolean oddLocations
private boolean inSequence
private boolean bigEndianTransferSyntax
private byte[][] lut
private short[][] shortLut
private long[] offsets
private int maxPixelRange
private int centerPixelValue
private double rescaleSlope
private double rescaleIntercept
private boolean isJP2K
private boolean isJPEG
private boolean isRLE
private boolean isDeflate
private boolean inverted
private java.lang.String date
private java.lang.String time
private java.lang.String imageType
private java.lang.String pixelSizeX
private java.lang.String pixelSizeY
private java.lang.Double pixelSizeZ
private java.util.List<java.lang.Double> positionX
private java.util.List<java.lang.Double> positionY
private java.util.List<java.lang.Double> positionZ
private java.util.Map<java.lang.Integer,java.util.List<java.lang.String>> fileList
private int imagesPerFile
private java.lang.String originalDate
private java.lang.String originalTime
private java.lang.String originalInstance
private int originalSeries
private int originalX
private int originalY
private DicomReader helper
private java.util.List<java.lang.String> companionFiles
public boolean isThisType(java.lang.String name, boolean open)
FormatReader
FormatReader.isThisType(RandomAccessInputStream)
.isThisType
in interface IFormatReader
isThisType
in class FormatReader
open
- If true, and the file extension is insufficient to determine
the file type, the (existing) file is opened for further analysis.public boolean isThisType(loci.common.RandomAccessInputStream stream) throws java.io.IOException
IFormatReader
isThisType
in interface IFormatReader
isThisType
in class FormatReader
stream
- A RandomAccessInputStream representing the file to check.
The first byte in the stream is assumed to be the first byte
in the file.java.io.IOException
public int getRequiredDirectories(java.lang.String[] files) throws FormatException, java.io.IOException
IFormatReader
getRequiredDirectories
in interface IFormatReader
getRequiredDirectories
in class FormatReader
FormatException
java.io.IOException
public byte[][] get8BitLookupTable()
IFormatReader
IFormatReader.isIndexed()
returns
false, then this may return null. Also, if IFormatReader.getPixelType()
returns
anything other than FormatTools.INT8
or FormatTools.UINT8
,
this method will return null.get8BitLookupTable
in interface IFormatReader
get8BitLookupTable
in class FormatReader
public short[][] get16BitLookupTable()
IFormatReader
IFormatReader.isIndexed()
returns
false, then this may return null. Also, if IFormatReader.getPixelType()
returns
anything other than FormatTools.INT16
or FormatTools.UINT16
, this method will return null.get16BitLookupTable
in interface IFormatReader
get16BitLookupTable
in class FormatReader
public java.lang.String[] getSeriesUsedFiles(boolean noPixels)
IFormatReader
IFormatHandler.setId(String)
, if appropriate based upon 'noPixels'.
The remaining elements are expected to be in a consistent order;
if a directory listing is necessary to build the list then it should
be sorted first.getSeriesUsedFiles
in interface IFormatReader
getSeriesUsedFiles
in class FormatReader
public int fileGroupOption(java.lang.String id) throws FormatException, java.io.IOException
IFormatReader
fileGroupOption
in interface IFormatReader
fileGroupOption
in class FormatReader
id
- a file in the multi-file datasetFormatTools.MUST_GROUP
indicates that the
files cannot be handled separately; the reader will always detect and
read all files in the dataset. FormatTools.CAN_GROUP
indicates
that the files may be handled separately, but file grouping must then
be disabled via IFormatReader.setGroupFiles(boolean)
.
FormatTools.CANNOT_GROUP
indicates that the files must be handled
separately; the reader will not attempt to read all files in the dataset
(this is rare).FormatException
java.io.IOException
FormatTools.MUST_GROUP
,
FormatTools.CAN_GROUP
,
FormatTools.CANNOT_GROUP
public byte[] openBytes(int no, byte[] buf, int x, int y, int w, int h) throws FormatException, java.io.IOException
IFormatReader
openBytes
in interface IFormatReader
openBytes
in class FormatReader
no
- the image index within the file.buf
- a pre-allocated buffer.x
- X coordinate of the upper-left corner of the sub-imagey
- Y coordinate of the upper-left corner of the sub-imagew
- width of the sub-imageh
- height of the sub-imagebuf
for convenience.FormatException
- if there was a problem parsing the metadata of the
file.java.io.IOException
- if there was a problem reading the file.IFormatReader.openBytes(int, byte[], int, int, int, int)
public void close(boolean fileOnly) throws java.io.IOException
IFormatReader
Closeable.close()
.close
in interface IFormatReader
close
in class FormatReader
java.io.IOException
protected void initFile(java.lang.String id) throws FormatException, java.io.IOException
FormatReader
initFile
in class FormatReader
FormatException
- if a parsing error occurs processing the file.java.io.IOException
- if an I/O error occurs processing the fileprivate void addInfo(int tag, java.lang.String value) throws java.io.IOException
java.io.IOException
private void addInfo(int tag, int value) throws java.io.IOException
java.io.IOException
private java.lang.String getHeaderInfo(int tag, java.lang.String value) throws java.io.IOException
java.io.IOException
private int getLength(loci.common.RandomAccessInputStream stream, int tag) throws java.io.IOException
java.io.IOException
private int getNextTag(loci.common.RandomAccessInputStream stream) throws FormatException, java.io.IOException
FormatException
java.io.IOException
private int getNextTag(loci.common.RandomAccessInputStream stream, boolean setMetadata) throws FormatException, java.io.IOException
FormatException
java.io.IOException
private void makeFileList() throws FormatException, java.io.IOException
FormatException
java.io.IOException
private void scanDirectory(loci.common.Location dir, boolean checkSeries) throws FormatException, java.io.IOException
FormatException
java.io.IOException
private void addFileToList(java.lang.String file, boolean checkSeries) throws FormatException, java.io.IOException
FormatException
java.io.IOException
private java.lang.String formatTag(int tag)
private void attachCompanionFiles() throws java.io.IOException
java.io.IOException
private static com.google.common.collect.ImmutableMap<java.lang.Integer,java.lang.String> buildTypes()
Copyright © 2020 Open Microscopy Environment