Table of Contents

Class FitsHdu

Namespace
FitsModel
Assembly
FitsModel.dll

Represents a single Header Data Unit (HDU) in a FITS file. More info about HDUs can be found in section 3.2. Individual FITS Structures
Also contains convenience methods to get statistics and normalize the data for use in images.

public class FitsHdu
Inheritance
FitsHdu
Inherited Members

Constructors

FitsHdu()

Create a default Primary HDU.

public FitsHdu()

FitsHdu(FitsHeader, FitsData?)

Creates a new instance of FitsHdu.

public FitsHdu(FitsHeader header, FitsData? data = null)

Parameters

header FitsHeader

Header for this HDU

data FitsData

Data for this HDU. Empty data is set if not provided.

Properties

BitsPerPixel

4.4.1.1. Primary header
The value field shall contain an integer. The absolute value is used in computing the sizes of data structures. It shall specify the number of bits that represent a data value in the associated data array. The only valid values of BITPIX are given here.

public BitPix BitsPerPixel { get; }

Property Value

BitPix

Header

The primary HDU and every extension HDU shall consist of one or more 2880-byte header blocks.

public FitsHeader Header { get; }

Property Value

FitsHeader

Height

The height of the image in pixels. If the header does not represent an image, this will be 0.

public int Height { get; }

Property Value

int

IsImage

A header is considered an image if it has exactly two axes (i.e., a 2D array).

public bool IsImage { get; }

Property Value

bool

NumberOfPixels

The number of pixels for the data array represented by this header.

public int NumberOfPixels { get; }

Property Value

int

RawData

Raw data for this HDU. Data is expected to be in big-endian format.

public FitsData RawData { get; }

Property Value

FitsData

ValueWriter

If set, this writer was used to read the data values for this HDU.

public IFitsValueWriter? ValueWriter { get; set; }

Property Value

IFitsValueWriter

Width

The width of the image in pixels. If the header does not represent an image, this will be 0.

public int Width { get; }

Property Value

int

Methods

CreateImageHdu(BitPix, int, int, List<string>?, byte[]?)

Creates a new image HDU with the provided parameters. If no data is provided, a new byte array of the correct size is created and filled with zeros.

public static FitsHdu CreateImageHdu(BitPix bitPix, int width, int height, List<string>? additionalEntries = null, byte[]? data = null)

Parameters

bitPix BitPix
width int
height int
additionalEntries List<string>
data byte[]

Returns

FitsHdu

Equals(object?)

public override bool Equals(object? obj)

Parameters

obj object

Returns

bool

GetHashCode()

public override int GetHashCode()

Returns

int

ToString()

public override string ToString()

Returns

string

ValidateIsExtensionHdu()

Throws an exception if this HDU is not an extension HDU.

public void ValidateIsExtensionHdu()

ValidateIsPrimaryHdu()

Throws and exception if this HDU is not a primary HDU.

public void ValidateIsPrimaryHdu()

WriteToStream(Stream)

Writes the header and data of this HDU to a stream until the cancellation token is triggered.

public Task WriteToStream(Stream stream)

Parameters

stream Stream

The stream to write to.

Returns

Task

WriteToStream(Stream, CancellationToken)

Writes the header and data of this HDU to a stream until the cancellation token is triggered.

public Task WriteToStream(Stream stream, CancellationToken cancellationToken)

Parameters

stream Stream

The stream to write to.

cancellationToken CancellationToken

Used to cancel writing to the stream if needed.

Returns

Task