Table of Contents

Enum FitsStretch

Namespace
Egami.Formats.Extended.Fits
Assembly
Egami.Formats.Extended.dll

How Load turns a FITS image's physical values into a picture.

public enum FitsStretch

Fields

Asinh = 3

The inverse hyperbolic sine of the min-max values, asinh(x / 0.1) / asinh(1 / 0.1): faint values rise steeply and bright ones compress, as in Lupton's colour images.

MinMax = 1

Linear from the smallest to the largest value, 0 to 1: DATAMIN and DATAMAX when the header has them, otherwise the image's own minimum and maximum. The default.

None = 0

No stretch: the physical values themselves, as float, with missing pixels NaN.

ZScale = 2

Linear between IRAF's zscale limits, astronomers' usual view: a line fitted to a sorted sample of up to 1000 pixels gives the range around the median, which shows faint detail and clips bright stars.

Examples

// ZScale shows faint detail the way astronomy viewers do; Asinh lifts the faint end and keeps the bright one.
using Raster zscale = Raster.Load("m51.fits", context, new FitsReaderOptions { Stretch = FitsStretch.ZScale });

// None keeps the physical values (BSCALE and BZERO applied, blanks as NaN) for measuring.
using Raster<GrayF32> values = Raster.Load<GrayF32>("m51.fits", context, new FitsReaderOptions { Stretch = FitsStretch.None });

// The header, and the values that became black and white, are in the details.
if (zscale.Metadata.FormatDetails is FitsDetails fits)
{
    Console.WriteLine($"{fits.Header.GetString("OBJECT")}: BITPIX {fits.Bitpix}, {fits.StretchLow} to {fits.StretchHigh}");
}

// A three-plane cube as one RGB image instead of three gray ones.
using Raster colour = Raster.Load("m51-rgb.fits", context, new FitsReaderOptions { Rgb = true });