Package nom.tam.image.tile.operation
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 Summary
ConstructorsConstructorDescriptionAbstractTiledImageOperation(Class<OPERATION> operationClass) Deprecated.(for internal use) This constructor should have protected visibility. -
Method Summary
Modifier and TypeMethodDescriptionprotected voidCreates a tiling pattern for an image.Returns the element type of the image (and hence tile).intReturns the number of elements that a buffer must have to store the entire image.intReturns the actual with of the image which is to be tile (de)compressed.protected intgetNAxes()Returns the dimensionality of the image.protected intReturns the number of tile operations that are needed to cover a tiled image.protected int[]Returns the reference to the tile dimensions array.getTileOperation(int i) Returns the operation that handles the parallel processing of specific tiles.protected OPERATION[]Returns an array of parallel tile oprations, which cover the full image.protected booleanhasAxes()Checks if the image size has been defined.protected booleanChecks if the tiling has been defined and tile sizes are set.voidsetAxes(int[] axes) Sets the image dimensions, in Java array index order.protected voidsetBaseType(ElementType<Buffer> baseType) Sets the FITS element type that is contained in the tiles for this operation.voidsetTileAxes(int[] value) Sets the tile dimension.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface nom.tam.image.tile.operation.ITiledImageOperation
compressOptions, getCompressedWholeArea, getCompressorControl, getGzipCompressorControl
-
Constructor Details
-
AbstractTiledImageOperation
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
Description copied from interface:ITiledImageOperationReturns the element type of the image (and hence tile).- Specified by:
getBaseTypein interfaceITiledImageOperation- 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:ITiledImageOperationReturns the actual with of the image which is to be tile (de)compressed.- Specified by:
getImageWidthin interfaceITiledImageOperation- Returns:
- The width of the full image in pixels.
-
getTileOperation
Description copied from interface:ITiledImageOperationReturns 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:
getTileOperationin interfaceITiledImageOperation- 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
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:
trueif the size of the image to be tiled has been set, otherwisefalse.
-
hasTileAxes
protected boolean hasTileAxes()Checks if the tiling has been defined and tile sizes are set.- Returns:
trueif the tile sizes have been defined already, otherwisefalse
-
createTiles
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
Returns an array of parallel tile oprations, which cover the full image.- Returns:
- an array of parallel tile operations.
-
setBaseType
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.
-