Package omero.gateway.rnd
Class DataSink
- java.lang.Object
-
- omero.gateway.rnd.DataSink
-
- All Implemented Interfaces:
java.lang.AutoCloseable
public class DataSink extends java.lang.Object implements java.lang.AutoCloseableEncapsulates access to the image raw data. Contains the logic to interpret a linear byte array as a 5D array. Knows how to extract a 2D-plane from the 5D array, but delegates to the specified 2D-Plane the retrieval of pixel values.- Since:
- OME3.0
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.StringDOUBLEIdentifies the type used to store pixel values.static java.lang.StringFLOATIdentifies the type used to store pixel values.static java.lang.StringINT_16Identifies the type used to store pixel values.static java.lang.StringINT_32Identifies the type used to store pixel values.static java.lang.StringINT_8Identifies the type used to store pixel values.static java.lang.StringUINT_16Identifies the type used to store pixel values.static java.lang.StringUINT_32Identifies the type used to store pixel values.static java.lang.StringUINT_8Identifies the type used to store pixel values.
-
Constructor Summary
Constructors Constructor Description DataSink(SecurityContext ctx, PixelsData source, Gateway gw)Creates a new instance.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclose()java.util.Map<java.lang.Integer,int[]>getHistogram(int[] channels, int binCount, boolean globalRange, omero.romio.PlaneDef plane)Get the histogram data for the given image.Plane2DgetPlane(int z, int t, int c)Extracts a 2D plane from the pixels set this object is working for.java.util.List<omero.api.ResolutionDescription>getResolutionDescriptions()Get the available resolution descriptionsPlane2DgetTile(int z, int t, int c, int x, int y, int w, int h)Extracts a 2D tile from the pixels set this object is working for.booleanisSame(long pixelsID)Returnstrueif a data source has already been created for the specified pixels set,falseotherwise.intsetResolutionLevel(int level)Set the resolution level and returns the previous one.
-
-
-
Field Detail
-
INT_8
public static final java.lang.String INT_8
Identifies the type used to store pixel values.- See Also:
- Constant Field Values
-
UINT_8
public static final java.lang.String UINT_8
Identifies the type used to store pixel values.- See Also:
- Constant Field Values
-
INT_16
public static final java.lang.String INT_16
Identifies the type used to store pixel values.- See Also:
- Constant Field Values
-
UINT_16
public static final java.lang.String UINT_16
Identifies the type used to store pixel values.- See Also:
- Constant Field Values
-
INT_32
public static final java.lang.String INT_32
Identifies the type used to store pixel values.- See Also:
- Constant Field Values
-
UINT_32
public static final java.lang.String UINT_32
Identifies the type used to store pixel values.- See Also:
- Constant Field Values
-
FLOAT
public static final java.lang.String FLOAT
Identifies the type used to store pixel values.- See Also:
- Constant Field Values
-
DOUBLE
public static final java.lang.String DOUBLE
Identifies the type used to store pixel values.- See Also:
- Constant Field Values
-
-
Constructor Detail
-
DataSink
public DataSink(SecurityContext ctx, PixelsData source, Gateway gw) throws DSOutOfServiceException
Creates a new instance.- Parameters:
ctx- The SecurityContextsource- The pixels set.gw- Reference to the gateway.- Throws:
DSOutOfServiceException- If the PixelsStore can't be accessed
-
-
Method Detail
-
getTile
public Plane2D getTile(int z, int t, int c, int x, int y, int w, int h) throws DataSourceException
Extracts a 2D tile from the pixels set this object is working for.- Parameters:
z- The z-section at which data is to be fetched.t- The timepoint at which data is to be fetched.c- The channel at which data is to be fetched.x- The x coordinatey- The y coordinatew- The width of the tileh- The height of the tile- Returns:
- A plane 2D object that encapsulates the actual plane pixels.
- Throws:
DataSourceException- If an error occurs while retrieving the plane data from the pixels source.
-
getPlane
public Plane2D getPlane(int z, int t, int c) throws DataSourceException
Extracts a 2D plane from the pixels set this object is working for.- Parameters:
z- The z-section at which data is to be fetched.t- The timepoint at which data is to be fetched.c- The channel at which data is to be fetched.- Returns:
- A plane 2D object that encapsulates the actual plane pixels.
- Throws:
DataSourceException- If an error occurs while retrieving the plane data from the pixels source.
-
getHistogram
public java.util.Map<java.lang.Integer,int[]> getHistogram(int[] channels, int binCount, boolean globalRange, omero.romio.PlaneDef plane) throws DataSourceExceptionGet the histogram data for the given image. Currently only non-tiled images are supported.- Parameters:
channels- The channel indicesbinCount- The number of bins (optional, default: 256)globalRange- Use the global minimum/maximum to determine the histogram range, otherwise use plane minimum/maximum valueplane- The plane to specify z/t and/or a certain region (optional, default: whole region of the first z/t plane)- Returns:
- A
Mapof histogram data, where the key is the channel index - Throws:
DataSourceException- If an error occurred
-
getResolutionDescriptions
public java.util.List<omero.api.ResolutionDescription> getResolutionDescriptions() throws DataSourceExceptionGet the available resolution descriptions- Returns:
- See above
- Throws:
DataSourceException- If an error occurs while retrieving the data
-
setResolutionLevel
public int setResolutionLevel(int level) throws DataSourceExceptionSet the resolution level and returns the previous one.- Parameters:
level- The SecurityContext- Returns:
- See above
- Throws:
DataSourceException- If an error occurs while retrieving the data
-
isSame
public boolean isSame(long pixelsID)
Returnstrueif a data source has already been created for the specified pixels set,falseotherwise.- Parameters:
pixelsID- The id of the pixels set.- Returns:
- See above.
-
close
public void close()
- Specified by:
closein interfacejava.lang.AutoCloseable
-
-