Skip to main content

Compression

Enum Compression 

Source
pub enum Compression {
    Rice,
    Gzip,
    ShuffledGzip,
    Hcompress {
        scale: i64,
    },
    Plio,
    None,
}
Expand description

Which algorithm the tiles are compressed with.

The convention defines several, and they suit different data. Rice is the usual choice for astronomical images: it is fast and, on data where each pixel is close to the one before it, it is the smallest of these. Gzip compresses anything at all, including floating point values that have not been quantised, which is what makes it the one lossless choice for a floating point image.

Variants§

§

Rice

RICE_1: the differences between neighbouring pixels, coded so that small ones are short. Integers only — a floating point image has to be quantised first.

§

Gzip

GZIP_1: deflate over the tile’s bytes as they stand.

§

ShuffledGzip

GZIP_2: deflate after gathering the first byte of every value, then the second, and so on, which usually compresses better because the high bytes of neighbouring values are alike.

§

Hcompress

HCOMPRESS_1: an image transform that gathers each two by two block into a sum and three differences, coded as a quadtree. It compresses smooth images better than Rice, and at a scale above one it does so by throwing away the low bits of each coefficient — which is lossy, and which ImageHDU::read_image can smooth back over.

A scale of zero or one keeps every bit. Tiles are two-dimensional, so this cannot be used with a tile that reaches along a third axis.

Fields

§scale: i64

What the transform’s coefficients are divided by.

§

Plio

PLIO_1: run-length coding for the integer masks IRAF writes, where a tile is mostly long runs of the same small number. Values must be non-negative and no wider than twenty-seven bits.

§

None

NOCOMPRESS: the tiles are stored as they are. Useful for writing a file in the tiled layout without paying to compress it.

Implementations§

Source§

impl Compression

Source

pub fn card_value(self) -> &'static str

The name a ZCMPTYPE card writes this algorithm under.

Trait Implementations§

Source§

impl Clone for Compression

Source§

fn clone(&self) -> Compression

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Copy for Compression

Source§

impl Debug for Compression

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for Compression

Source§

fn default() -> Compression

Returns the “default value” for a type. Read more
Source§

impl Eq for Compression

Source§

impl PartialEq for Compression

Source§

fn eq(&self, other: &Compression) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for Compression

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.