public Bitmap DecodeFrame(int frameIndex, out ImageInfo imageInfo)
{
// check requested frame index
if (frameIndex >= this.imageInfo.TotalFrames)
{
throw new ArgumentOutOfRangeException("Currently opened stream does not contain frame with specified index.");
}
// seek to the required frame
stream.Seek(dataPosition + frameIndex * this.imageInfo.Width * this.imageInfo.Height *
Math.Abs(this.imageInfo.OriginalBitsPerPixl) / 8, SeekOrigin.Begin);
// read required frame
Bitmap image = ReadImageFrame(stream, this.imageInfo);
// provide also frame information
imageInfo = (FITSImageInfo)this.imageInfo.Clone();
imageInfo.FrameIndex = frameIndex;
return image;
}