1 /*  Structure Definitions for KStars and StellarSolver Internal Library, developed by Robert Lancaster, 2020
2 
3     SPDX-License-Identifier: GPL-2.0-or-later
4 */
5 #ifndef STRUCTUREDEFINITIONS_H
6 #define STRUCTUREDEFINITIONS_H
7 
8 //system includes
9 #include "stdint.h"
10 #include <QString>
11 #include <QVector>
12 #include "math.h"
13 
14 namespace FITSImage
15 {
16 
17 /// Stats struct to hold statisical data about the FITS data
18 /// This is defined in both KStars and StellarSolver
19 typedef struct
20 {
21     double min[3] = {0}, max[3] = {0};
22     double mean[3] = {0};
23     double stddev[3] = {0};
24     double median[3] = {0};
25     double SNR { 0 };
26     /// FITS image data type (TBYTE, TUSHORT, TULONG, TFLOAT, TLONGLONG, TDOUBLE)
27     uint32_t dataType { 0 };
28     int bytesPerPixel { 1 };
29     int ndim { 2 };
30     int64_t size { 0 };
31     uint32_t samples_per_channel { 0 };
32     uint16_t width { 0 };
33     uint16_t height { 0 };
34     /// Number of channels
35     uint8_t channels { 1 };
36 } Statistic;
37 
38 // This structure holds data about sources that are found within
39 // an image.  It is returned by Source Extraction
40 typedef struct
41 {
42     float x;        // The x position of the star in Pixels
43     float y;        // The y position of the star in Pixels
44     float mag;      // The magnitude of the star
45     float flux;     // The calculated total flux
46     float peak;     // The peak value of the star
47     float HFR;      // The half flux radius
48     float a;        // The semi-major axis of the star
49     float b;        // The semi-minor axis of the star
50     float theta;    // The angle of orientation of the star
51     float ra;       // The right ascension of the star
52     float dec;      // The declination of the star
53     int numPixels;  // The number of pixels occupied by the star in the image.
54 } Star;
55 
56 // This struct holds data about the background in an image
57 // It is returned by source extraction
58 typedef struct
59 {
60     int bw, bh;        // single tile width, height
61     float global;      // global mean
62     float globalrms;   // global sigma
63     int num_stars_detected; // Number of stars detected before any reduction.
64 } Background;
65 
66 // This struct contains information about the astrometric solution
67 // for an image.
68 typedef struct
69 {
70     double fieldWidth;  // The calculated width of the field in arcminutes
71     double fieldHeight; // The calculated height of the field in arcminutes
72     double ra;          // The Right Ascension of the center of the field
73     double dec;         // The Declination of the center of the field
74     double orientation; // The orientation angle of the image from North in degrees
75     double pixscale;    // The pixel scale of the image
76     QString 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.
77     double raError;     // The error between the search_ra position and the solution ra position in arcseconds
78     double decError;    // The error between the search_dec position and the solution dec position in arcseconds
79 } Solution;
80 
81 } // FITSImage
82 
83 #endif // STRUCTUREDEFINITIONS_H
84