Class CompressedImageData

All Implemented Interfaces:
Cloneable, FitsElement, TableData

public class CompressedImageData extends BinaryTable
FITS representation of a compressed image. Compressed images are essentially stored as FITS binary tables. They are distinguished only by a set of mandatory header keywords and specific column data structure. The image-specific header keywords of the original image are re-mapped to keywords starting with 'Z' prefixed so as to not interfere with the binary table description. (e.g. NAXIS1 of the original image is stored as ZNAXIS1 in the compressed table).
See Also:
  • Constructor Details

    • CompressedImageData

      protected CompressedImageData()
      Creates a new empty compressed image data to be initialized at a later point
    • CompressedImageData

      protected CompressedImageData(Header hdr) throws FitsException
      Creates a new compressed image data based on the prescription of the supplied header.
      Parameters:
      hdr - The header that describes the compressed image
      Throws:
      FitsException - If the header is invalid or could not be accessed.
  • Method Details

    • fillHeader

      public void fillHeader(Header h) throws FitsException
      Description copied from class: Data
      Describe the structure of this data object in the supplied header.
      Overrides:
      fillHeader in class BinaryTable
      Parameters:
      h - header to fill with the data from the current data object
      Throws:
      FitsException - if the operation fails
    • compress

      protected void compress(CompressedImageHDU hdu) throws FitsException
      This should only be called by CompressedImageHDU.
      Throws:
      FitsException
    • forceNoLoss

      protected void forceNoLoss(int x, int y, int width, int heigth)
      This should only be called buyCompressedImageHDU.
    • getCompressOption

      protected <T extends ICompressOption> T getCompressOption(Class<T> clazz)
      Returns the compression (or quantization) options for a selected compression option class. It is presumed that the requested options are appropriate for the compression and/or quantization algorithm that was selected. E.g., if you called setCompressionAlgorithm(Compression.ZCMPTYPE_RICE_1), then you can retrieve options for it with this method as getCompressOption(RiceCompressOption.class).
      Type Parameters:
      T - The generic type of the compression class
      Parameters:
      clazz - the compression class
      Returns:
      The current set of options for the requested type, or null if there are no options or if the requested type does not match the algorithm(s) selected.
      See Also:
    • getUncompressedData

      protected Buffer getUncompressedData(Header hdr) throws FitsException
      This should only be called by CompressedImageHDU.
      Throws:
      FitsException
    • prepareUncompressedData

      protected void prepareUncompressedData(Object data, Header header) throws FitsException
      This should only be called by CompressedImageHDU.
      Throws:
      FitsException
    • preserveNulls

      protected void preserveNulls(long nullValue, String compressionAlgorithm)
      preserve the null values in the image even if the compression algorithm is lossy.
      Parameters:
      nullValue - the value representing null for byte/short and integer pixel values
      compressionAlgorithm - compression algorithm to use for the null pixel mask
    • setAxis

      protected CompressedImageData setAxis(int[] axes)
      Sets the size of the image to be compressed.
      Parameters:
      axes - the image size
      Returns:
      itself This should only be called by CompressedImageHDU.
    • setCompressAlgorithm

      protected void setCompressAlgorithm(HeaderCard compressAlgorithmCard)
      Sets the compression algorithm that was used to generate the HDU.
      Parameters:
      compressAlgorithmCard - the FITS header card that specifies the compression algorithm that was used.
      See Also:
    • setQuantAlgorithm

      protected void setQuantAlgorithm(HeaderCard quantAlgorithmCard) throws FitsException
      Sets the quantization algorithm that was used to generate the HDU.
      Parameters:
      quantAlgorithmCard - the FITS header card that specifies the quantization algorithm that was used.
      Throws:
      FitsException - if no algorithm is available by the specified name
      See Also:
    • setTileSize

      protected CompressedImageData setTileSize(int... axes) throws FitsException
      Sets the tile size to use for sompressing.
      Parameters:
      axes - the tile size along all dimensions. Only the last 2 dimensions may differ from 1.
      Returns:
      itself
      Throws:
      FitsException - if the tile size is invalid. This should only be called by CompressedImageHDU.