Package nom.tam.image.compression.hdu
Class CompressedImageHDU
- java.lang.Object
-
- nom.tam.fits.BasicHDU<T>
-
- nom.tam.fits.TableHDU<BinaryTable>
-
- nom.tam.fits.BinaryTableHDU
-
- nom.tam.image.compression.hdu.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 Summary
-
Fields inherited from class nom.tam.fits.BasicHDU
BITPIX_BYTE, BITPIX_DOUBLE, BITPIX_FLOAT, BITPIX_INT, BITPIX_LONG, BITPIX_SHORT, isPrimary, myData, myHeader
-
-
Constructor Summary
Constructors Constructor Description CompressedImageHDU(Header hdr, CompressedImageData datum)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description ImageHDU
asImageHDU()
void
compress()
CompressedImageHDU
forceNoLoss(int x, int y, int width, int heigth)
Specify an areaWithin the image that will not undergo a lossy compression.static CompressedImageHDU
fromImageHDU(ImageHDU imageHDU, int... tileAxis)
Prepare a compressed image hdu for the specified image.<T extends ICompressOption>
TgetCompressOption(java.lang.Class<T> clazz)
CompressedImageData
getData()
java.nio.Buffer
getUncompressedData()
boolean
isHeader()
Check that this HDU has a valid header.static boolean
isHeader(Header hdr)
Check that this HDU has a valid header for this type.static CompressedImageData
manufactureData(Header hdr)
CompressedImageHDU
preserveNulls(java.lang.String compressionAlgorithm)
preserve the null values in the image even if the compression algorithm is lossy.CompressedImageHDU
setCompressAlgorithm(java.lang.String compressAlgorithm)
CompressedImageHDU
setQuantAlgorithm(java.lang.String quantAlgorithm)
-
Methods inherited from class nom.tam.fits.BinaryTableHDU
addColumn, binaryTableColumnKeyStems, columnKeyStems, encapsulate, info, isData, manufactureHeader, setComplexColumn, write
-
Methods inherited from class nom.tam.fits.TableHDU
addRow, deleteColumnsIndexOne, deleteColumnsIndexOne, deleteColumnsIndexZero, deleteColumnsIndexZero, deleteRows, deleteRows, findColumn, getColumn, getColumn, getColumnFormat, getColumnMeta, getColumnName, getColumns, getElement, getNCols, getNRows, getRow, setColumn, setColumn, setColumnMeta, setColumnMeta, setColumnMeta, setColumnMeta, setColumnMeta, setColumnMeta, setColumnMeta, setColumnName, setCurrentColumn, setCurrentColumn, setElement, setRow
-
Methods inherited from class nom.tam.fits.BasicHDU
addValue, addValue, addValue, addValue, addValue, addValue, addValue, addValue, card, getAuthor, getAxes, getBitPix, getBlankValue, getBScale, getBUnit, getBZero, getCreationDate, getDummyHDU, getEpoch, getEquinox, getFileOffset, getGroupCount, getHeader, getInstrument, getKernel, getMaximumValue, getMinimumValue, getObject, getObservationDate, getObserver, getOrigin, getParameterCount, getReference, getSize, getTelescope, getTrimmedString, getTrimmedString, read, reset, rewrite, rewriteable, saveReplaceCard
-
-
-
-
Constructor Detail
-
CompressedImageHDU
public CompressedImageHDU(Header hdr, CompressedImageData datum)
-
-
Method Detail
-
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 compresstileAxis
- 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 imagey
- the y position in the imagewidth
- the width of the areaheigth
- the height of the area- Returns:
- this
-
getCompressOption
public <T extends ICompressOption> T getCompressOption(java.lang.Class<T> clazz)
-
getData
public CompressedImageData getData()
- Overrides:
getData
in classBasicHDU<BinaryTable>
- Returns:
- the associated Data object
-
getUncompressedData
public java.nio.Buffer getUncompressedData() throws FitsException
- Throws:
FitsException
-
isHeader
public boolean isHeader()
Check that this HDU has a valid header.- Overrides:
isHeader
in classBinaryTableHDU
- Returns:
true
if this HDU has a valid header.
-
preserveNulls
public CompressedImageHDU preserveNulls(java.lang.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(java.lang.String compressAlgorithm) throws FitsException
- Throws:
FitsException
-
setQuantAlgorithm
public CompressedImageHDU setQuantAlgorithm(java.lang.String quantAlgorithm) throws FitsException
- Throws:
FitsException
-
-