Table of Contents

Class FitsFile

Namespace
FitsModel
Assembly
FitsModel.dll

A simple collection of FitsHdu objects.

public class FitsFile : List<FitsHdu>, IList<FitsHdu>, ICollection<FitsHdu>, IList, ICollection, IReadOnlyList<FitsHdu>, IReadOnlyCollection<FitsHdu>, IEnumerable<FitsHdu>, IEnumerable
Inheritance
FitsFile
Implements
Inherited Members

Constructors

FitsFile()

Creates a new FitsFile with a single primary FitsHdu.

public FitsFile()

FitsFile(FitsHdu)

Creates a new FitsFile with the specified primary FitsHdu.

public FitsFile(FitsHdu hdu)

Parameters

hdu FitsHdu

FitsFile(List<FitsHdu>)

Creates a new FitsFile with the specified HDUs.

public FitsFile(List<FitsHdu> hdus)

Parameters

hdus List<FitsHdu>

Exceptions

FitsModelException

Thrown if no HDUs are provided or the primary and extension HDUs are not valid.

Methods

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

Creates a new FitsFile with a single image FitsHdu.

public static FitsFile CreateImageFile(BitPix bitPix, int width, int height, List<string>? additionalEntries = null, byte[]? imageData = null)

Parameters

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

Returns

FitsFile

Download(Uri, Stream, CancellationToken)

public static Task Download(Uri uri, Stream stream, CancellationToken cancellationToken)

Parameters

uri Uri
stream Stream
cancellationToken CancellationToken

Returns

Task

Exceptions

FitsModelException
NotImplementedException

DownloadFitsFile(Uri, FitsDataBlockStream)

public static Task<FitsFile> DownloadFitsFile(Uri uri, FitsDataBlockStream blockStream)

Parameters

uri Uri
blockStream FitsDataBlockStream

Returns

Task<FitsFile>

DownloadFitsFile(Uri, bool)

Downloads a FITS file from the specified URI.

public static Task<FitsFile> DownloadFitsFile(Uri uri, bool readImageOnly = true)

Parameters

uri Uri
readImageOnly bool

Returns

Task<FitsFile>

Exceptions

NotImplementedException

Equals(object?)

public override bool Equals(object? obj)

Parameters

obj object

Returns

bool

GetFirstImageHdu()

Gets and validates the first image HDU in this file if it exists.

public FitsHdu? GetFirstImageHdu()

Returns

FitsHdu

The first image in this file. null otherwise.

GetHashCode()

public override int GetHashCode()

Returns

int

GetPrimaryHdu()

Gets and validates this file's primary HDU if it exists.

public FitsHdu? GetPrimaryHdu()

Returns

FitsHdu

The primary HDU for this file. null otherwise

ToString()

String representation of the number of FitsHdus in this file.

public override string ToString()

Returns

string

ValidateFile()

Throws an exception if this FITS file is not valid.

public void ValidateFile()

Exceptions

FitsModelException

WriteToFile(FileInfo)

Writes this FITS File to a file.

public Task WriteToFile(FileInfo fileInfo)

Parameters

fileInfo FileInfo

Returns

Task

WriteToFileSync(FileInfo)

Writes data to the specified file.

public void WriteToFileSync(FileInfo fileInfo)

Parameters

fileInfo FileInfo

The file to which the data will be written. Cannot be null.

WriteToStream(FitsDataBlockStream)

Writes the contents of this FITS file to a FitsDataBlockStream and uses its cancellation token to stop writing if needed.

public Task WriteToStream(FitsDataBlockStream dataBlockStream)

Parameters

dataBlockStream FitsDataBlockStream

Returns

Task

WriteToStream(Stream)

Writes this FITS File to a stream.

public Task WriteToStream(Stream stream)

Parameters

stream Stream

Returns

Task

WriteToStream(Stream, CancellationToken)

Writes the contents of this FITS file 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

Use this to indicate when we can finish writing to the stream.

Returns

Task