Class CompressedImageHDU

All Implemented Interfaces:
FitsElement

public class CompressedImageHDU extends BinaryTableHDU
A compressed image is a normal binary table with a defined structure. The image is split in tiles and each tile is compressed on its own. The compressed data is then stored in the 3 data columns of this binary table (compressed, gzipped and uncompressed) depending on the compression type used in the tile.
  • Field Details

  • Constructor Details

  • Method Details

    • fromImageHDU

      public static CompressedImageHDU fromImageHDU(ImageHDU imageHDU, int... tileAxis) throws FitsException
      Prepare a compressed image hdu for the specified image. the tile axis that are specified with -1 are set to the corresponding axis of the image. The image will be compressed in "sqaures" that ar defined by the tile size. Next step would be to set the compression options into the hdu and then compress it.
      Parameters:
      imageHDU - the image to compress
      tileAxis - the axis of the tiles in the image
      Returns:
      the prepared compressed image hdu.
      Throws:
      FitsException - if the image could not be used to create a compressed image.
    • isHeader

      public static boolean isHeader(Header hdr)
      Check that this HDU has a valid header for this type.
      Parameters:
      hdr - header to check
      Returns:
      true if this HDU has a valid header.
    • manufactureData

      public static CompressedImageData manufactureData(Header hdr) throws FitsException
      Throws:
      FitsException
    • asImageHDU

      public ImageHDU asImageHDU() throws FitsException
      Throws:
      FitsException
    • compress

      public void compress() throws FitsException
      Throws:
      FitsException
    • forceNoLoss

      public CompressedImageHDU forceNoLoss(int x, int y, int width, int heigth)
      Specify an areaWithin the image that will not undergo a lossy compression. This will only have affect it the selected compression (including the options) is a lossy compression. All tiles touched by this region will be handled so that there is no loss of any data, the reconstruction will be exact.
      Parameters:
      x - the x position in the image
      y - the y position in the image
      width - the width of the area
      heigth - the height of the area
      Returns:
      this
    • getCompressOption

      public <T extends ICompressOption> T getCompressOption(Class<T> clazz)
    • getData

      public CompressedImageData getData()
      Overrides:
      getData in class BasicHDU<BinaryTable>
      Returns:
      the associated Data object
    • getUncompressedData

      public Buffer getUncompressedData() throws FitsException
      Throws:
      FitsException
    • isHeader

      public boolean isHeader()
      Check that this HDU has a valid header.
      Overrides:
      isHeader in class BinaryTableHDU
      Returns:
      true if this HDU has a valid header.
    • preserveNulls

      public CompressedImageHDU preserveNulls(String compressionAlgorithm)
      preserve the null values in the image even if the compression algorithm is lossy. I the image that will be compressed a BLANK header should be available if the pixel value is one of the integer types.
      Parameters:
      compressionAlgorithm - compression algorithm to use for the null pixel mask
      Returns:
      this
    • setCompressAlgorithm

      public CompressedImageHDU setCompressAlgorithm(String compressAlgorithm) throws FitsException
      Throws:
      FitsException
    • setQuantAlgorithm

      public CompressedImageHDU setQuantAlgorithm(String quantAlgorithm) throws FitsException
      Throws:
      FitsException