Package nom.tam.image

Class StandardImageTiler

java.lang.Object
nom.tam.image.StandardImageTiler
All Implemented Interfaces:
ImageTiler

public abstract class StandardImageTiler extends Object implements 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

    Constructors
    Constructor
    Description
    StandardImageTiler(RandomAccess f, long fileOffset, int[] dims, Class<?> base)
    Create a tiler.
  • Method Summary

    Modifier and Type
    Method
    Description
    Returns 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
    getTile(Object output, int[] corners, int[] lengths)
    Fills the supplied array or output stream with the data from an image tile of the specified size at the specified location.
    void
    getTile(Object output, int[] corners, int[] lengths, int[] steps)
    Fills the supplied array our output stream with the sparsely sampled data from an image tile of the specified size at the specified location.

    Methods inherited from class java.lang.Object

    equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • StandardImageTiler

      public StandardImageTiler(RandomAccess f, long fileOffset, int[] dims, Class<?> base)
      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

      public Object getCompleteImage() throws IOException
      Description copied from interface: ImageTiler
      Returns the entire image reconstructed from the available tiles.
      Specified by:
      getCompleteImage in interface ImageTiler
      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 an Object[] for binary tables.
      Throws:
      IOException - if there was an error accessing the tile data from the input.
      See Also:
    • getTile

      public Object getTile(int[] corners, int[] lengths) throws IOException
      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 interface ImageTiler
      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

      public Object getTile(int[] corners, int[] lengths, int[] steps) throws IOException
      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 interface ImageTiler
      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

      public void getTile(Object output, int[] corners, int[] lengths) throws IOException
      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 interface ImageTiler
      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 an ArrayDataOutput 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

      public void getTile(Object output, int[] corners, int[] lengths, int[] steps) throws IOException
      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 interface ImageTiler
      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 an ArrayDataOutput 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: