Package nom.tam.image
Class StandardImageTiler
java.lang.Object
nom.tam.image.StandardImageTiler
- All Implemented Interfaces:
ImageTiler
Standard image tiling implementation. FITS tiles are always 2-dimentional, but really images of any dimensions may be covered with such tiles.
Modified May 2, 2000 by T. McGlynn to permit tiles that go off the edge of the image.
-
Constructor Summary
ConstructorDescriptionStandardImageTiler
(RandomAccess f, long fileOffset, int[] dims, Class<?> base) Create a tiler. -
Method Summary
Modifier and TypeMethodDescriptionReturns the entire image reconstructed from the available tiles.static long
getOffset
(int[] dims, int[] pos) getTile
(int[] corners, int[] lengths) Returns a tile from the image of the specified size at the specified location.getTile
(int[] corners, int[] lengths, int[] steps) Returns a sparsely sampled tile from the image of the specified size at the specified location.void
Fills the supplied array or output stream with the data from an image tile of the specified size at the specified location.void
Fills the supplied array our output stream with the sparsely sampled data from an image tile of the specified size at the specified location.
-
Constructor Details
-
StandardImageTiler
Create a tiler.- Parameters:
f
- The random access device from which image data may be read. This may be null if the tile information is available from memory.fileOffset
- The file offset within the RandomAccess device at which the data begins.dims
- The actual dimensions of the image.base
- The base class (should be a primitive type) of the image.
-
-
Method Details
-
getOffset
public static long getOffset(int[] dims, int[] pos) - Parameters:
dims
- The dimensions of the array.pos
- The index requested.- Returns:
- the offset of a given position.
-
getCompleteImage
Description copied from interface:ImageTiler
Returns the entire image reconstructed from the available tiles.- Specified by:
getCompleteImage
in interfaceImageTiler
- Returns:
- the complete reconstructed image from the available tiles, as a Java array. This may be an
array of promitives (such as
float[][]
) for images, or anObject[]
for binary tables. - Throws:
IOException
- if there was an error accessing the tile data from the input.- See Also:
-
getTile
Description copied from interface:ImageTiler
Returns a tile from the image of the specified size at the specified location. An image tile is returned as a one-dimensional array although the image will normally be multidimensional.- Specified by:
getTile
in interfaceImageTiler
- Parameters:
corners
- the pixels indices where the tile starts in the full image. The array =hould contain a value for each image dimension.lengths
- the tile size in pixels. The array should contain a value for each image dimension. For the supported 2D tiles, the values beyond the first two entries should be set to 1.- Returns:
- a Java array containing data for the requested tile. This will always be a flattened 1D array, even if the image is multidimensional
- Throws:
IOException
- if there was an error accessing the tile data from the input.- See Also:
-
getTile
Description copied from interface:ImageTiler
Returns a sparsely sampled tile from the image of the specified size at the specified location.- Specified by:
getTile
in interfaceImageTiler
- Parameters:
corners
- the pixels indices where the tile starts in the full image. The array =hould contain a value for each image dimension.lengths
- the tile size in pixels. The array should contain a value for each image dimension. For the supported 2D tiles, the values beyond the first two entries should be set to 1.steps
- the sampling frequency of the original image, in pixels. The array =hould contain a value for each image dimension.- Returns:
- a Java array containing data for the requested tile. This will always be a flattened 1D array, even if the image is multidimensional
- Throws:
IOException
- if there was an error accessing the tile data from the input.- See Also:
-
getTile
Description copied from interface:ImageTiler
Fills the supplied array or output stream with the data from an image tile of the specified size at the specified location.- Specified by:
getTile
in interfaceImageTiler
- Parameters:
output
- A one-dimensional output array or stream. Data not within the valid limits of the image will be left unchanged. For an array, the length should be the product of lengths. Optionally provide anArrayDataOutput
to stream out data and not fill memory; useful for web applications.corners
- the pixels indices where the tile starts in the full image. The array =hould contain a value for each image dimension.lengths
- the tile size in pixels. The array =hould contain a value for each image dimension. For the supported 2D tiles, the values beyond the first two entries should be set to 1.- Throws:
IOException
- if there was an error writing the tile to the output.- See Also:
-
getTile
Description copied from interface:ImageTiler
Fills the supplied array our output stream with the sparsely sampled data from an image tile of the specified size at the specified location.- Specified by:
getTile
in interfaceImageTiler
- Parameters:
output
- A one-dimensional output array or stream. Data not within the valid limits of the image will be left unchanged. For an array, the length should be the product of lengths. Optionally provide anArrayDataOutput
to stream out data and not fill memory; useful for web applications.corners
- the pixels indices where the tile starts in the full image. The array =hould contain a value for each image dimension.lengths
- the tile size in pixels. The array =hould contain a value for each image dimension. For the supported 2D tiles, the values beyond the first two entries should be set to 1.steps
- the sampling frequency of the original image, in pixels. The array =hould contain a value for each image dimension.- Throws:
IOException
- if there was an error writing the tile to the output.- See Also:
-