public class MinMaxCalculator extends ReaderWrapper
Modifier and Type | Field and Description |
---|---|
protected double[][] |
chanMax
Max values for each channel.
|
protected double[][] |
chanMin
Min values for each channel.
|
protected int[] |
minMaxDone
Number of planes for which min/max computations have been completed.
|
protected IMinMaxStore |
minMaxStore
Consumer of channel global minima and maxima
|
protected double[][] |
planeMax
Max values for each plane.
|
protected double[][] |
planeMin
Min values for each plane.
|
reader
CAN_GROUP, CANNOT_GROUP, MUST_GROUP
Constructor and Description |
---|
MinMaxCalculator()
Constructs a MinMaxCalculator around a new image reader.
|
MinMaxCalculator(IFormatReader r)
Constructs a MinMaxCalculator with the given reader.
|
Modifier and Type | Method and Description |
---|---|
void |
close(boolean fileOnly)
Closes the currently open file.
|
java.lang.Double |
getChannelGlobalMaximum(int theC)
Retrieves a specified channel's global maximum.
|
java.lang.Double |
getChannelGlobalMinimum(int theC)
Retrieves a specified channel's global minimum.
|
java.lang.Double |
getChannelKnownMaximum(int theC)
Retrieves the specified channel's maximum based on the images that
have been read.
|
java.lang.Double |
getChannelKnownMinimum(int theC)
Retrieves the specified channel's minimum based on the images that have
been read.
|
IMinMaxStore |
getMinMaxStore()
Retrieves the current active min-max store for the calculator.
|
java.lang.Class<?> |
getNativeDataType()
Returns the native data type of image planes for this reader, as returned
by
IFormatReader.openPlane(int, int, int, int, int) or IFormatWriter.savePlane(int, java.lang.Object) . |
java.lang.Double[] |
getPlaneMaximum(int no)
Retrieves the maximum pixel value for the specified plane.
|
java.lang.Double[] |
getPlaneMinimum(int no)
Retrieves the minimum pixel value for the specified plane.
|
protected void |
initMinMax()
Ensures internal min/max variables are initialized properly.
|
boolean |
isMinMaxPopulated()
Returns true if the values returned by
getChannelGlobalMinimum/Maximum can be trusted.
|
static MinMaxCalculator |
makeMinMaxCalculator(IFormatReader r)
Converts the given reader into a MinMaxCalculator, wrapping if needed.
|
byte[] |
openBytes(int no)
Obtains the specified image plane from the current file as a byte array.
|
byte[] |
openBytes(int no,
byte[] buf)
Obtains the specified image plane from the current file into a
pre-allocated byte array of
(sizeX * sizeY * bytesPerPixel * RGB channel count).
|
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.
|
byte[] |
openBytes(int no,
int x,
int y,
int w,
int h)
Obtains a sub-image of the specified image plane,
whose upper-left corner is given by (x, y).
|
void |
setMinMaxStore(IMinMaxStore store)
Sets the active min-max store for the calculator.
|
protected void |
updateMinMax(int no,
byte[] buf,
int len)
Updates min/max values based on the given byte array.
|
close, coreIndexToSeries, duplicate, fileGroupOption, get16BitLookupTable, get8BitLookupTable, getAdvancedSeriesUsedFiles, getAdvancedUsedFiles, getBitsPerPixel, getCoreIndex, getCoreMetadataList, getCurrentFile, getDatasetStructureDescription, getDimensionOrder, getDomains, getEffectiveSizeC, getFormat, getGlobalMetadata, getImageCount, getIndex, getIndex, getMetadataOptions, getMetadataStore, getMetadataStoreRoot, getMetadataValue, getModuloC, getModuloT, getModuloZ, getOptimalTileHeight, getOptimalTileWidth, getPixelType, getPossibleDomains, getReader, getRequiredDirectories, getResolution, getResolutionCount, getRGBChannelCount, getSeries, getSeriesCount, getSeriesMetadata, getSeriesMetadataValue, getSeriesUsedFiles, getSeriesUsedFiles, getSizeC, getSizeT, getSizeX, getSizeY, getSizeZ, getSuffixes, getSupportedMetadataLevels, getThumbSizeX, getThumbSizeY, getUnderlyingReaders, getUsedFiles, getUsedFiles, getZCTCoords, getZCTModuloCoords, hasCompanionFiles, hasFlattenedResolutions, isFalseColor, isGroupFiles, isIndexed, isInterleaved, isInterleaved, isLittleEndian, isMetadataComplete, isMetadataFiltered, isNormalized, isOrderCertain, isOriginalMetadataPopulated, isRGB, isSingleFile, isThisType, isThisType, isThisType, isThisType, isThumbnailSeries, openPlane, openThumbBytes, reopenFile, seriesToCoreIndex, setCoreIndex, setFlattenedResolutions, setGroupFiles, setId, setMetadataFiltered, setMetadataOptions, setMetadataStore, setNormalized, setOriginalMetadataPopulated, setResolution, setSeries, unwrap, unwrap, unwrap
protected double[][] chanMin
protected double[][] chanMax
protected double[][] planeMin
protected double[][] planeMax
protected int[] minMaxDone
protected IMinMaxStore minMaxStore
public MinMaxCalculator()
public MinMaxCalculator(IFormatReader r)
public static MinMaxCalculator makeMinMaxCalculator(IFormatReader r)
public void setMinMaxStore(IMinMaxStore store)
store
- See above.public IMinMaxStore getMinMaxStore()
public java.lang.Double getChannelGlobalMinimum(int theC) throws FormatException, java.io.IOException
java.io.IOException
- Not actually thrown.FormatException
public java.lang.Double getChannelGlobalMaximum(int theC) throws FormatException, java.io.IOException
java.io.IOException
- Not actually thrown.FormatException
public java.lang.Double getChannelKnownMinimum(int theC) throws FormatException, java.io.IOException
FormatException
- Not actually thrown.java.io.IOException
- Not actually thrown.public java.lang.Double getChannelKnownMaximum(int theC) throws FormatException, java.io.IOException
FormatException
- Not actually thrown.java.io.IOException
- Not actually thrown.public java.lang.Double[] getPlaneMinimum(int no) throws FormatException, java.io.IOException
ReaderWrapper.getRGBChannelCount()
> 1), returns the maximum value for each
embedded channel. Returns null if the plane has not already been read.FormatException
- Not actually thrown.java.io.IOException
- Not actually thrown.public java.lang.Double[] getPlaneMaximum(int no) throws FormatException, java.io.IOException
ReaderWrapper.getRGBChannelCount()
> 1), returns the maximum value for each
embedded channel. Returns null if the plane has not already been read.FormatException
- Not actually thrown.java.io.IOException
- Not actually thrown.public boolean isMinMaxPopulated() throws FormatException, java.io.IOException
FormatException
- Not actually thrown.java.io.IOException
- Not actually thrown.public byte[] openBytes(int no) throws FormatException, java.io.IOException
IFormatReader
openBytes
in interface IFormatReader
openBytes
in class ReaderWrapper
FormatException
java.io.IOException
IFormatReader.openBytes(int, byte[])
public byte[] openBytes(int no, byte[] buf) throws FormatException, java.io.IOException
IFormatReader
openBytes
in interface IFormatReader
openBytes
in class ReaderWrapper
no
- the image index within the file.buf
- a pre-allocated buffer.buf
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.public byte[] openBytes(int no, int x, int y, int w, int h) throws FormatException, java.io.IOException
IFormatReader
openBytes
in interface IFormatReader
openBytes
in class ReaderWrapper
FormatException
java.io.IOException
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 ReaderWrapper
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.public void close(boolean fileOnly) throws java.io.IOException
IFormatReader
Closeable.close()
.close
in interface IFormatReader
close
in class ReaderWrapper
java.io.IOException
public java.lang.Class<?> getNativeDataType()
IFormatHandler
IFormatReader.openPlane(int, int, int, int, int)
or IFormatWriter.savePlane(int, java.lang.Object)
.
For most readers this type will be a byte array; however, some readers
call external APIs that work with other types such as
BufferedImage
.getNativeDataType
in interface IFormatHandler
getNativeDataType
in class ReaderWrapper
protected void updateMinMax(int no, byte[] buf, int len) throws FormatException, java.io.IOException
no
- the image index within the file.buf
- a pre-allocated buffer.len
- as buf
may be larger than the actual pixel count
having been written to it, the length (in bytes) of the those pixels.FormatException
java.io.IOException
protected void initMinMax() throws FormatException, java.io.IOException
FormatException
- Not actually thrown.java.io.IOException
- Not actually thrown.Copyright © 2018 Open Microscopy Environment