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
BlocksRead
Total number of data blocks read by this file writer.
public int BlocksRead { get; }
Property Value
CalculateStatistics
If true, statistics will be calculated for HDU data as it is read.
public bool CalculateStatistics { get; set; }
Property Value
File
The FITS file being written to. This will be null until the first HDU is written.
public FitsFile? File { get; }
Property Value
ReadImageOnly
If true, HDUs will be read until a 2D HDU is found.
public bool ReadImageOnly { get; set; }
Property Value
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
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
IFitsDataBlockWriterData 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
FileInfoFile path to read.
readImageOnly
boolIf true, HDUs will be read until a 2D HDU is found.
calculateStats
boolIf true, statistics will be calculated for HDU data as it is read.
accumulateValues
boolIf true, data values will be parsed and accumulated as they are read from the stream.
Returns
Exceptions
- FitsModelException
Thrown if the file cannot be found on the local file system.
ReadFitsFile(Stream, bool, bool, bool)
public static Task<FitsFile> ReadFitsFile(Stream sourceStream, bool readImageOnly, bool calculateStats = false, bool accumulateValues = false)
Parameters
sourceStream
StreamSource stream for the FitsFile data.
readImageOnly
boolIf true, HDUs will be read until a 2D HDU is found.
calculateStats
boolIf true, statistics will be calculated for HDU data as it is read.
accumulateValues
boolIf true, data values will be parsed and accumulated as they are read from the stream.
Returns
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
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