Package ome.io.nio
Class PixelsService
- java.lang.Object
-
- ome.io.nio.AbstractFileSystemService
-
- ome.io.nio.PixelsService
-
- All Implemented Interfaces:
org.springframework.beans.factory.Aware,org.springframework.context.ApplicationEventPublisherAware
public class PixelsService extends AbstractFileSystemService implements org.springframework.context.ApplicationEventPublisherAware
- Since:
- OMERO-Beta1.0
-
-
Field Summary
Fields Modifier and Type Field Description protected BackOffbackOffBackOff implementation for calculating MissingPyramidExceptionsstatic longMEMOIZER_WAITDefault of 100 ms formemoizerWaitprotected java.io.FilememoizerDirectoryLocation where cached data from theMemoizershould be stored.protected java.io.FilememoizerDirectoryLocalRWFor read-only servers, this directory is a local read-write directory for storing memo files.protected longmemoizerWaitTime in ms.static byte[]NULL_PLANENull plane byte array.static intNULL_PLANE_SIZENull plane size constant.static byte[]nullPlaneDeprecated.in favor ofNULL_PLANEstatic java.lang.StringPYRAMID_SUFFIXSuffix for an the image pyramid of a given pixels set.protected FilePathResolverresolverResolver of archived original file paths for pixels sets.protected TileSizessizesTileSizes implementation for default values-
Fields inherited from class ome.io.nio.AbstractFileSystemService
FILES_PATH, PIXELS_PATH, ROOT_DEFAULT, THUMBNAILS_PATH
-
-
Constructor Summary
Constructors Constructor Description PixelsService(java.lang.String path)Constructor.PixelsService(java.lang.String path, boolean isReadOnlyRepo, long memoizerWait, FilePathResolver resolver, BackOff backOff, TileSizes sizes, ome.api.IQuery iQuery)Deprecated.PixelsService(java.lang.String path, boolean isReadOnlyRepo, java.io.File memoizerDirectory, long memoizerWait, FilePathResolver resolver, BackOff backOff, TileSizes sizes, ome.api.IQuery iQuery)PixelsService(java.lang.String path, long memoizerWait, FilePathResolver resolver, BackOff backOff, TileSizes sizes, ome.api.IQuery iQuery)Deprecated.PixelsService(java.lang.String path, java.io.File memoizerDirectory, long memoizerWait, FilePathResolver resolver, BackOff backOff, TileSizes sizes, ome.api.IQuery iQuery)Deprecated.PixelsService(java.lang.String path, java.io.File memoizerDirectory, FilePathResolver resolver, BackOff backOff, TileSizes sizes, ome.api.IQuery iQuery)PixelsService(java.lang.String path, FilePathResolver resolver)Deprecated.PixelsService(java.lang.String path, FilePathResolver resolver, BackOff backOff, TileSizes sizes, ome.api.IQuery iQuery)Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description PixelBuffer_getPixelBuffer(ome.model.core.Pixels pixels, boolean write)protected BfPixelBuffercreateBfPixelBuffer(java.lang.String filePath, int series)Helper method to properly log any exceptions raised by Bio-Formats.protected loci.formats.IFormatReadercreateBfReader()Create anIFormatReaderwith the appropriateReaderWrapperinstances andIFormatReader.setFlattenedResolutions(boolean)set to false.protected BfPixelBuffercreateMinMaxBfPixelBuffer(java.lang.String filePath, int series, loci.formats.meta.IMinMaxStore store)Helper method to properly log any exceptions raised by Bio-Formats and add a min/max calculator wrapper to the reader stack.PixelBuffercreatePixelBuffer(ome.model.core.Pixels pixels)Creates a PixelBuffer for a given pixels set.protected BfPyramidPixelBuffercreatePyramidPixelBuffer(ome.model.core.Pixels pixels, java.lang.String filePath, boolean write)Helper method to properly log any exceptions raised by Bio-Formats.protected PixelBuffercreateRomioPixelBuffer(java.lang.String pixelsFilePath, ome.model.core.Pixels pixels, boolean allowModification)Helper method to properlty create a RomioPixelBuffer.loci.formats.IFormatReadergetBfReader(ome.model.core.Pixels pixels)Short-cut in the FS case where we know that we are dealing with a FS-lite file, and want to retrieve the actual file as opposed to a pyramid or anything else.java.io.FilegetMemoizerDirectory()longgetMemoizerWait()protected java.lang.StringgetOriginalFilePath(ome.model.core.Pixels pixels)Retrieves the original file path for a given set of pixels.PixelBuffergetPixelBuffer(ome.model.core.Pixels pixels)Deprecated.In the future callers should use the more descriptivegetPixelBuffer(Pixels, boolean).PixelBuffergetPixelBuffer(ome.model.core.Pixels pixels, boolean write)Returns a pixel buffer for a given set of pixels.protected intgetSeries(ome.model.core.Pixels pixels)Retrieves the series for a given set of pixels.protected voidhandleMissingPyramid(ome.model.core.Pixels pixels, java.lang.String pixelsPyramidFilePath)If the outer loop should continue, this method returns successfully; otherwise it throws a MissingPyramidException.protected voidhandleMissingStatsInfo(ome.model.core.Pixels pixels)If the outer loop should continue, this method returns successfully; otherwise it throws a MissingPyramidException.ome.model.stats.StatsInfo[]makePyramid(ome.model.core.Pixels pixels)Creates a pixels pyramid for a given set of pixels.voidremovePixels(java.util.List<java.lang.Long> pixelIds)Removes files from data repository based on a parameterized List of Long pixels idsbooleanrequiresPixelsPyramid(ome.model.core.Pixels pixels)Returns whether a pyramid should be used for the givenPixels.voidsetApplicationEventPublisher(org.springframework.context.ApplicationEventPublisher pub)voidsetFilePathResolver(FilePathResolver resolver)voidsetMemoizerDirectoryLocal(java.lang.String path)voidsetMetrics(ome.system.metrics.Metrics metrics)voidsetReaderSecurityCheck(ReaderSecurityCheck check)-
Methods inherited from class ome.io.nio.AbstractFileSystemService
createSubpath, getFilesPath, getPath, getPixelsDirectory, getPixelsPath, getThumbnailPath
-
-
-
-
Field Detail
-
PYRAMID_SUFFIX
public static final java.lang.String PYRAMID_SUFFIX
Suffix for an the image pyramid of a given pixels set.- See Also:
- Constant Field Values
-
NULL_PLANE_SIZE
public static final int NULL_PLANE_SIZE
Null plane size constant.- See Also:
- Constant Field Values
-
NULL_PLANE
public static final byte[] NULL_PLANE
Null plane byte array.
-
MEMOIZER_WAIT
public static final long MEMOIZER_WAIT
Default of 100 ms formemoizerWait- See Also:
- Constant Field Values
-
resolver
protected FilePathResolver resolver
Resolver of archived original file paths for pixels sets.
-
backOff
protected final BackOff backOff
BackOff implementation for calculating MissingPyramidExceptions
-
sizes
protected final TileSizes sizes
TileSizes implementation for default values
-
memoizerDirectory
protected final java.io.File memoizerDirectory
Location where cached data from theMemoizershould be stored.
-
memoizerDirectoryLocalRW
protected java.io.File memoizerDirectoryLocalRW
For read-only servers, this directory is a local read-write directory for storing memo files. May benull.
-
memoizerWait
protected final long memoizerWait
Time in ms. which setId must take before a file is memoized
-
nullPlane
@Deprecated public static final byte[] nullPlane
Deprecated.in favor ofNULL_PLANENull plane byte array.
-
-
Constructor Detail
-
PixelsService
public PixelsService(java.lang.String path)
Constructor.- Parameters:
path- The root of the ROMIO proprietary pixels store. (usually/OMERO/Pixels).
-
PixelsService
@Deprecated public PixelsService(java.lang.String path, FilePathResolver resolver)Deprecated.Constructor.- Parameters:
path- The root of the ROMIO proprietary pixels store. (usually/OMERO/Pixels).
-
PixelsService
public PixelsService(java.lang.String path, FilePathResolver resolver, BackOff backOff, TileSizes sizes, ome.api.IQuery iQuery)Constructor.- Parameters:
path- The root of the ROMIO proprietary pixels store. (usually/OMERO/Pixels).resolver- Original file path resolver for pixels sets.
-
PixelsService
@Deprecated public PixelsService(java.lang.String path, long memoizerWait, FilePathResolver resolver, BackOff backOff, TileSizes sizes, ome.api.IQuery iQuery)Deprecated.
-
PixelsService
@Deprecated public PixelsService(java.lang.String path, boolean isReadOnlyRepo, long memoizerWait, FilePathResolver resolver, BackOff backOff, TileSizes sizes, ome.api.IQuery iQuery)Deprecated.
-
PixelsService
public PixelsService(java.lang.String path, java.io.File memoizerDirectory, FilePathResolver resolver, BackOff backOff, TileSizes sizes, ome.api.IQuery iQuery)
-
PixelsService
@Deprecated public PixelsService(java.lang.String path, java.io.File memoizerDirectory, long memoizerWait, FilePathResolver resolver, BackOff backOff, TileSizes sizes, ome.api.IQuery iQuery)Deprecated.
-
PixelsService
public PixelsService(java.lang.String path, boolean isReadOnlyRepo, java.io.File memoizerDirectory, long memoizerWait, FilePathResolver resolver, BackOff backOff, TileSizes sizes, ome.api.IQuery iQuery)
-
-
Method Detail
-
setMetrics
public void setMetrics(ome.system.metrics.Metrics metrics)
-
setReaderSecurityCheck
public void setReaderSecurityCheck(ReaderSecurityCheck check)
- Parameters:
check- the used files check to apply after subsequentIFormatHandler.setId(String)
-
getMemoizerWait
public long getMemoizerWait()
-
getMemoizerDirectory
public java.io.File getMemoizerDirectory()
-
setApplicationEventPublisher
public void setApplicationEventPublisher(org.springframework.context.ApplicationEventPublisher pub)
- Specified by:
setApplicationEventPublisherin interfaceorg.springframework.context.ApplicationEventPublisherAware
-
setFilePathResolver
public void setFilePathResolver(FilePathResolver resolver)
-
setMemoizerDirectoryLocal
public void setMemoizerDirectoryLocal(java.lang.String path)
-
createPixelBuffer
public PixelBuffer createPixelBuffer(ome.model.core.Pixels pixels) throws java.io.IOException
Creates a PixelBuffer for a given pixels set.- Parameters:
pixels- Pixels set to create a pixel buffer for.- Returns:
- Allocated pixel buffer ready to be used.
- Throws:
java.io.IOException- If there is an I/O error creating the pixel buffer backing file.
-
makePyramid
public ome.model.stats.StatsInfo[] makePyramid(ome.model.core.Pixels pixels)
Creates a pixels pyramid for a given set of pixels. If the pyramid file already exists, then a DEBUG message is logged and this method returns.- Parameters:
pixels- Pixels set to retrieve a pixel buffer for.- Since:
- OMERO-Beta4.3
-
getPixelBuffer
@Deprecated public PixelBuffer getPixelBuffer(ome.model.core.Pixels pixels)
Deprecated.In the future callers should use the more descriptivegetPixelBuffer(Pixels, boolean).Returns a pixel buffer for a given set of pixels. Either a proprietary ROMIO pixel buffer or a specific pixel buffer implementation.- Parameters:
pixels- Pixels set to retrieve a pixel buffer for.- Returns:
- A pixel buffer instance. NOTE: The pixel buffer is initialized as read-write.
- Since:
- OMERO-Beta4.3
- See Also:
getPixelBuffer(Pixels, boolean)
-
getPixelBuffer
public PixelBuffer getPixelBuffer(ome.model.core.Pixels pixels, boolean write)
Returns a pixel buffer for a given set of pixels. Either a proprietary ROMIO pixel buffer or a specific pixel buffer implementation.- Parameters:
pixels- Pixels set to retrieve a pixel buffer for.write- Whether or not to open the pixel buffer as read-write.trueopens as read-write,falseopens as read-only.- Returns:
- A pixel buffer instance.
- Since:
- OMERO-Beta4.3
-
_getPixelBuffer
public PixelBuffer _getPixelBuffer(ome.model.core.Pixels pixels, boolean write)
-
requiresPixelsPyramid
public boolean requiresPixelsPyramid(ome.model.core.Pixels pixels)
Returns whether a pyramid should be used for the givenPixels. This usually implies that this is a "Big image" and therefore will need tiling.- Parameters:
pixels-- Returns:
trueif a pyramid should be used,falseotherwise
-
getOriginalFilePath
protected java.lang.String getOriginalFilePath(ome.model.core.Pixels pixels)
Retrieves the original file path for a given set of pixels.- Parameters:
pixels- Set of pixels to return an orignal file path for.- Returns:
- The original file path or
nullif the original file path could not be located or theresolverhas not been set.
-
getSeries
protected int getSeries(ome.model.core.Pixels pixels)
Retrieves the series for a given set of pixels.- Parameters:
pixels- Set of pixels to return the series for.- Returns:
- The series as specified by the pixels parameters or
0(the first series).
-
handleMissingStatsInfo
protected void handleMissingStatsInfo(ome.model.core.Pixels pixels)
If the outer loop should continue, this method returns successfully; otherwise it throws a MissingPyramidException.- Parameters:
pixels-
-
handleMissingPyramid
protected void handleMissingPyramid(ome.model.core.Pixels pixels, java.lang.String pixelsPyramidFilePath)If the outer loop should continue, this method returns successfully; otherwise it throws a MissingPyramidException.- Parameters:
pixels-pixelsPyramidFilePath-- Throws:
ome.conditions.MissingPyramidException
-
createMinMaxBfPixelBuffer
protected BfPixelBuffer createMinMaxBfPixelBuffer(java.lang.String filePath, int series, loci.formats.meta.IMinMaxStore store)
Helper method to properly log any exceptions raised by Bio-Formats and add a min/max calculator wrapper to the reader stack.- Parameters:
filePath- Non-null.series- series to usestore- Min/max store to use with the min/max calculator.
-
getBfReader
public loci.formats.IFormatReader getBfReader(ome.model.core.Pixels pixels) throws loci.formats.FormatException, java.io.IOExceptionShort-cut in the FS case where we know that we are dealing with a FS-lite file, and want to retrieve the actual file as opposed to a pyramid or anything else. This may be used to access the original metadata.- Throws:
loci.formats.FormatExceptionjava.io.IOException
-
createBfReader
protected loci.formats.IFormatReader createBfReader()
Create anIFormatReaderwith the appropriateReaderWrapperinstances andIFormatReader.setFlattenedResolutions(boolean)set to false.
-
createBfPixelBuffer
protected BfPixelBuffer createBfPixelBuffer(java.lang.String filePath, int series)
Helper method to properly log any exceptions raised by Bio-Formats.- Parameters:
filePath- Non-null.series- series to use- Returns:
- the initialized
BfPixelBuffer
-
createPyramidPixelBuffer
protected BfPyramidPixelBuffer createPyramidPixelBuffer(ome.model.core.Pixels pixels, java.lang.String filePath, boolean write)
Helper method to properly log any exceptions raised by Bio-Formats.- Parameters:
pixels- passed toBfPixelBufferfilePath- Non-null.- Returns:
- the initialized
BfPyramidPixelBuffer
-
createRomioPixelBuffer
protected PixelBuffer createRomioPixelBuffer(java.lang.String pixelsFilePath, ome.model.core.Pixels pixels, boolean allowModification)
Helper method to properlty create a RomioPixelBuffer.- Parameters:
pixelsFilePath-pixels-allowModification-
-
removePixels
public void removePixels(java.util.List<java.lang.Long> pixelIds)
Removes files from data repository based on a parameterized List of Long pixels ids- Parameters:
pixelIds- Long file keys to be deleted- Throws:
ome.conditions.ResourceError- If deletion fails.
-
-