Skip to content

Commit adcbee0

Browse files
author
Antoine Basset
committed
Add compression doc TLDR
1 parent ac72e4d commit adcbee0

File tree

1 file changed

+19
-5
lines changed

1 file changed

+19
-5
lines changed

doc/compression.dox

Lines changed: 19 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,20 @@ namespace Fits {
99
\tableofcontents
1010

1111

12+
\section compression-tldr TL;DR
13+
14+
15+
To enable the compression of image HDUs, simply activate one compression strategy, like `CompressAuto` as follows:
16+
17+
\code
18+
MefFile f(filename, FileMode::Create);
19+
f.strategy(CompressAuto(CompressionType::LosslessInts)); // Activate compression
20+
f.append_image("", {}, raster); // Automatically compressed
21+
\endcode
22+
23+
At read-time, nothing special has to be done.
24+
25+
1226
\section compression-intro External vs. Internal Compressions
1327

1428

@@ -142,7 +156,7 @@ The simplest compression action is made of a single compression algorithm, `Comp
142156
which consists in applying the same compression algorithm to all HDUs unless impossible.
143157
A list of such actions can build up a compression strategy which selects the preferred algorithm which works.
144158
For example, registering `Compress<Plio>` and then `Compress<Rice>` will activate PLIO if possible, and Rice otherwise,
145-
or not comress at all if the HDU is very small.
159+
or not compress at all if the HDU is very small.
146160

147161
More elaborated actions can be user-defined by extending the base class `CompressionAction`
148162
(e.g. to use PLIO only for HDUs whose name ends with "MASK").
@@ -179,14 +193,14 @@ This way, compressing and decompressing the file returns the original file.
179193

180194
\code
181195
# Default: copy the Primary
182-
EleFitsCompress uncompressed.fits compressed.fits
196+
EleFitsCompress original.fits compressed.fits
183197
EleFitsDecompress compressed.fits decompressed.fits
184-
# decompressed.fits = uncompressed.fits
198+
# decompressed.fits = original.fits
185199

186200
# Compress the Primary, too
187-
EleFitsCompress uncompressed.fits compressed.fits --primary
201+
EleFitsCompress original.fits compressed.fits --primary
188202
EleFitsDecompress compressed.fits decompressed.fits
189-
# decompressed.fits = empty Primary + uncompressed.fits
203+
# decompressed.fits = empty Primary + original.fits
190204
\endcode
191205

192206

0 commit comments

Comments
 (0)