Skip to content

Getting started usage examples

mostanes edited this page Apr 13, 2019 · 1 revision

Reading FITS files

Instantiate a FitsFile with the expected path and set OutputImage to false:

FitsFile file = new FitsFile("/path/to/file", false);

To read the images, call the FitsImage with the FitsFile argument. If the image lacks WCS information, set SkipWCS to true. For simple images, use the default Number (0). For multi-extension files, set the Number to the appropriate 1-based index of the file.

  • Read a simple Fits Image:

FitsImage img = new FitsImage(file);

  • Read the second extension image in a FITS file:

FitsImage img = new FitsImage(file, 2);

  • Read an image without WCS:

FitsImage img = new FitsImage(file, true);

Writing FITS files

Instantiate a FitsFile with OutputImage set to true.

FitsFile outfile = new FitsFile("/path/to/image", true);

The image is then created by instantiating a FitsImage with the desired headers:

FitsImage outimg = new FitsImage(outfile, Width, Height, Transform, BitPix);

Additional headers can be specified using ExtraProperties:

FitsImage outimg = new FitsImage(outfile, Width, Height, Transform, BitPix, new List<ImageProperties> {obstime});

Calling an algorithm

The easiest way to call an algorithm is by using the extension methods in SchedCore. Running an algorithm is then done simply by calling Run on its delegate. By default, the CPUParallel scheduler will be used, which distributes calls to the algorithm code over all processor cores.

Example:

RestrictedMean.RestrictedMeanFilter.Run(Kernel, Input, Output, RestrictedMean.Parameters(KernelRadius));

Clone this wiki locally