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