Package nom.tam.image.tile.operation
Class AbstractTileOperation
java.lang.Object
nom.tam.image.tile.operation.AbstractTileOperation
- All Implemented Interfaces:
Runnable,ITileOperation
- Direct Known Subclasses:
TileCompressor,TileDecompressor
(for internal use) A base implementation of parallel processing of tiles. Each instance handles the processing
of a single 2D image tile, which is submitted to a thread pool for parallel processing of multiple tiles
simultaneously.
-
Constructor Summary
ConstructorsConstructorDescriptionAbstractTileOperation(ITiledImageOperation operation, int tileIndex, TileArea area) Creates a parallel tile processing operation for a specific 2D image tile. -
Method Summary
Modifier and TypeMethodDescriptionvoidexecute(ExecutorService threadPool) Performs the operation on the selected tile, by submitting it to a thread pool for parallel processing.getArea()Returns the location and size of the 2D image tile inside the entire imageprotected ElementType<Buffer>Returns the FITS element type of the image to be processed.intReturns the pixel count inside the tile that this operation is assigned to process.protected ITileOperationReturns the parallel tile operation whose tile index is one less than ours.protected TileBufferReturns the buffer that is to be used for storing or retrieving the serialized tile image.protected ITiledImageOperationReturns the operation that is assigned to be performed on the image tile.intReturns the sequential index of the tile that this operations is assigned to process.setDimensions(int dataOffset, int width, int height) Specifies the location of the tile in the serialized buffer.protected voidsetTileBuffer(TileBuffer tileBuffer) Sets the buffer to be used for storing or retrieving the serialized tile image.voidsetWholeImageBuffer(Buffer buffer) Sets the buffer that describes the whole image and let the tile create a slice of it from the position where the tile starts in the whole image.voidWait for the result of the tile processing.
-
Constructor Details
-
AbstractTileOperation
Creates a parallel tile processing operation for a specific 2D image tile.- Parameters:
operation- the operation that is to be performed on the tiletileIndex- the sequential tile indexarea- the location and size of tile in the full image.
-
-
Method Details
-
execute
Performs the operation on the selected tile, by submitting it to a thread pool for parallel processing.- Parameters:
threadPool- The thread pool in which the operation is to be processed.- See Also:
-
getArea
Returns the location and size of the 2D image tile inside the entire image- Returns:
- the location and size of the tile in the full image.
-
getPixelSize
public int getPixelSize()Returns the pixel count inside the tile that this operation is assigned to process.- Returns:
- the number of pixels in this tile.
-
getTileIndex
public int getTileIndex()Returns the sequential index of the tile that this operations is assigned to process.- Returns:
- the sequential index of the tile
-
setWholeImageBuffer
Sets the buffer that describes the whole image and let the tile create a slice of it from the position where the tile starts in the whole image. Attention this method is not thread-safe because it changes the position of the buffer parameter.- Parameters:
buffer- the buffer that describes the whole image.
-
waitForResult
public void waitForResult()Wait for the result of the tile processing.- Specified by:
waitForResultin interfaceITileOperation- See Also:
-
getBaseType
Returns the FITS element type of the image to be processed.- Returns:
- the FITS element type of the underlying image
-
getPreviousTileOperation
Returns the parallel tile operation whose tile index is one less than ours.- Returns:
- the parallel tile operation for the tile prior to ours.
-
getTileBuffer
Returns the buffer that is to be used for storing or retrieving the serialized tile image.- Returns:
- the linear buffer for the tile image.
- See Also:
-
getTiledImageOperation
Returns the operation that is assigned to be performed on the image tile.- Returns:
- the operation to be performed on the associated image tile
-
setDimensions
Description copied from interface:ITileOperationSpecifies the location of the tile in the serialized buffer.- Specified by:
setDimensionsin interfaceITileOperation- Parameters:
dataOffset- the byte offset at which the tile data begins.width- the width of the tile in pixels.height- the tile height in pixels.- Returns:
- itself.
-
setTileBuffer
Sets the buffer to be used for storing or retrieving the serialized tile image.- Parameters:
tileBuffer- the linear buffer for the tile image.- See Also:
-