Class DataSink

  • All Implemented Interfaces:
    java.lang.AutoCloseable

    public class DataSink
    extends java.lang.Object
    implements java.lang.AutoCloseable
    Encapsulates 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.String DOUBLE
      Identifies the type used to store pixel values.
      static java.lang.String FLOAT
      Identifies the type used to store pixel values.
      static java.lang.String INT_16
      Identifies the type used to store pixel values.
      static java.lang.String INT_32
      Identifies the type used to store pixel values.
      static java.lang.String INT_8
      Identifies the type used to store pixel values.
      static java.lang.String UINT_16
      Identifies the type used to store pixel values.
      static java.lang.String UINT_32
      Identifies the type used to store pixel values.
      static java.lang.String UINT_8
      Identifies the type used to store pixel values.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void close()  
      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.
      Plane2D getPlane​(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 descriptions
      Plane2D getTile​(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.
      boolean isSame​(long pixelsID)
      Returns true if a data source has already been created for the specified pixels set, false otherwise.
      int setResolutionLevel​(int level)
      Set the resolution level and returns the previous one.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • 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
    • 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 coordinate
        y - The y coordinate
        w - The width of the tile
        h - 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 DataSourceException
        Get the histogram data for the given image. Currently only non-tiled images are supported.
        Parameters:
        channels - The channel indices
        binCount - The number of bins (optional, default: 256)
        globalRange - Use the global minimum/maximum to determine the histogram range, otherwise use plane minimum/maximum value
        plane - The plane to specify z/t and/or a certain region (optional, default: whole region of the first z/t plane)
        Returns:
        A Map of 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 DataSourceException
        Get the available resolution descriptions
        Returns:
        See above
        Throws:
        DataSourceException - If an error occurs while retrieving the data
      • setResolutionLevel

        public int setResolutionLevel​(int level)
                               throws DataSourceException
        Set 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)
        Returns true if a data source has already been created for the specified pixels set, false otherwise.
        Parameters:
        pixelsID - The id of the pixels set.
        Returns:
        See above.
      • close

        public void close()
        Specified by:
        close in interface java.lang.AutoCloseable