ome.io.nio
Class PixelsService

java.lang.Object
  extended by ome.io.nio.AbstractFileSystemService
      extended by ome.io.nio.PixelsService
All Implemented Interfaces:
org.springframework.context.ApplicationEventPublisherAware

public class PixelsService
extends AbstractFileSystemService
implements org.springframework.context.ApplicationEventPublisherAware

Since:
OMERO-Beta1.0
Version:
3.0 (Internal version: $Revision$ $Date$)
Author:

Chris Allan     callan@blackcat.ca

Field Summary
protected  BackOff backOff
          BackOff implementation for calculating MissingPyramidExceptions
static String DV_FORMAT
          The DeltaVision file format enumeration value
static int NULL_PLANE_SIZE
          Null plane size constant.
static byte[] nullPlane
          Null plane byte array.
static String PYRAMID_SUFFIX
          Suffix for an the image pyramid of a given pixels set.
protected  FilePathResolver resolver
          Resolver of archived original file paths for pixels sets.
protected  TileSizes sizes
          TileSizes implementation for default values
 
Fields inherited from class ome.io.nio.AbstractFileSystemService
FILES_PATH, PIXELS_PATH, ROOT_DEFAULT, THUMBNAILS_PATH
 
Constructor Summary
PixelsService(String path)
          Constructor.
PixelsService(String path, FilePathResolver resolver)
          Constructor.
PixelsService(String path, FilePathResolver resolver, BackOff backOff, TileSizes sizes)
          Constructor.
 
Method Summary
protected  PixelBuffer createBfPixelBuffer(String filePath, int series)
          Helper method to properly log any exceptions raised by Bio-Formats.
protected  BfPixelBuffer createMinMaxBfPixelBuffer(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.
 PixelBuffer createPixelBuffer(ome.model.core.Pixels pixels)
          Creates a PixelBuffer for a given pixels set.
protected  BfPyramidPixelBuffer createPyramidPixelBuffer(ome.model.core.Pixels pixels, String filePath, boolean write)
          Helper method to properly log any exceptions raised by Bio-Formats.
protected  PixelBuffer createRomioPixelBuffer(String pixelsFilePath, ome.model.core.Pixels pixels, boolean allowModification)
          Helper method to properlty create a RomioPixelBuffer.
protected  String getOriginalFilePath(ome.model.core.Pixels pixels)
          Retrieves the original file path for a given set of pixels.
 PixelBuffer getPixelBuffer(ome.model.core.Pixels pixels)
          Deprecated. In the future callers should use the more descriptive getPixelBuffer(Pixels, boolean).
 PixelBuffer getPixelBuffer(ome.model.core.Pixels pixels, boolean write)
          Returns a pixel buffer for a given set of pixels.
protected  int getSeries(ome.model.core.Pixels pixels)
          Retrieves the series for a given set of pixels.
protected  void handleMissingPyramid(ome.model.core.Pixels pixels, String pixelsPyramidFilePath)
          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.
 void removePixels(List<Long> pixelIds)
          Removes files from data repository based on a parameterized List of Long pixels ids
 boolean requiresPixelsPyramid(ome.model.core.Pixels pixels)
          Returns true if a pyramid should be used for the given Pixels.
 void setApplicationEventPublisher(org.springframework.context.ApplicationEventPublisher pub)
           
 void setFilePathResolver(FilePathResolver resolver)
           
 
Methods inherited from class ome.io.nio.AbstractFileSystemService
createSubpath, getFilesPath, getPixelsPath, getThumbnailPath
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DV_FORMAT

public static final String DV_FORMAT
The DeltaVision file format enumeration value

See Also:
Constant Field Values

PYRAMID_SUFFIX

public static final 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

resolver

protected FilePathResolver resolver
Resolver of archived original file paths for pixels sets.


backOff

protected BackOff backOff
BackOff implementation for calculating MissingPyramidExceptions


sizes

protected TileSizes sizes
TileSizes implementation for default values


nullPlane

public static final byte[] nullPlane
Null plane byte array.

Constructor Detail

PixelsService

public PixelsService(String path)
Constructor.

Parameters:
path - The root of the ROMIO proprietary pixels store. (usually /OMERO/Pixels).

PixelsService

public PixelsService(String path,
                     FilePathResolver resolver)
Constructor.

Parameters:
path - The root of the ROMIO proprietary pixels store. (usually /OMERO/Pixels).

PixelsService

public PixelsService(String path,
                     FilePathResolver resolver,
                     BackOff backOff,
                     TileSizes sizes)
Constructor.

Parameters:
path - The root of the ROMIO proprietary pixels store. (usually /OMERO/Pixels).
resolver - Original file path resolver for pixels sets.
Method Detail

setApplicationEventPublisher

public void setApplicationEventPublisher(org.springframework.context.ApplicationEventPublisher pub)
Specified by:
setApplicationEventPublisher in interface org.springframework.context.ApplicationEventPublisherAware

setFilePathResolver

public void setFilePathResolver(FilePathResolver resolver)

createPixelBuffer

public PixelBuffer createPixelBuffer(ome.model.core.Pixels pixels)
                              throws 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:
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 descriptive getPixelBuffer(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. true opens as read-write, false opens as read-only.
Returns:
A pixel buffer instance.
Since:
OMERO-Beta4.3

requiresPixelsPyramid

public boolean requiresPixelsPyramid(ome.model.core.Pixels pixels)
Returns true if a pyramid should be used for the given Pixels. This usually implies that this is a "Big image" and therefore will need tiling.

Parameters:
pixels -
Returns:

getOriginalFilePath

protected 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 null if the original file path could not be located or the resolver has 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).

handleMissingPyramid

protected void handleMissingPyramid(ome.model.core.Pixels pixels,
                                    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(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.
store - Min/max store to use with the min/max calculator.
series - series to use
reader - passed to BfPixelBuffer
Returns:

createBfPixelBuffer

protected PixelBuffer createBfPixelBuffer(String filePath,
                                          int series)
Helper method to properly log any exceptions raised by Bio-Formats.

Parameters:
filePath - Non-null.
reader - passed to BfPixelBuffer
series - series to use
Returns:

createPyramidPixelBuffer

protected BfPyramidPixelBuffer createPyramidPixelBuffer(ome.model.core.Pixels pixels,
                                                        String filePath,
                                                        boolean write)
Helper method to properly log any exceptions raised by Bio-Formats.

Parameters:
filePath - Non-null.
reader - passed to BfPixelBuffer
Returns:

createRomioPixelBuffer

protected PixelBuffer createRomioPixelBuffer(String pixelsFilePath,
                                             ome.model.core.Pixels pixels,
                                             boolean allowModification)
Helper method to properlty create a RomioPixelBuffer.

Parameters:
pixelsFilePath -
pixels -
allowModification -
Returns:

removePixels

public void removePixels(List<Long> pixelIds)
Removes files from data repository based on a parameterized List of Long pixels ids

Parameters:
pixelsIds - Long file keys to be deleted
Throws:
ome.conditions.ResourceError - If deletion fails.


OmeroJava Api

Version: 4.3.3-00d1137e-b2894

Copyright © 2009 The University of Dundee. All Rights Reserved.