-
Notifications
You must be signed in to change notification settings - Fork 1
FITSImageSet
FITSImageSet class is an ArrayList object to hold, manage, and perform operations on a set of FITSImage objects.
FITSImageSet();
Constructor for the FITSImageSet class. Images can be added via .Add
public FITSImage this[int i]
FITSImageSet indexer accesses the FITSImage object in the FITSImageSet at a given index, i.e. FITSImage f = FITSImageSet[i].
public int Count
Returns the number of FITSImage objects currently held within the FITSImageSet.
public bool CoDimensional
Returns whether all primary images in the current FITSImageSet have the same dimension.
public string[] FullFileNames
Returns a String array of the full file names (path + file name) of all FITSImage objects in the current FITSImageSet.
public string[] FileNames
Returns a String array of the file names (excluding file path) of all FITSImage objects in the current FITSImageSet.
public string[] FilePaths
Returns a String array of the file paths (excluding file names) of all FITSImage objects in the current FITSImageSet.
bool Load(array<String^>^ files, array<int>^ range, bool do_stats, bool do_parallel, bool show_waitbar, String^ waitbar_message);
Loads FITS objects into the FITSImageSet. If the FITSImageSet already has members (not previously cleared), then the new members are added (appended) to this FITSImageSet.
-
files
The full path list of files to load into the set. -
range
Range is ZERO based 1-D int array [xmin xmax ymin ymax]. Pass nullptr or Range[0] = -1 to default to full image size. -
do_stats
Determine stats for each FITS object when loaded. -
do_parallel
Load the FITS files in parallel. -
show_waitbar
Optionally show a cancellable waitbar when loading. If cancelled, return value is false. -
waitbar_message
Message to display on Waitbar progress if it is shown.
bool Write(TypeCode precision, bool do_parallel, bool show_waitbar, String^ waitbar_message);
Write the FITSImage objects from the FITSImageSet to disk.
-
precision
The precision at which to write the image data. -
do_parallel
Write the images with parallelism. In the past with platter drives this would have been impossible, but fast solid state drives can handle it. If there's only a few images then don't bother, but useful when writing ~hundreds.
public bool WriteAsExtensions(string fileName, bool appendToExistingFile, bool firstAsPrimary, JPFITS.FITSHeader? primaryHeader, string[]? extensionNames, TypeCode[] imagePrecisions)
Write the FITSImage objects from the FITSImageSet as extensions.
-
appendToExistingFile
Option to write extensions into existing FITS file. Throws an exception if firstAsPrimary is true. -
primaryHeader
If the first image is not to be written as the primary data block, then a header may be supplied for the primary block. Pass null for default header. Throws an exception if firstAsPrimary is true and primaryHeader is not null. -
extensionNames
The names of the extensions. No elements may be empty strings; all elements must be unique. Pass null for automatic incremental naming as number ######. -
imagePrecisions
The precisions at which to write the image data. If a single element array is passed then this precision is applied to all images.
void Add(FITSImage^ FITS);
Appends a FITSImage object to the ArrayList FITSImageSet object.
void AddAt(int index, FITSImage^ FITS);
Inserts a FITSImage object to the ArrayList FITSImageSet object at a given index. If index is larger than the FITSImageSet count, the FITS object will be appended to the end.
void RemoveAt(int index);
Removes the FITSImage object at index from the FITSImageSet. If index is beyond the set size, nothing happens.
void RemoveFrom(int index);
Removes the FITSImage objects starting at index from the FITSImageSet. If index is beyond the set size, nothing happens.
void RemoveRange(int index, int count);
Removes the count range of FITSImage objects starting at index from the FITSImageSet. If index is beyond the set size, nothing happens. If index plus count is beyond the set size, all elements from index are removed.
String^ GetCommonDirectory();
Gets the common directory of the FITSImage objects in the FITSImageSet based on their file paths.
public int Sort(string key)
Sort sorts the FITSImageSet list given the key. Returns -1 if there was an error with the sort. If key is "filename" then the FITSImageSet list is sorted according to the member file names. For example if the file names are alphabetical or numeric then the FITSImageSet list will be sorted by increasing file name. Otherwise key is a primary header key and then their corresponding values will be used to sort by increasing value the FITSImageSet list.
public static string GetCommonDirectory(string[] filelist)
Gets the common directory of a series of file names, based on their file paths.
int Sort(String^ key);
Sort sorts the FITSImageSet list given the key. Returns -1 if there was an error with the sort.
-
key
If key is "filename" then the FITSImageSet list is sorted according to the member file names. For example if the file names are alphabetical or numeric then the FITSImageSet list will be sorted by increasing file name. Otherwise key is a primary header key and then their corresponding values will be used to sort the FITSImageSet list.
static FITSImage^ Mean(JPFITS::FITSImageSet^ ImageSet, bool Do_Stats, bool Show_Waitbar);
Create a FITSImage object with primary image that is the pixel-wise mean of the FITSImageSet primary images.
-
ImageSet
The FITSImageSet object. -
Do_Stats
Optionally perform the statistics to determine min, max, mean, median, and stdv of the FITSImage result - saves time if you don't need those. -
Show_Waitbar
Optionally compute the function with a cancellable Waitbar. If cancelled, return value is nullptr.
static FITSImage^ MeanClipped(JPFITS::FITSImageSet^ ImageSet, bool Do_Stats, double sigma);
Create a FITSImage object with primary image that is the pixel-wise sigma-clipped mean of the FITSImageSet primary images.
-
sigma
The maximum standard deviation allowed for each pixel column; values beyond sigma are clipped and replaced with the median of the pixel column.
static FITSImage^ Median(JPFITS::FITSImageSet^ ImageSet, bool Do_Stats, bool Show_Waitbar, String^ waitbar_message);
Create a FITSImage object with primary image that is the pixel-wise median of the FITSImageSet primary images.
static FITSImage^ Sum(JPFITS::FITSImageSet^ ImageSet, bool Do_Stats, bool Show_Waitbar);
Create a FITSImage object with primary image that is the pixel-wise sum of the FITSImageSet primary images.
static FITSImage^ Max(JPFITS::FITSImageSet^ ImageSet, bool Do_Stats, bool Show_Waitbar);
Create a FITSImage object with primary image that is the pixel-wise maximum of the FITSImageSet primary images.
static FITSImage^ Min(JPFITS::FITSImageSet^ ImageSet, bool Do_Stats, bool Show_Waitbar);
Create a FITSImage object with primary image that is the pixel-wise minimum of the FITSImageSet primary images.
static FITSImage^ Stdv(JPFITS::FITSImageSet^ ImageSet, bool Do_Stats, bool Show_Waitbar);
Create a FITSImage object with primary image that is the pixel-wise standard deviation of the FITSImageSet primary images.
static void Register(JPFITS::FITSImageSet^ ImageSet, int RefImgIndex, bool Do_Stats);
Auto-register non-rotational primary images from the FITSImageSet. Only works when there is no field rotation in the image set, only translational shifts, and the shifts are less than half of the field.
-
RefImgIndex
The index in the FitSet list of the reference image to register all the other images to.
static void GatherHeaders(JPFITS::FITSImageSet^ FITS_Set, FITSImage^ FITS_destination);
Scans all primary FITS headers in the FITSImageSet for identical lines and copies such lines to the specified FITSImage destination primary header. Usage is that perhaps you form the mean of the FITSImageSet as a new FITSImage, and this new FITSImage should contain all the primary header lines which are identical in the FITSImageSet. The existing primary header of the FITS_destination is cleared before the operation, except for essential keywords.
public static void GatherHeaders(string[] filenames, JPFITS.FITSImage FITS_destination)
Scans all primary FITS headers from the file names for identical lines and copies such lines to the specified FITSImage destination primary header.