Package nom.tam.image.compression.hdu
Class CompressedImageData
java.lang.Object
nom.tam.fits.Data
nom.tam.fits.AbstractTableData
nom.tam.fits.BinaryTable
nom.tam.image.compression.hdu.CompressedImageData
- All Implemented Interfaces:
Cloneable
,FitsElement
,TableData
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:
-
Nested Class Summary
Nested classes/interfaces inherited from class nom.tam.fits.BinaryTable
BinaryTable.ColumnDesc, BinaryTable.SaveState
-
Field Summary
Fields inherited from class nom.tam.fits.Data
dataSize, fileOffset, input
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotected
Creates a new empty compressed image data to be initialized at a later pointprotected
Creates a new compressed image data based on the prescription of the supplied header. -
Method Summary
Modifier and TypeMethodDescriptionprotected void
This should only be called byCompressedImageHDU
.void
fillHeader
(Header h) Describe the structure of this data object in the supplied header.protected void
forceNoLoss
(int x, int y, int width, int heigth) This should only be called buyCompressedImageHDU
.protected <T extends ICompressOption>
TgetCompressOption
(Class<T> clazz) Returns the compression (or quantization) options for a selected compression option class.protected Buffer
This should only be called byCompressedImageHDU
.protected void
prepareUncompressedData
(Object data, Header header) This should only be called byCompressedImageHDU
.protected void
preserveNulls
(long nullValue, String compressionAlgorithm) preserve the null values in the image even if the compression algorithm is lossy.protected CompressedImageData
setAxis
(int[] axes) Sets the size of the image to be compressed.protected void
setCompressAlgorithm
(HeaderCard compressAlgorithmCard) Sets the compression algorithm that was used to generate the HDU.protected void
setQuantAlgorithm
(HeaderCard quantAlgorithmCard) Sets the quantization algorithm that was used to generate the HDU.protected CompressedImageData
setTileSize
(int... axes) Sets the tile size to use for sompressing.Methods inherited from class nom.tam.fits.BinaryTable
addBitsColumn, addByteVaryingColumn, addColumn, addColumn, addComplexColumn, addFlattenedColumn, addRow, addStringColumn, addVariableSizeColumn, clone, compact, containsHeap, convertToBits, copy, createColumnDataFor, createColumnTable, createTable, defragment, deleteColumns, deleteRows, discardVLAs, fromColumnMajor, fromRowMajor, get, getArrayElement, getArrayElementAs, getBases, getColumn, getCurrentData, getData, getDescriptor, getDescriptor, getDescriptor, getDimens, getDouble, getElement, getFlatColumns, getFlattenedColumn, getFromHeap, getLogical, getLong, getModelRow, getNCols, getNRows, getNumber, getRawElement, getRow, getSizes, getString, getTrueSize, getTypes, indexOf, loadData, parseTDims, read, readHeap, readHeap, readTrueData, reserveHeapSpace, reserveRowSpace, set, setColumn, setComplexColumn, setElement, setFlattenedColumn, setRow, toHDU, updateAfterDelete, validColumn, validRow, write
Methods inherited from class nom.tam.fits.Data
calcChecksum, detach, ensureData, getFileOffset, getKernel, getRandomAccessInput, getSize, isDeferred, isEmpty, reset, rewrite, rewriteable, setFileOffset
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface nom.tam.fits.TableData
addRowEntries, setRowEntries
-
Constructor Details
-
CompressedImageData
protected CompressedImageData()Creates a new empty compressed image data to be initialized at a later point -
CompressedImageData
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
Description copied from class:Data
Describe the structure of this data object in the supplied header.- Overrides:
fillHeader
in classBinaryTable
- Parameters:
h
- header to fill with the data from the current data object- Throws:
FitsException
- if the operation fails
-
compress
This should only be called byCompressedImageHDU
.- Throws:
FitsException
-
forceNoLoss
protected void forceNoLoss(int x, int y, int width, int heigth) This should only be called buyCompressedImageHDU
. -
getCompressOption
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 calledsetCompressionAlgorithm(
, then you can retrieve options for it with this method asCompression.ZCMPTYPE_RICE_1
)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
This should only be called byCompressedImageHDU
.- Throws:
FitsException
-
prepareUncompressedData
This should only be called byCompressedImageHDU
.- Throws:
FitsException
-
preserveNulls
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 valuescompressionAlgorithm
- compression algorithm to use for the null pixel mask
-
setAxis
Sets the size of the image to be compressed.- Parameters:
axes
- the image size- Returns:
- itself This should only be called by
CompressedImageHDU
.
-
setCompressAlgorithm
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
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
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 byCompressedImageHDU
.
-