Table of Contents

Class FitsHdu

Namespace
Egami.Formats.Extended.Fits
Assembly
Egami.Formats.Extended.dll

One HDU of a FITS file: its header, and for an image, its BITPIX and axes. A tile-compressed image reports the image's own BITPIX and axes (ZBITPIX, ZNAXISn), not the table's.

public sealed class FitsHdu
Inheritance
FitsHdu
Inherited Members

Examples

// FitsFile lists every HDU with its header, tables included, and reads an image's values in file order.
FitsFile file = FitsFile.Load("m51.fits");
foreach (FitsHdu hdu in file.Hdus)
{
    Console.WriteLine($"HDU {hdu.Index}: {hdu.Kind}, {string.Join(" × ", hdu.Axes)}");
}

FitsHdu image = file.FirstImage!;
double exposure = image.Header.GetReal("EXPTIME") ?? 0;
double[] counts = file.ReadValues(image);
using Raster<GrayF32> plane = file.ReadPlane(image);

Properties

Axes

Gets the length of each axis, NAXIS1 (the row length) first.

public IReadOnlyList<long> Axes { get; }

Property Value

IReadOnlyList<long>

Bitpix

Gets BITPIX, the stored sample type: 8, 16, 32 or 64-bit integers, or -32 or -64 for floats.

public int Bitpix { get; }

Property Value

int

Compression

Gets the tile compression (ZCMPTYPE, such as RICE_1), or null.

public string? Compression { get; }

Property Value

string

Header

Gets the header cards.

public FitsHeader Header { get; }

Property Value

FitsHeader

Height

Gets the image's height, NAXIS2, or 0 when it holds no image.

public int Height { get; }

Property Value

int

Index

Gets the HDU's place in the file, from 0 for the primary HDU.

public int Index { get; }

Property Value

int

IsImage

Gets whether the HDU holds an image Egami reads: at least two axes, none of them 0.

public bool IsImage { get; }

Property Value

bool

Kind

Gets what the HDU holds.

public FitsHduKind Kind { get; }

Property Value

FitsHduKind

Planes

Gets the planes of a cube: the product of the axes after the second, 1 for a plain image.

public long Planes { get; }

Property Value

long

Width

Gets the image's width, NAXIS1, or 0 when it holds no image.

public int Width { get; }

Property Value

int