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
TData 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
bitsPerPixelBitPixNumber of bits used to represent each value in the FitsDataBlock
numValueslongTotal number of values expected to be read.
calculateStatsboolIf true, statistics will be calculated as values are read.
accumulateValuesboolIf 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
NumValues
Number of values expected to be read. This prevents us from reading padding data from FitsDataBlocks.
public override long NumValues { get; }
Property Value
StatsReader
Used to calculate statistics for values as they are read.
protected FitsStatsReader<T> StatsReader { get; }
Property Value
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
readerIFitsValueReader<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
bytesbyte[]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
valueT
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
dataBlockFitsDataBlockRaw value data in big-endian format.