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
FitsHeaderHeader for this HDU
data
FitsDataData 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
Header
The primary HDU and every extension HDU shall consist of one or more 2880-byte header blocks.
public FitsHeader Header { get; }
Property Value
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
IsImage
A header is considered an image if it has exactly two axes (i.e., a 2D array).
public bool IsImage { get; }
Property Value
NumberOfPixels
The number of pixels for the data array represented by this header.
public int NumberOfPixels { get; }
Property Value
RawData
Raw data for this HDU. Data is expected to be in big-endian format.
public FitsData RawData { get; }
Property Value
ValueWriter
If set, this writer was used to read the data values for this HDU.
public IFitsValueWriter? ValueWriter { get; set; }
Property Value
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
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
Returns
Equals(object?)
public override bool Equals(object? obj)
Parameters
obj
object
Returns
GetHashCode()
public override int GetHashCode()
Returns
ToString()
public override string ToString()
Returns
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
StreamThe stream to write to.
Returns
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
StreamThe stream to write to.
cancellationToken
CancellationTokenUsed to cancel writing to the stream if needed.