Table of Contents

Class FitsFileWriter

Namespace
FitsModel.FitsStream.Writer
Assembly
FitsModel.dll

Parses FitsDataBlocks until a complete FitsHdu is read and then added to the File.

public class FitsFileWriter : DataBlockWriterBase, IFitsDataBlockWriter, IFitsHduReader, IFitsHeaderReader
Inheritance
FitsFileWriter
Implements
Inherited Members

Constructors

FitsFileWriter()

Parses FitsDataBlocks until a complete FitsHdu is read and then added to the File.

public FitsFileWriter()

Properties

AccumulateValues

If true, data values will be accumulated as they are read from the stream.

public bool AccumulateValues { get; set; }

Property Value

bool

BlocksRead

Total number of data blocks read by this file writer.

public int BlocksRead { get; }

Property Value

int

CalculateStatistics

If true, statistics will be calculated for HDU data as it is read.

public bool CalculateStatistics { get; set; }

Property Value

bool

File

The FITS file being written to. This will be null until the first HDU is written.

public FitsFile? File { get; }

Property Value

FitsFile

ReadImageOnly

If true, HDUs will be read until a 2D HDU is found.

public bool ReadImageOnly { get; set; }

Property Value

bool

ValueWriters

If CalculateStatistics or AccumulateValues is true, these will be set to value writers that perform those tasks."/>

public List<IFitsValueWriter?> ValueWriters { get; }

Property Value

List<IFitsValueWriter>

Methods

AddHeaderReader(IFitsHeaderReader)

Registers a IFitsHeaderReader instance that will be called each time a full header is read from the block stream.

public void AddHeaderReader(IFitsHeaderReader headerReader)

Parameters

headerReader IFitsHeaderReader

AddValueParser(IFitsDataBlockWriter)

Adds a IFitsDataBlockWriter to the current FitsHduWriter which will then receive FitsDataBlocks for the current HDU's data section. Note, these are reset after each HDU is read.

public void AddValueParser(IFitsDataBlockWriter dataBlockParser)

Parameters

dataBlockParser IFitsDataBlockWriter

Data block writer to process data as it is read from the block stream.

ReadFitsFile(FileInfo, bool, bool, bool)

Reads a FitsFile from the local file system.

public static Task<FitsFile> ReadFitsFile(FileInfo fileInfo, bool readImageOnly, bool calculateStats = false, bool accumulateValues = false)

Parameters

fileInfo FileInfo

File path to read.

readImageOnly bool

If true, HDUs will be read until a 2D HDU is found.

calculateStats bool

If true, statistics will be calculated for HDU data as it is read.

accumulateValues bool

If true, data values will be parsed and accumulated as they are read from the stream.

Returns

Task<FitsFile>

A FitsFile read from the local file system.

Exceptions

FitsModelException

Thrown if the file cannot be found on the local file system.

ReadFitsFile(Stream, bool, bool, bool)

Reads a FitsFile from the provided Stream.

public static Task<FitsFile> ReadFitsFile(Stream sourceStream, bool readImageOnly, bool calculateStats = false, bool accumulateValues = false)

Parameters

sourceStream Stream

Source stream for the FitsFile data.

readImageOnly bool

If true, HDUs will be read until a 2D HDU is found.

calculateStats bool

If true, statistics will be calculated for HDU data as it is read.

accumulateValues bool

If true, data values will be parsed and accumulated as they are read from the stream.

Returns

Task<FitsFile>

ReadHdu(FitsHdu)

Called when a full FitsHdu has been read from the data block stream. If this is the first HDU, a new FitsFile is created, otherwise the HDU is added to the existing File.

public void ReadHdu(FitsHdu hdu)

Parameters

hdu FitsHdu

FitsHdu that has been read from the block stream.

ReadHeader(FitsHeader)

Called when a full FitsHeader has been read from the data block stream.

public void ReadHeader(FitsHeader header)

Parameters

header FitsHeader

WriteDataBlock(FitsDataBlock)

Writes data blocks to an FitsHduWriter until a complete HDU is formed, then adds it to the File.

public override void WriteDataBlock(FitsDataBlock dataBlock)

Parameters

dataBlock FitsDataBlock