Class MediaLibAccessor


  • public class MediaLibAccessor
    extends Object
    An adapter class for presenting image data in a mediaLibImage format, even if the data isn't stored that way. MediaLibAccessor is meant to make the common case (ComponentRasters) and allow them to be accelerated via medialib. Note that unlike RasterAccessor, MediaLibAccessor does not work with all cases. In the event that MediaLibAccessor can not deal with a give collection of Rasters, findCompatibleTag will return the value MediaLibAccessor.TAG_INCOMPATIBLE. OpImages that use MediaLibAccessor should be paired with RIF's which check that findCompatibleTag returns a valid tag before actually constructing the Mlib OpImage.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      protected int[] bandOffsets
      The offsets of each band in the src image
      static int BINARY
      Flag indicating data are binary.
      static int BINARY_MASK
      The bits of a FormatTag associated with binary data.
      static int COPIED
      Flag indicating data is a copy of the raster's data.
      static int COPY_MASK
      The bits of a FormatTag associated with how dataArrays are obtained.
      static int DATATYPE_MASK
      The bits of a FormatTag associated with pixel datatype.
      protected int formatTag
      Tag indicating the data type of the data and whether its copied
      static int NONBINARY
      Flag indicating data are not binary.
      protected int numBands
      The number of bands per pixel in the data array.
      protected Raster raster
      The raster that is the source of pixel data.
      protected Rectangle rect
      The rectangle of the raster that MediaLibAccessor addresses.
      static int TAG_BYTE_COPIED
      FormatTag indicating data in byte arrays and uncopied.
      static int TAG_BYTE_UNCOPIED
      FormatTag indicating data in byte arrays and uncopied.
      static int TAG_DOUBLE_COPIED
      FormatTag indicating data in double arrays and copied.
      static int TAG_DOUBLE_UNCOPIED
      FormatTag indicating data in double arrays and uncopied.
      static int TAG_FLOAT_COPIED
      FormatTag indicating data in float arrays and copied.
      static int TAG_FLOAT_UNCOPIED
      FormatTag indicating data in float arrays and uncopied.
      static int TAG_INT_COPIED
      FormatTag indicating data in short arrays and copied.
      static int TAG_INT_UNCOPIED
      FormatTag indicating data in integer arrays and uncopied.
      static int TAG_SHORT_COPIED
      FormatTag indicating data in short arrays and copied.
      static int TAG_SHORT_UNCOPIED
      FormatTag indicating data in short arrays and uncopied.
      static int TAG_USHORT_COPIED
      FormatTag indicating data in unsigned short arrays and copied.
      static int TAG_USHORT_UNCOPIED
      FormatTag indicating data in unsigned short arrays and uncopied.
      static int UNCOPIED
      Flag indicating data is raster's data.
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      static int findCompatibleTag​(Raster src)
      Returns the most efficient FormatTag that is compatible with the destination raster and all source rasters.
      int[] getBandOffsets()
      Returns the bandOffsets.
      int getDataType()
      Returns the data type of the RasterAccessor object.
      double[] getDoubleParameters​(int band, double[] params)
      Returns parameters in the appropriate order if MediaLibAccessor has reordered the bands or is attempting to make a BandSequential image look like multiple PixelSequentialImages
      int[][] getIntArrayParameters​(int band, int[][] params)
      Returns parameters in the appropriate order if MediaLibAccessor has reordered the bands or is attempting to make a BandSequential image look like multiple PixelSequentialImages
      int[] getIntParameters​(int band, int[] params)
      Returns parameters in the appropriate order if MediaLibAccessor has reordered the bands or is attempting to make a BandSequential image look like multiple PixelSequentialImages
      boolean isBinary()
      Returns true if the MediaLibAccessor represents binary data.
      boolean isDataCopy()
      Returns true if the MediaLibAccessors's data is copied from it's raster.
      static boolean isPixelSequential​(SampleModel sm)
      Determines if the SampleModel stores data in a way that can be represented by a mediaLibImage without copying
    • Method Detail

      • findCompatibleTag

        public static int findCompatibleTag​(Raster src)
        Returns the most efficient FormatTag that is compatible with the destination raster and all source rasters.
        Parameters:
        srcs - the source Raster; may be null.
        dst - the destination Raster.
      • isPixelSequential

        public static boolean isPixelSequential​(SampleModel sm)
        Determines if the SampleModel stores data in a way that can be represented by a mediaLibImage without copying
      • isBinary

        public boolean isBinary()
        Returns true if the MediaLibAccessor represents binary data.
      • getDataType

        public int getDataType()
        Returns the data type of the RasterAccessor object. Note that this datatype is not necessarily the same data type as the underlying raster.
      • isDataCopy

        public boolean isDataCopy()
        Returns true if the MediaLibAccessors's data is copied from it's raster.
      • getBandOffsets

        public int[] getBandOffsets()
        Returns the bandOffsets.
      • getIntParameters

        public int[] getIntParameters​(int band,
                                      int[] params)
        Returns parameters in the appropriate order if MediaLibAccessor has reordered the bands or is attempting to make a BandSequential image look like multiple PixelSequentialImages
      • getIntArrayParameters

        public int[][] getIntArrayParameters​(int band,
                                             int[][] params)
        Returns parameters in the appropriate order if MediaLibAccessor has reordered the bands or is attempting to make a BandSequential image look like multiple PixelSequentialImages
      • getDoubleParameters

        public double[] getDoubleParameters​(int band,
                                            double[] params)
        Returns parameters in the appropriate order if MediaLibAccessor has reordered the bands or is attempting to make a BandSequential image look like multiple PixelSequentialImages