LSSTApplications  19.0.0-14-gb0260a2+1009f50558,20.0.0+089c43b26b,20.0.0+126303c00d,20.0.0+2f3d0e5c40,20.0.0+36ef800059,20.0.0+5efbb753f1,20.0.0+bebc1f60e8,20.0.0+c31f88ab0f,20.0.0+e2e26847c2,20.0.0+f8788d280b,20.0.0-1-g10df615+c10c626ef0,20.0.0-1-g253301a+36ef800059,20.0.0-1-g2b7511a+bebc1f60e8,20.0.0-1-g4d801e7+2364cbef1f,20.0.0-1-g5b95a8c+f41a630bc9,20.0.0-1-g660595b+f45b7d88f4,20.0.0-1-gc96f8cb+4c66cd7cf3,20.0.0-1-gd1c87d7+85c46248f3,20.0.0-1-gedffbd8+f975718b49,20.0.0-13-ge9dc5b3+55648be1db,20.0.0-15-ga86d0f6+bdc7c63f7c,20.0.0-15-gf5872d0+4c66cd7cf3,20.0.0-16-g6fe20a1+a77778c47d,20.0.0-2-g4dae9ad+4c66cd7cf3,20.0.0-2-g7818986+85c46248f3,20.0.0-2-gec03fae+ff10c6d78d,20.0.0-25-g38d2b7ae+bde7f0c6ec,20.0.0-3-g4cc78c6+63636aeed8,20.0.0-3-g6a8623c+55648be1db,20.0.0-3-g750bffe+823a89ab62,20.0.0-4-gfea843c+f45b7d88f4,20.0.0-47-g0830830+f5f993f8be,20.0.0-5-g357b56b+f45b7d88f4,20.0.0-5-gfcebe35+8726ad94da,20.0.0-7-gc818c6e6+aaebb51c78,20.0.0-7-gcda7bf1+2a82aa79eb,20.0.0-9-g61a2a9a3d+14f89e4eca,w.2020.38
LSSTDataManagementBasePackage
Public Types | Public Member Functions | Public Attributes | List of all members
lsst::afw::fits::ImageCompressionOptions Struct Reference

Options for tile compression of image pixels. More...

#include <fitsCompression.h>

Public Types

enum  CompressionAlgorithm {
  NONE, GZIP, GZIP_SHUFFLE, RICE,
  PLIO
}
 Compression algorithms. More...
 
typedef ndarray::Array< long, 1, 1 > Tiles
 

Public Member Functions

 ImageCompressionOptions (CompressionAlgorithm algorithm_, Tiles tiles_, float quantizeLevel_=0.0)
 Custom compression. More...
 
 ImageCompressionOptions (CompressionAlgorithm algorithm_, std::vector< long > tiles_, float quantizeLevel_=0.0)
 
 ImageCompressionOptions (CompressionAlgorithm algorithm_, int rows=1, float quantizeLevel_=0.0)
 Compression by rows or entire image. More...
 
template<typename T >
 ImageCompressionOptions (image::Image< T > const &image)
 Default compression for a particular style of image. More...
 
template<typename T >
 ImageCompressionOptions (image::Mask< T > const &mask)
 
 ImageCompressionOptions (image::Image< std::int64_t > const &image)
 
 ImageCompressionOptions (image::Mask< std::int64_t > const &mask)
 
 ImageCompressionOptions (image::Image< std::uint64_t > const &image)
 
 ImageCompressionOptions (image::Mask< std::uint64_t > const &mask)
 

Public Attributes

CompressionAlgorithm algorithm
 Compresion algorithm to use. More...
 
Tiles tiles
 Tile size; a dimension with 0 means infinite (e.g., to specify one row: 0,1) More...
 
float quantizeLevel
 quantization level: 0.0 = none requires use of GZIP or GZIP_SHUFFLE More...
 

Detailed Description

Options for tile compression of image pixels.

Tile compression is a feature provided by cfitsio, where contiguous parts of the image ("tiles", e.g., rows, multiple rows, blocks or the entire image) are compressed separately. The aim of this struct is to hold the parameters used to configure the compression.

Floating-point images can be losslessly compressed (quantizeLevel=0.0) using (only) the GZIP or GZIP_SHUFFLE compression algorithms, but the compression factor so achieved is modest (e.g., ~ 10% compression). Better compression factors can be achieved if floating-point images are first quantised into integer images. This can be done by cfitsio (through the quantizeLevel parameter) or through use of the ImageScalingOptions.

The Compression is specified by:

Due to bugs, cfitsio may require setting the quantizeLevel to a value other than zero when compressing integer data, but in this case it should have no effect.

Definition at line 180 of file fitsCompression.h.

Member Typedef Documentation

◆ Tiles

typedef ndarray::Array<long, 1, 1> lsst::afw::fits::ImageCompressionOptions::Tiles

Definition at line 194 of file fitsCompression.h.

Member Enumeration Documentation

◆ CompressionAlgorithm

Compression algorithms.

cfitsio's compression algorithms are #defines; these have a namespace.

We deliberately don't support HCOMPRESS: it doesn't appear to be useful to us (e.g., lossy) and it requires extra configuration.

Enumerator
NONE 

No compression.

GZIP 

Standard GZIP compression.

GZIP_SHUFFLE 

GZIP compression with shuffle (most-significant byte first)

RICE 

RICE compression.

PLIO 

PLIO compression.

Definition at line 187 of file fitsCompression.h.

187  {
188  NONE,
189  GZIP,
190  GZIP_SHUFFLE,
191  RICE,
192  PLIO,
193  };

Constructor & Destructor Documentation

◆ ImageCompressionOptions() [1/9]

lsst::afw::fits::ImageCompressionOptions::ImageCompressionOptions ( CompressionAlgorithm  algorithm_,
Tiles  tiles_,
float  quantizeLevel_ = 0.0 
)
inlineexplicit

Custom compression.

Definition at line 201 of file fitsCompression.h.

203  : algorithm(algorithm_), tiles(ndarray::copy(tiles_)), quantizeLevel(quantizeLevel_) {}

◆ ImageCompressionOptions() [2/9]

lsst::afw::fits::ImageCompressionOptions::ImageCompressionOptions ( CompressionAlgorithm  algorithm_,
std::vector< long >  tiles_,
float  quantizeLevel_ = 0.0 
)
inlineexplicit

Definition at line 205 of file fitsCompression.h.

207  : algorithm(algorithm_), tiles(ndarray::allocate(tiles_.size())), quantizeLevel(quantizeLevel_) {
208  std::copy(tiles_.cbegin(), tiles_.cend(), tiles.begin());
209  }

◆ ImageCompressionOptions() [3/9]

lsst::afw::fits::ImageCompressionOptions::ImageCompressionOptions ( ImageCompressionOptions::CompressionAlgorithm  algorithm_,
int  rows = 1,
float  quantizeLevel_ = 0.0 
)
explicit

Compression by rows or entire image.

Parameters
[in]algorithm_Compression algorithm to use
[in]rowsNumber of rows per tile (0 = entire image)
[in]quantizeLevel_cfitsio quantization level

Definition at line 91 of file fitsCompression.cc.

93  : algorithm(algorithm_), tiles(ndarray::allocate(MAX_COMPRESS_DIM)), quantizeLevel(quantizeLevel_) {
94  tiles[0] = 0;
95  tiles[1] = rows;
96  for (int ii = 2; ii < MAX_COMPRESS_DIM; ++ii) tiles[ii] = 1;
97 }

◆ ImageCompressionOptions() [4/9]

template<typename T >
lsst::afw::fits::ImageCompressionOptions::ImageCompressionOptions ( image::Image< T > const &  image)
inlineexplicit

Default compression for a particular style of image.

Currently defaults to NONE; change to GZIP_SHUFFLE once use of compression by default has been approved (RFC-378).

Definition at line 224 of file fitsCompression.h.

225  : ImageCompressionOptions(image.getBBox().getArea() > 0 ? NONE : NONE) {}

◆ ImageCompressionOptions() [5/9]

template<typename T >
lsst::afw::fits::ImageCompressionOptions::ImageCompressionOptions ( image::Mask< T > const &  mask)
inlineexplicit

Definition at line 227 of file fitsCompression.h.

228  : ImageCompressionOptions(mask.getBBox().getArea() > 0 ? NONE : NONE) {}

◆ ImageCompressionOptions() [6/9]

lsst::afw::fits::ImageCompressionOptions::ImageCompressionOptions ( image::Image< std::int64_t > const &  image)
inlineexplicit

Definition at line 231 of file fitsCompression.h.

◆ ImageCompressionOptions() [7/9]

lsst::afw::fits::ImageCompressionOptions::ImageCompressionOptions ( image::Mask< std::int64_t > const &  mask)
inlineexplicit

Definition at line 233 of file fitsCompression.h.

◆ ImageCompressionOptions() [8/9]

lsst::afw::fits::ImageCompressionOptions::ImageCompressionOptions ( image::Image< std::uint64_t > const &  image)
inlineexplicit

Definition at line 234 of file fitsCompression.h.

◆ ImageCompressionOptions() [9/9]

lsst::afw::fits::ImageCompressionOptions::ImageCompressionOptions ( image::Mask< std::uint64_t > const &  mask)
inlineexplicit

Definition at line 236 of file fitsCompression.h.

Member Data Documentation

◆ algorithm

CompressionAlgorithm lsst::afw::fits::ImageCompressionOptions::algorithm

Compresion algorithm to use.

Definition at line 196 of file fitsCompression.h.

◆ quantizeLevel

float lsst::afw::fits::ImageCompressionOptions::quantizeLevel

quantization level: 0.0 = none requires use of GZIP or GZIP_SHUFFLE

Definition at line 198 of file fitsCompression.h.

◆ tiles

Tiles lsst::afw::fits::ImageCompressionOptions::tiles

Tile size; a dimension with 0 means infinite (e.g., to specify one row: 0,1)

Definition at line 197 of file fitsCompression.h.


The documentation for this struct was generated from the following files:
lsst::afw::image
Backwards-compatibility support for depersisting the old Calib (FluxMag0/FluxMag0Err) objects.
Definition: imageAlgorithm.dox:1
lsst::afw::fits::ImageCompressionOptions::ImageCompressionOptions
ImageCompressionOptions(CompressionAlgorithm algorithm_, Tiles tiles_, float quantizeLevel_=0.0)
Custom compression.
Definition: fitsCompression.h:201
std::vector::size
T size(T... args)
lsst::afw::fits::ImageCompressionOptions::quantizeLevel
float quantizeLevel
quantization level: 0.0 = none requires use of GZIP or GZIP_SHUFFLE
Definition: fitsCompression.h:198
lsst::afw::fits::ImageCompressionOptions::algorithm
CompressionAlgorithm algorithm
Compresion algorithm to use.
Definition: fitsCompression.h:196
lsst::afw::fits::ImageCompressionOptions::PLIO
@ PLIO
PLIO compression.
Definition: fitsCompression.h:192
mask
afw::table::Key< afw::table::Array< MaskPixelT > > mask
Definition: HeavyFootprint.cc:217
std::copy
T copy(T... args)
lsst::afw::fits::ImageCompressionOptions::GZIP
@ GZIP
Standard GZIP compression.
Definition: fitsCompression.h:189
std::vector::cbegin
T cbegin(T... args)
std::vector::cend
T cend(T... args)
lsst::afw::fits::ImageCompressionOptions::NONE
@ NONE
No compression.
Definition: fitsCompression.h:188
lsst::afw::fits::ImageCompressionOptions::tiles
Tiles tiles
Tile size; a dimension with 0 means infinite (e.g., to specify one row: 0,1)
Definition: fitsCompression.h:197
lsst::afw::fits::ImageCompressionOptions::GZIP_SHUFFLE
@ GZIP_SHUFFLE
GZIP compression with shuffle (most-significant byte first)
Definition: fitsCompression.h:190
lsst::afw::fits::ImageCompressionOptions::RICE
@ RICE
RICE compression.
Definition: fitsCompression.h:191