Class AbstractTiledImageOperation<OPERATION extends ITileOperation>

java.lang.Object
nom.tam.image.tile.operation.AbstractTiledImageOperation<OPERATION>
Type Parameters:
OPERATION - The generic type of tile operation that handles parallel processing
All Implemented Interfaces:
ITiledImageOperation
Direct Known Subclasses:
TiledImageCompressionOperation

public abstract class AbstractTiledImageOperation<OPERATION extends ITileOperation> extends Object implements ITiledImageOperation
A base implementation of 2D image tile compression.
  • Constructor Details

    • AbstractTiledImageOperation

      public AbstractTiledImageOperation(Class<OPERATION> operationClass)
      Deprecated.
      (for internal use) This constructor should have protected visibility.
      Creates a new tiling foperation.
      Parameters:
      operationClass - the class of tile operation.
  • Method Details

    • getBaseType

      public ElementType<Buffer> getBaseType()
      Description copied from interface: ITiledImageOperation
      Returns the element type of the image (and hence tile).
      Specified by:
      getBaseType in interface ITiledImageOperation
      Returns:
      the FITS element type used in this tile.
    • getBufferSize

      public int getBufferSize()
      Returns the number of elements that a buffer must have to store the entire image.
      Returns:
      The number of points in the full image.
    • getImageWidth

      public int getImageWidth()
      Description copied from interface: ITiledImageOperation
      Returns the actual with of the image which is to be tile (de)compressed.
      Specified by:
      getImageWidth in interface ITiledImageOperation
      Returns:
      The width of the full image in pixels.
    • getTileOperation

      public OPERATION getTileOperation(int i)
      Description copied from interface: ITiledImageOperation
      Returns the operation that handles the parallel processing of specific tiles. Each tile can be processed by a dedicated thread, with many tiles processing in parallel at the same time.
      Specified by:
      getTileOperation in interface ITiledImageOperation
      Parameters:
      i - the sequential (flattened) index of the specific tile
      Returns:
      the operation instance that handles the parallel processing of that particular tiles.
    • setAxes

      public void setAxes(int[] axes)
      Sets the image dimensions, in Java array index order.
      Parameters:
      axes - Image dimensions in Java array index order (x is last!).
    • setTileAxes

      public void setTileAxes(int[] value) throws FitsException

      Sets the tile dimension. Here the dimensions are in Java array index order, that is the x-dimension (width of tile) is last!

      Note, that because tile compression is essentially 2D, the tile sizes in higher dimensions will be forced to 1, even if specified otherwise by the argument (see FITSIO convention).

      Parameters:
      value - The tile dimensions in Java array index order (x is last!). Only up to the last 2 components are considered. The rest will be assumed to have values equals to 1.
      Throws:
      FitsException - If the leading dimensions (before the last 2) have sizes not equal to 1
    • hasAxes

      protected boolean hasAxes()
      Checks if the image size has been defined.
      Returns:
      true if the size of the image to be tiled has been set, otherwise false.
    • hasTileAxes

      protected boolean hasTileAxes()
      Checks if the tiling has been defined and tile sizes are set.
      Returns:
      true if the tile sizes have been defined already, otherwise false
    • createTiles

      protected void createTiles(ITileOperationInitialisation<OPERATION> init) throws FitsException
      Creates a tiling pattern for an image.
      Parameters:
      init - the parameters that determine the tiling pattern
      Throws:
      FitsException - if the parameters are invalid.
    • getNAxes

      protected int getNAxes()
      Returns the dimensionality of the image.
      Returns:
      the dimensinality of the image, that is the number of cartesian axes it contains.
    • getNumberOfTileOperations

      protected int getNumberOfTileOperations()
      Returns the number of tile operations that are needed to cover a tiled image.
      Returns:
      the number of tiles in the image.
    • getTileAxes

      protected int[] getTileAxes()
      Returns the reference to the tile dimensions array. The dimensions are stored in Java array index order, i.e., the x-dimension (width) is last.
      Returns:
      The tile dimensions in Java array index order (x is last!).
    • getTileOperations

      protected OPERATION[] getTileOperations()
      Returns an array of parallel tile oprations, which cover the full image.
      Returns:
      an array of parallel tile operations.
    • setBaseType

      protected void setBaseType(ElementType<Buffer> baseType)
      Sets the FITS element type that is contained in the tiles for this operation.
      Parameters:
      baseType - the FITS element type of data in the tile.