Package loci.formats
Class MinMaxCalculator
java.lang.Object
loci.formats.ReaderWrapper
loci.formats.MinMaxCalculator
- All Implemented Interfaces:
Closeable,AutoCloseable,loci.formats.ICompressedTileReader,loci.formats.IFormatHandler,loci.formats.IFormatReader,loci.formats.IMetadataConfigurable,loci.formats.IPyramidHandler
Logic to compute minimum and maximum values for each channel.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected double[][]Max values for each channel.protected double[][]Min values for each channel.protected int[]Number of planes for which min/max computations have been completed.protected loci.formats.meta.IMinMaxStoreConsumer of channel global minima and maximaprotected double[][]Max values for each plane.protected double[][]Min values for each plane.Fields inherited from class loci.formats.ReaderWrapper
readerFields inherited from interface loci.formats.IFormatReader
CAN_GROUP, CANNOT_GROUP, MUST_GROUP -
Constructor Summary
ConstructorsConstructorDescriptionConstructs a MinMaxCalculator around a new image reader.Constructs a MinMaxCalculator with the given reader. -
Method Summary
Modifier and TypeMethodDescriptionvoidclose(boolean fileOnly) getChannelGlobalMaximum(int theC) Retrieves a specified channel's global maximum.getChannelGlobalMinimum(int theC) Retrieves a specified channel's global minimum.getChannelKnownMaximum(int theC) Retrieves the specified channel's maximum based on the images that have been read.getChannelKnownMinimum(int theC) Retrieves the specified channel's minimum based on the images that have been read.Retrieves the current active min-max store for the calculator.Class<?> Double[]getPlaneMaximum(int no) Retrieves the maximum pixel value for the specified plane.Double[]getPlaneMinimum(int no) Retrieves the minimum pixel value for the specified plane.protected voidEnsures internal min/max variables are initialized properly.booleanReturns true if the values returned by getChannelGlobalMinimum/Maximum can be trusted.static MinMaxCalculatorConverts the given reader into a MinMaxCalculator, wrapping if needed.byte[]openBytes(int no) byte[]openBytes(int no, byte[] buf) byte[]openBytes(int no, byte[] buf, int x, int y, int w, int h) byte[]openBytes(int no, int x, int y, int w, int h) voidSets the active min-max store for the calculator.protected voidupdateMinMax(int no, byte[] buf, int len) Updates min/max values based on the given byte array.Methods inherited from class loci.formats.ReaderWrapper
close, coreIndexToSeries, duplicate, fileGroupOption, get16BitLookupTable, get8BitLookupTable, getAdvancedSeriesUsedFiles, getAdvancedUsedFiles, getBitsPerPixel, getCoreIndex, getCoreMetadataList, getCurrentFile, getDatasetStructureDescription, getDimensionOrder, getDomains, getEffectiveSizeC, getFillColor, 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, getTileCodec, getTileCodecOptions, getTileColumns, getTileRows, 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, openCompressedBytes, openCompressedBytes, openPlane, openThumbBytes, reopenFile, seriesToCoreIndex, setCoreIndex, setFillColor, setFlattenedResolutions, setGroupFiles, setId, setMetadataFiltered, setMetadataOptions, setMetadataStore, setNormalized, setOriginalMetadataPopulated, setResolution, setSeries, unwrap, unwrap, unwrap
-
Field Details
-
chanMin
protected double[][] chanMinMin values for each channel. -
chanMax
protected double[][] chanMaxMax values for each channel. -
planeMin
protected double[][] planeMinMin values for each plane. -
planeMax
protected double[][] planeMaxMax values for each plane. -
minMaxDone
protected int[] minMaxDoneNumber of planes for which min/max computations have been completed. -
minMaxStore
Consumer of channel global minima and maxima
-
-
Constructor Details
-
MinMaxCalculator
public MinMaxCalculator()Constructs a MinMaxCalculator around a new image reader. -
MinMaxCalculator
Constructs a MinMaxCalculator with the given reader.
-
-
Method Details
-
makeMinMaxCalculator
Converts the given reader into a MinMaxCalculator, wrapping if needed. -
setMinMaxStore
Sets the active min-max store for the calculator. Whenever a channel's global minimum and maximum calculation has been completed this store is notified.- Parameters:
store- See above.
-
getMinMaxStore
Retrieves the current active min-max store for the calculator.- Returns:
- See above.
-
getChannelGlobalMinimum
Retrieves a specified channel's global minimum. Returns null if some of the image planes have not been read.- Throws:
IOException- Not actually thrown.loci.formats.FormatException
-
getChannelGlobalMaximum
Retrieves a specified channel's global maximum. Returns null if some of the image planes have not been read.- Throws:
IOException- Not actually thrown.loci.formats.FormatException
-
getChannelKnownMinimum
Retrieves the specified channel's minimum based on the images that have been read. Returns null if no image planes have been read yet.- Throws:
loci.formats.FormatException- Not actually thrown.IOException- Not actually thrown.
-
getChannelKnownMaximum
Retrieves the specified channel's maximum based on the images that have been read. Returns null if no image planes have been read yet.- Throws:
loci.formats.FormatException- Not actually thrown.IOException- Not actually thrown.
-
getPlaneMinimum
Retrieves the minimum pixel value for the specified plane. If each image plane contains more than one channel (i.e.,ReaderWrapper.getRGBChannelCount()> 1), returns the maximum value for each embedded channel. Returns null if the plane has not already been read.- Throws:
loci.formats.FormatException- Not actually thrown.IOException- Not actually thrown.
-
getPlaneMaximum
Retrieves the maximum pixel value for the specified plane. If each image plane contains more than one channel (i.e.,ReaderWrapper.getRGBChannelCount()> 1), returns the maximum value for each embedded channel. Returns null if the plane has not already been read.- Throws:
loci.formats.FormatException- Not actually thrown.IOException- Not actually thrown.
-
isMinMaxPopulated
Returns true if the values returned by getChannelGlobalMinimum/Maximum can be trusted.- Throws:
loci.formats.FormatException- Not actually thrown.IOException- Not actually thrown.
-
openBytes
- Specified by:
openBytesin interfaceloci.formats.IFormatReader- Overrides:
openBytesin classloci.formats.ReaderWrapper- Throws:
loci.formats.FormatExceptionIOException
-
openBytes
- Specified by:
openBytesin interfaceloci.formats.IFormatReader- Overrides:
openBytesin classloci.formats.ReaderWrapper- Throws:
loci.formats.FormatExceptionIOException
-
openBytes
public byte[] openBytes(int no, int x, int y, int w, int h) throws loci.formats.FormatException, IOException - Specified by:
openBytesin interfaceloci.formats.IFormatReader- Overrides:
openBytesin classloci.formats.ReaderWrapper- Throws:
loci.formats.FormatExceptionIOException
-
openBytes
public byte[] openBytes(int no, byte[] buf, int x, int y, int w, int h) throws loci.formats.FormatException, IOException - Specified by:
openBytesin interfaceloci.formats.IFormatReader- Overrides:
openBytesin classloci.formats.ReaderWrapper- Throws:
loci.formats.FormatExceptionIOException
-
close
- Specified by:
closein interfaceloci.formats.IFormatReader- Overrides:
closein classloci.formats.ReaderWrapper- Throws:
IOException
-
getNativeDataType
- Specified by:
getNativeDataTypein interfaceloci.formats.IFormatHandler- Overrides:
getNativeDataTypein classloci.formats.ReaderWrapper
-
updateMinMax
protected void updateMinMax(int no, byte[] buf, int len) throws loci.formats.FormatException, IOException Updates min/max values based on the given byte array.- Parameters:
no- the plane index within the series.buf- a pre-allocated buffer.len- asbufmay be larger than the actual pixel count having been written to it, the length (in bytes) of the those pixels.- Throws:
loci.formats.FormatExceptionIOException
-
initMinMax
Ensures internal min/max variables are initialized properly.- Throws:
loci.formats.FormatException- Not actually thrown.IOException- Not actually thrown.
-