Table of Contents

Class FitsValueWriter<T>

Namespace
FitsModel.FitsStream.Writer
Assembly
FitsModel.dll

Parses FitsDataBlocks into a list of values of type T.

public abstract class FitsValueWriter<T> : FitsValueWriterBase, IFitsDataBlockWriter, IFitsValueWriter where T : INumber<T>

Type Parameters

T

Data type that is used to represent values in a FitsDataBlock

Inheritance
FitsValueWriter<T>
Implements
Derived
Inherited Members

Constructors

FitsValueWriter(BitPix, long, bool, bool)

public FitsValueWriter(BitPix bitsPerPixel, long numValues, bool calculateStats = false, bool accumulateValues = false)

Parameters

bitsPerPixel BitPix

Number of bits used to represent each value in the FitsDataBlock

numValues long

Total number of values expected to be read.

calculateStats bool

If true, statistics will be calculated as values are read.

accumulateValues bool

If true, values will be stored for future processing.

Properties

DataStats

If CalculateStats is true, contains statistics about the values read so far.

public override FitsDataStats? DataStats { get; }

Property Value

FitsDataStats

NumValues

Number of values expected to be read. This prevents us from reading padding data from FitsDataBlocks.

public override long NumValues { get; }

Property Value

long

StatsReader

Used to calculate statistics for values as they are read.

protected FitsStatsReader<T> StatsReader { get; }

Property Value

FitsStatsReader<T>

Values

Collection of values parsed from the data blocks.

public List<T> Values { get; }

Property Value

List<T>

Methods

AddValueReader(IFitsValueReader<T>)

Adds a IFitsValueReader<T> instance that will be called each time a value is parsed from a data block.

public void AddValueReader(IFitsValueReader<T> reader)

Parameters

reader IFitsValueReader<T>

Reader that will process values as they are written.

ParseValue(byte[])

Parses a single value from the given byte array. Data is expected to be in the local machine's endianess.

public abstract T ParseValue(byte[] bytes)

Parameters

bytes byte[]

Raw byte data for a single value in the local machine's endianess.

Returns

T

ToBytes(T)

Converts the given 16-bit signed integer to a byte array in big-endian format.

public static byte[] ToBytes(T value)

Parameters

value T

Returns

byte[]

WriteDataBlock(FitsDataBlock)

Parses the dataBlock into values of type T and adds them to the Values collection.

public override void WriteDataBlock(FitsDataBlock dataBlock)

Parameters

dataBlock FitsDataBlock

Raw value data in big-endian format.