Accord.Imaging.Formats.FITSCodec.DecodeSingleFrame C# (CSharp) Method

DecodeSingleFrame() public method

Decode first frame of FITS image.
Not a FITS image format. Format of the FITS image is not supported. The stream contains invalid (broken) FITS image.
public DecodeSingleFrame ( Stream stream ) : Bitmap
stream Stream Source stream, which contains encoded image.
return System.Drawing.Bitmap
        public Bitmap DecodeSingleFrame(Stream stream)
        {
            FITSImageInfo imageInfo = ReadHeader(stream);

            // check if there any image frame
            if (imageInfo.TotalFrames == 0)
            {
                throw new ArgumentException("The FITS stream does not contain any image in main section.");
            }
            // read and return first frame
            return ReadImageFrame(stream, imageInfo);
        }