File indexing completed on 2024-04-14 03:42:30

0001 /*  Structure Definitions for KStars and StellarSolver Internal Library, developed by Robert Lancaster, 2020
0002 
0003     SPDX-License-Identifier: GPL-2.0-or-later
0004 */
0005 #ifndef STRUCTUREDEFINITIONS_H
0006 #define STRUCTUREDEFINITIONS_H
0007 
0008 //system includes
0009 #include <stdint.h>
0010 #include <math.h>
0011 #include <QString>
0012 
0013 namespace FITSImage
0014 {
0015 
0016 typedef enum
0017 {
0018     POSITIVE,
0019     NEGATIVE,
0020     BOTH
0021 } Parity;
0022 
0023 static const QString getParityText(Parity parity){
0024     return parity == FITSImage::NEGATIVE ? "negative" : "positive";
0025 }
0026 
0027 static const QString getShortParityText(Parity parity){
0028     return parity == FITSImage::NEGATIVE ? "neg" : "pos";
0029 }
0030 
0031 // Stats struct to hold statisical data about the FITS data
0032 typedef struct Statistic
0033 {
0034     double min[3] = {0}, max[3] = {0};  // Minimum and Maximum R, G, B pixel values in the image
0035     double mean[3] = {0};               // Average R, G, B value of the pixels in the image
0036     double stddev[3] = {0};             // Standard Deviation of the R, G, B pixel values in the image
0037     double median[3] = {0};             // Median R, G, B pixel value in the image
0038     double SNR { 0 };                   // Signal to noise ratio
0039     uint32_t dataType { 0 };            // FITS image data type (TBYTE, TUSHORT, TULONG, TFLOAT, TLONGLONG, TDOUBLE)
0040     int bytesPerPixel { 1 };            // Number of bytes used for each pixel, size of datatype above
0041     int ndim { 2 };                     // Number of dimensions in a fits image
0042     int64_t size { 0 };                 // Filesize in bytes
0043     uint32_t samples_per_channel { 0 }; // area of the image in pixels
0044     uint16_t width { 0 };               // width of the image in pixels
0045     uint16_t height { 0 };              // height of the image in pixels
0046     uint8_t channels { 1 };             // Mono Images have 1 channel, RGB has 3 channels
0047 } Statistic;
0048 
0049 // This structure holds data about sources that are found within
0050 // an image.  It is returned by Source Extraction
0051 typedef struct Star
0052 {
0053     float x;        // The x position of the star in Pixels
0054     float y;        // The y position of the star in Pixels
0055     float mag;      // The magnitude of the star, note that this is a relative magnitude based on the star extraction options.
0056     float flux;     // The calculated total flux
0057     float peak;     // The peak value of the star
0058     float HFR;      // The half flux radius of the star
0059     float a;        // The semi-major axis of the star
0060     float b;        // The semi-minor axis of the star
0061     float theta;    // The angle of orientation of the star
0062     float ra;       // The right ascension of the star
0063     float dec;      // The declination of the star
0064     int numPixels;  // The number of pixels occupied by the star in the image.
0065 } Star;
0066 
0067 // This struct holds data about the background in an image
0068 // It is returned by source extraction
0069 typedef struct Background
0070 {
0071     int bw, bh;             // single tile width, height
0072     float global;           // global mean
0073     float globalrms;        // global sigma
0074     int num_stars_detected; // Number of stars detected before any reduction.
0075 } Background;
0076 
0077 // This struct contains information about the astrometric solution
0078 // for an image.
0079 typedef struct Solution
0080 {
0081     double fieldWidth;  // The calculated width of the field in arcminutes
0082     double fieldHeight; // The calculated height of the field in arcminutes
0083     double ra;          // The Right Ascension of the center of the field in degrees
0084     double dec;         // The Declination of the center of the field in degrees
0085     double orientation; // The orientation angle of the image from North in degrees
0086     double pixscale;    // The pixel scale of the image in arcseconds per pixel
0087     Parity parity;      // The parity of the solved image. (Whether it has been flipped)  JPEG images tend to have negative parity while FITS files tend to have positive parity.
0088     double raError;     // The error between the search_ra position and the solution ra position in arcseconds
0089     double decError;    // The error between the search_dec position and the solution dec position in arcseconds
0090 } Solution;
0091 
0092 // This is point in the World Coordinate System with both RA and DEC.
0093 typedef struct wcs_point
0094 {
0095     float ra;           // The Right Ascension in degrees
0096     float dec;          // The Declination in degrees
0097 } wcs_point;
0098 
0099 } // FITSImage
0100 
0101 #endif // STRUCTUREDEFINITIONS_H