Kstars

fitsdata.h
1/*
2 SPDX-FileCopyrightText: 2004 Jasem Mutlaq <mutlaqja@ikarustech.com>
3
4 SPDX-License-Identifier: GPL-2.0-or-later
5
6 Some code fragments were adapted from Peter Kirchgessner's FITS plugin
7 SPDX-FileCopyrightText: Peter Kirchgessner <http://members.aol.com/pkirchg>
8*/
9
10#pragma once
11
12#include "config-kstars.h"
13
14// From StellarSolver
15#ifdef HAVE_STELLARSOLVER
16#include <structuredefinitions.h>
17#else
18#include "structuredefinitions.h"
19#endif
20
21#include "kstarsdatetime.h"
22#include "bayer.h"
23#include "skybackground.h"
24#include "fitscommon.h"
25#include "fitsstardetector.h"
26#include "auxiliary/imagemask.h"
27
28#ifdef WIN32
29// This header must be included before fitsio.h to avoid compiler errors with Visual Studio
30#include <windows.h>
31#endif
32
33#include <fitsio.h>
34
35#include <QFuture>
36#include <QObject>
37#include <QRect>
38#include <QVariant>
39#include <QTemporaryFile>
40
41#ifndef KSTARS_LITE
42#include <kxmlguiwindow.h>
43#ifdef HAVE_WCSLIB
44#include <wcs.h>
45#endif
46#endif
47
48#include "fitsskyobject.h"
49
50class QProgressDialog;
51
52class SkyPoint;
54class Edge;
55
56class FITSData : public QObject
57{
59
60 // Name of FITS file
61 Q_PROPERTY(QString filename READ filename)
62 // Extension
63 Q_PROPERTY(QString extension READ extension)
64 // Size of file in bytes
65 Q_PROPERTY(qint64 size READ size)
66 // Width in pixels
67 Q_PROPERTY(quint16 width READ width)
68 // Height in pixels
69 Q_PROPERTY(quint16 height READ height)
70 // FITS MODE --> Normal, Focus, Guide..etc
71 Q_PROPERTY(FITSMode mode MEMBER m_Mode)
72 // 1 channel (grayscale) or 3 channels (RGB)
73 Q_PROPERTY(quint8 channels READ channels)
74 // Bits per pixel
75 Q_PROPERTY(quint8 bpp READ bpp)
76 // Does FITS have WSC header?
77 Q_PROPERTY(bool hasWCS READ hasWCS)
78 // Does FITS have bayer data?
79 Q_PROPERTY(bool hasDebayer READ hasDebayer)
80
81 public:
82 explicit FITSData(FITSMode fitsMode = FITS_NORMAL);
83 explicit FITSData(const QSharedPointer<FITSData> &other);
84 ~FITSData() override;
85
86 /** Object to hold FITS Header records */
87 struct Record
88 {
89 Record() = default;
90 Record(QString k, QString v, QString c) : key(k), value(v), comment(c) {}
91 QString key; /** FITS Header Key */
92 QVariant value; /** FITS Header Value */
93 QString comment; /** FITS Header Comment, if any */
94 };
95
96 typedef enum
97 {
98 Idle,
99 Busy,
100 Success,
101 Failure
102 } WCSState;
103
104 ////////////////////////////////////////////////////////////////////////////////////////
105 ////////////////////////////////////////////////////////////////////////////////////////
106 /// Read and Write file/buffer Functions.
107 ////////////////////////////////////////////////////////////////////////////////////////
108 ////////////////////////////////////////////////////////////////////////////////////////
109 /**
110 * @brief loadFITS Loading FITS file asynchronously.
111 * @param inFilename Path to FITS file (or compressed fits.gz)
112 * @return A QFuture that can be watched until the async operation is complete.
113 */
114 QFuture<bool> loadFromFile(const QString &inFilename);
115
116 /**
117 * @brief loadFITSFromMemory Loading FITS from memory buffer.
118 * @param buffer The memory buffer containing the fits data.
119 * @return bool indicating success or failure.
120 */
121 bool loadFromBuffer(const QByteArray &buffer);
122
123 /**
124 * @brief parseSolution Parse the WCS solution information from the header into the given struct.
125 * @param solution Solution structure to fill out.
126 * @return True if parsing successful, false otherwise.
127 */
128 bool parseSolution(FITSImage::Solution &solution) const;
129
130 /* Save FITS or JPG/PNG*/
131 bool saveImage(const QString &newFilename);
132
133 // Access functions
134 void clearImageBuffers();
135 void setImageBuffer(uint8_t *buffer);
136 uint8_t const *getImageBuffer() const;
137 uint8_t *getWritableImageBuffer();
138
139 ////////////////////////////////////////////////////////////////////////////////////////
140 ////////////////////////////////////////////////////////////////////////////////////////
141 /// Statistics Functions.
142 ////////////////////////////////////////////////////////////////////////////////////////
143 ////////////////////////////////////////////////////////////////////////////////////////
144 // Calculate stats
145 void calculateStats(bool refresh = false, bool roi = false);
146 void saveStatistics(FITSImage::Statistic &other);
147 void restoreStatistics(FITSImage::Statistic &other);
148 FITSImage::Statistic const &getStatistics() const
149 {
150 return m_Statistics;
151 }
152
153 uint16_t width(bool roi = false) const
154 {
155 return roi ? m_ROIStatistics.width : m_Statistics.width;
156 }
157 uint16_t height(bool roi = false) const
158 {
159 return roi ? m_ROIStatistics.height : m_Statistics.height;
160 }
161 int64_t size(bool roi = false) const
162 {
163 return roi ? m_ROIStatistics.size : m_Statistics.size;
164 }
165 int channels() const
166 {
167 return m_Statistics.channels;
168 }
169 uint32_t samplesPerChannel(bool roi = false) const
170 {
171 return roi ? m_ROIStatistics.samples_per_channel : m_Statistics.samples_per_channel;
172 }
173 uint32_t dataType() const
174 {
175 return m_Statistics.dataType;
176 }
177 double getMin(uint8_t channel = 0, bool roi = false) const
178 {
179 return roi ? m_ROIStatistics.min[channel] : m_Statistics.min[channel];
180 }
181 double getMax(uint8_t channel = 0, bool roi = false) const
182 {
183 return roi ? m_ROIStatistics.max[channel] : m_Statistics.max[channel];
184
185 }
186 void setMinMax(double newMin, double newMax, uint8_t channel = 0);
187 void getMinMax(double *min, double *max, uint8_t channel = 0) const
188 {
189 *min = m_Statistics.min[channel];
190 *max = m_Statistics.max[channel];
191 }
192 void setStdDev(double value, uint8_t channel = 0)
193 {
194 m_Statistics.stddev[channel] = value;
195 }
196 double getStdDev(uint8_t channel = 0, bool roi = false ) const
197 {
198 return roi ? m_ROIStatistics.stddev[channel] : m_Statistics.stddev[channel];
199 }
200 double getAverageStdDev(bool roi = false) const;
201 void setMean(double value, uint8_t channel = 0)
202 {
203 m_Statistics.mean[channel] = value;
204 }
205 double getMean(uint8_t channel = 0, bool roi = false) const
206 {
207 return roi ? m_ROIStatistics.mean[channel] : m_Statistics.mean[channel];
208 }
209 // for single channel, just return the mean for channel zero
210 // for color, return the average
211 double getAverageMean(bool roi = false) const;
212 void setMedian(double val, uint8_t channel = 0)
213 {
214 m_Statistics.median[channel] = val;
215 }
216 // for single channel, just return the median for channel zero
217 // for color, return the average
218 double getAverageMedian(bool roi = false) const;
219 double getMedian(uint8_t channel = 0, bool roi = false) const
220 {
221 return roi ? m_ROIStatistics.median[channel] : m_Statistics.median[channel];
222 }
223
224 int getBytesPerPixel() const
225 {
226 return m_Statistics.bytesPerPixel;
227 }
228 void setSNR(double val)
229 {
230 m_Statistics.SNR = val;
231 }
232 double getSNR() const
233 {
234 return m_Statistics.SNR;
235 }
236 uint32_t bpp() const
237 {
238 switch(m_Statistics.dataType)
239 {
240 case TBYTE:
241 return 8;
242 case TSHORT:
243 case TUSHORT:
244 return 16;
245 case TLONG:
246 case TULONG:
247 case TFLOAT:
248 return 32;
249 case TLONGLONG:
250 case TDOUBLE:
251 return 64;
252 default:
253 return 8;
254 }
255 }
256 double getADU() const;
257
258 ////////////////////////////////////////////////////////////////////////////////////////
259 ////////////////////////////////////////////////////////////////////////////////////////
260 /// FITS Header Functions.
261 ////////////////////////////////////////////////////////////////////////////////////////
262 ////////////////////////////////////////////////////////////////////////////////////////
263 // FITS Record
264 bool getRecordValue(const QString &key, QVariant &value) const;
265 const QList<Record> &getRecords() const
266 {
267 return m_HeaderRecords;
268 }
269
270 ////////////////////////////////////////////////////////////////////////////////////////
271 ////////////////////////////////////////////////////////////////////////////////////////
272 /// Star Search & HFR Functions.
273 ////////////////////////////////////////////////////////////////////////////////////////
274 ////////////////////////////////////////////////////////////////////////////////////////
275 // Star Detection - Native KStars implementation
276 void setStarAlgorithm(StarAlgorithm algorithm)
277 {
278 starAlgorithm = algorithm;
279 }
280 int getDetectedStars() const
281 {
282 return starCenters.count();
283 }
284 bool areStarsSearched() const
285 {
286 return starsSearched;
287 }
288 void appendStar(Edge *newCenter)
289 {
290 starCenters.append(newCenter);
291 }
292 const QList<Edge *> &getStarCenters() const
293 {
294 return starCenters;
295 }
296 QList<Edge *> getStarCentersInSubFrame(QRect subFrame) const;
297
298 void setStarCenters(const QList<Edge*> &centers)
299 {
300 qDeleteAll(starCenters);
301 starCenters = centers;
302 }
303 QFuture<bool> findStars(StarAlgorithm algorithm = ALGORITHM_CENTROID, const QRect &trackingBox = QRect());
304
305 void setSkyBackground(const SkyBackground &bg)
306 {
307 m_SkyBackground = bg;
308 }
309 const SkyBackground &getSkyBackground() const
310 {
311 return m_SkyBackground;
312 }
313 const QVariantMap &getSourceExtractorSettings() const
314 {
315 return m_SourceExtractorSettings;
316 }
317 void setSourceExtractorSettings(const QVariantMap &settings)
318 {
319 m_SourceExtractorSettings = settings;
320 }
321 // Use SEP (Sextractor Library) to find stars
322 template <typename T>
323 void getFloatBuffer(float *buffer, int x, int y, int w, int h) const;
324 //int findSEPStars(QList<Edge*> &, const int8_t &boundary = int8_t()) const;
325
326 // filter all stars that are visible through the given mask
327 int filterStars(QSharedPointer<ImageMask> mask);
328
329 // Half Flux Radius
330 const Edge &getSelectedHFRStar() const
331 {
332 return m_SelectedHFRStar;
333 }
334
335 // Calculates the median star eccentricity.
336 double getEccentricity();
337
338 double getHFR(HFRType type = HFR_AVERAGE);
339 double getHFR(int x, int y, double scale = 1.0);
340
341 ////////////////////////////////////////////////////////////////////////////////////////
342 ////////////////////////////////////////////////////////////////////////////////////////
343 /// Date & Time (WCS) Functions.
344 ////////////////////////////////////////////////////////////////////////////////////////
345 ////////////////////////////////////////////////////////////////////////////////////////
346
347 const KStarsDateTime &getDateTime() const
348 {
349 return m_DateTime;
350 }
351
352 // Set the time, for testing (doesn't set header field)
353 void setDateTime(const KStarsDateTime &t)
354 {
355 m_DateTime = t;
356 }
357
358 const QPoint getRoiCenter() const
359 {
360 return roiCenter;
361 }
362
363 void setRoiCenter(QPoint c)
364 {
365 roiCenter = c;
366 }
367
368 ////////////////////////////////////////////////////////////////////////////////////////
369 ////////////////////////////////////////////////////////////////////////////////////////
370 /// World Coordinate System (WCS) Functions.
371 ////////////////////////////////////////////////////////////////////////////////////////
372 ////////////////////////////////////////////////////////////////////////////////////////
373 // Check if a particular point exists within the image
374 bool contains(const QPointF &point) const;
375 // Does image have valid WCS?
376 bool hasWCS()
377 {
378 return HasWCS;
379 }
380 // Load WCS data
381 bool loadWCS();
382 // Get WCS State
383 WCSState getWCSState() const
384 {
385 return m_WCSState;
386 }
387
388 /**
389 * @brief wcsToPixel Given J2000 (RA0,DE0) coordinates. Find in the image the corresponding pixel coordinates.
390 * @param wcsCoord Coordinates of target
391 * @param wcsPixelPoint Return XY FITS coordinates
392 * @param wcsImagePoint Return XY Image coordinates
393 * @return True if conversion is successful, false otherwise.
394 */
395 bool wcsToPixel(const SkyPoint &wcsCoord, QPointF &wcsPixelPoint, QPointF &wcsImagePoint);
396
397 /**
398 * @brief pixelToWCS Convert Pixel coordinates to J2000 world coordinates
399 * @param wcsPixelPoint Pixel coordinates in XY Image space.
400 * @param wcsCoord Store back WCS world coordinate in wcsCoord
401 * @return True if successful, false otherwise.
402 */
403 bool pixelToWCS(const QPointF &wcsPixelPoint, SkyPoint &wcsCoord);
404
405 /**
406 * @brief injectWCS Add WCS keywords
407 * @param orientation Solver orientation, degrees E of N.
408 * @param ra J2000 Right Ascension
409 * @param dec J2000 Declination
410 * @param pixscale Pixel scale in arcsecs per pixel
411 * @param eastToTheRight if true, then when the image is rotated so that north is up, then east would be to the right on the image.
412 */
413 void injectWCS(double orientation, double ra, double dec, double pixscale, bool eastToTheRight);
414
415 ////////////////////////////////////////////////////////////////////////////////////////
416 ////////////////////////////////////////////////////////////////////////////////////////
417 /// Debayering Functions
418 ////////////////////////////////////////////////////////////////////////////////////////
419 ////////////////////////////////////////////////////////////////////////////////////////
420
421 // Debayer
422 bool hasDebayer()
423 {
424 return HasDebayer;
425 }
426
427 /**
428 * @brief debayer the 1-channel data to 3-channel RGB using the default debayer pattern detected in the FITS header.
429 * @param reload If true, it will read the image again from disk before performing debayering. This is necessary to attempt
430 * subsequent debayering processes on an already debayered image.
431 */
432 bool debayer(bool reload = false);
433 bool debayer_8bit();
434 bool debayer_16bit();
435 void getBayerParams(BayerParams *param);
436 void setBayerParams(BayerParams *param);
437
438 ////////////////////////////////////////////////////////////////////////////////////////
439 ////////////////////////////////////////////////////////////////////////////////////////
440 /// Public Histogram Functions
441 ////////////////////////////////////////////////////////////////////////////////////////
442 ////////////////////////////////////////////////////////////////////////////////////////
443
444 void resetHistogram()
445 {
446 m_HistogramConstructed = false;
447 }
448 double getHistogramBinWidth(int channel = 0)
449 {
450 return m_HistogramBinWidth[channel];
451 }
452
453 // Returns a vector with the counts (y-axis values) for the histogram.
454 const QVector<uint32_t> &getCumulativeFrequency(uint8_t channel = 0) const
455 {
456 return m_CumulativeFrequency[channel];
457 }
458 // Returns a vector with the values (x-axis values) for the histogram.
459 // The value returned is the low end of the histogram interval.
460 // The high end is this intensity plus the value returned by getHistogramBinWidth().
461 const QVector<double> &getHistogramIntensity(uint8_t channel = 0) const
462 {
463 return m_HistogramIntensity[channel];
464 }
465 const QVector<double> &getHistogramFrequency(uint8_t channel = 0) const
466 {
467 return m_HistogramFrequency[channel];
468 }
469 int getHistogramBinCount() const
470 {
471 return m_HistogramBinCount;
472 }
473
474 // Returns the histogram bin for the pixel at location x,y in the given channel.
475 int32_t histogramBin(int x, int y, int channel) const;
476
477 /**
478 * @brief getJMIndex Overall contrast of the image used in find centeroid algorithm. i.e. is the image diffuse?
479 * @return Value of JMIndex
480 */
481 double getJMIndex() const
482 {
483 return m_JMIndex;
484 }
485
486 bool isHistogramConstructed() const
487 {
488 return m_HistogramConstructed;
489 }
490 void constructHistogram();
491
492 ////////////////////////////////////////////////////////////////////////////////////////
493 ////////////////////////////////////////////////////////////////////////////////////////
494 /// Filters and Rotations Functions.
495 ////////////////////////////////////////////////////////////////////////////////////////
496 ////////////////////////////////////////////////////////////////////////////////////////
497 // Filter
498 void applyFilter(FITSScale type, uint8_t *image = nullptr, QVector<double> *targetMin = nullptr,
499 QVector<double> *targetMax = nullptr);
500
501 // Rotation counter. We keep count to rotate WCS keywords on save
502 int getRotCounter() const;
503 void setRotCounter(int value);
504
505 // Filename
506 const QString &filename() const
507 {
508 return m_Filename;
509 }
510 void setFilename(QString &filename)
511 {
512 m_Filename = filename;
513 }
514 const QString &compressedFilename() const
515 {
516 return m_compressedFilename;
517 }
518 bool isCompressed() const
519 {
520 return m_isCompressed;
521 }
522 // Extension
523 const QString &extension() const
524 {
525 return m_Extension;
526 }
527 void setExtension(const QString &extension)
528 {
529 m_Extension = extension;
530 }
531
532 // Horizontal flip counter. We keep count to rotate WCS keywords on save
533 int getFlipHCounter() const;
534 void setFlipHCounter(int value);
535
536 // Horizontal flip counter. We keep count to rotate WCS keywords on save
537 int getFlipVCounter() const;
538 void setFlipVCounter(int value);
539
540 ////////////////////////////////////////////////////////////////////////////////////////
541 ////////////////////////////////////////////////////////////////////////////////////////
542 /// Object Search Functions.
543 ////////////////////////////////////////////////////////////////////////////////////////
544 ////////////////////////////////////////////////////////////////////////////////////////
545#ifndef KSTARS_LITE
546#ifdef HAVE_WCSLIB
547 bool searchObjects();
548 bool findObjectsInImage(SkyPoint startPoint, SkyPoint endPoint);
549 bool findWCSBounds(double &minRA, double &maxRA, double &minDec, double &maxDec);
550#endif
551#endif
552 const QList<FITSSkyObject *> &getSkyObjects() const
553 {
554 return m_SkyObjects;
555 }
556
557 ////////////////////////////////////////////////////////////////////////////////////////
558 ////////////////////////////////////////////////////////////////////////////////////////
559 /// Image Conversion Functions.
560 ////////////////////////////////////////////////////////////////////////////////////////
561 ////////////////////////////////////////////////////////////////////////////////////////
562 // Create autostretch image from FITS File
563 static QImage FITSToImage(const QString &filename);
564
565 /**
566 * @brief ImageToFITS Convert an image file with supported format to a FITS file.
567 * @param filename full path to filename without extension
568 * @param format file extension. Supported formats are whatever supported by Qt (e.g. PNG, JPG,..etc)
569 * @param output Output temporary file path. The created file is generated by the function and store in output.
570 * @return True if conversion is successful, false otherwise.
571 */
572 static bool ImageToFITS(const QString &filename, const QString &format, QString &output);
573
574 QString getLastError() const;
575
576 static bool readableFilename(const QString &filename);
577
578 signals:
579 void converted(QImage);
580
581 /**
582 * @brief histogramReady Sends signal when histogram construction is complete.
583 */
584 void histogramReady();
585
586 /**
587 * @brief dataChanged Send signal when undelying raw data buffer data changed.
588 */
589 void dataChanged();
590 public slots:
591 void makeRoiBuffer(QRect roi);
592
593 private:
594 void loadCommon(const QString &inFilename);
595 /**
596 * @brief privateLoad Load an image (FITS, RAW, or images supported by Qt like jpeg, png).
597 * @param Buffer pointer to image data. If buffer is emtpy, read from disk (m_Filename).
598 * @return true if successfully loaded, false otherwise.
599 */
600 bool privateLoad(const QByteArray &buffer);
601
602 // Load Qt-supported images.
603 bool loadCanonicalImage(const QByteArray &buffer);
604 // Load FITS images.
605 bool loadFITSImage(const QByteArray &buffer, const bool isCompressed = false);
606 // Load XISF images.
607 bool loadXISFImage(const QByteArray &buffer);
608 // Save XISF images.
609 bool saveXISFImage(const QString &newFilename);
610 // Load RAW images.
611 bool loadRAWImage(const QByteArray &buffer);
612
613 void rotWCSFITS(int angle, int mirror);
614 void calculateMinMax(bool refresh = false, bool roi = false);
615 void calculateMedian(bool refresh = false, bool roi = false);
616 bool checkDebayer();
617 void readWCSKeys();
618
619 // Record last FITS error
620 void recordLastError(int errorCode);
621 void logOOMError(uint32_t requiredMemory = 0);
622
623 // FITS Record
624 bool parseHeader();
625 //int getFITSRecord(QString &recordList, int &nkeys);
626
627 // Templated functions
628 template <typename T>
629 bool debayer();
630
631 template <typename T>
632 bool rotFITS(int rotate, int mirror);
633
634 // Apply Filter
635 template <typename T>
636 void applyFilter(FITSScale type, uint8_t *targetImage, QVector<double> * min = nullptr, QVector<double> * max = nullptr);
637
638 template <typename T>
639 void calculateMinMax(bool roi = false);
640 template <typename T>
641 void calculateMedian(bool roi = false);
642
643 template <typename T>
644 QPair<T, T> getParitionMinMax(uint32_t start, uint32_t stride, bool roi);
645
646 /* Calculate the Gaussian blur matrix and apply it to the image using the convolution filter */
647 QVector<double> createGaussianKernel(int size, double sigma);
648 template <typename T>
649 void convolutionFilter(const QVector<double> &kernel, int kernelSize);
650 template <typename T>
651 void gaussianBlur(int kernelSize, double sigma);
652
653 /* Calculate running average & standard deviation */
654 template <typename T>
655 void calculateStdDev( bool roi = false );
656
657 template <typename T>
658 void convertToQImage(double dataMin, double dataMax, double scale, double zero, QImage &image);
659
660 ////////////////////////////////////////////////////////////////////////////////////////
661 ////////////////////////////////////////////////////////////////////////////////////////
662 /// Private Histogram Functions.
663 ////////////////////////////////////////////////////////////////////////////////////////
664 ////////////////////////////////////////////////////////////////////////////////////////
665 template <typename T> void constructHistogramInternal();
666 template <typename T> int32_t histogramBinInternal(T value, int channel) const;
667 template <typename T> int32_t histogramBinInternal(int x, int y, int channel) const;
668
669 /// Pointer to CFITSIO FITS file struct
670 fitsfile *fptr { nullptr };
671 /// Generic data image buffer
672 uint8_t *m_ImageBuffer { nullptr };
673 /// Above buffer size in bytes
674 uint32_t m_ImageBufferSize { 0 };
675 /// Image Buffer if Selection is to be done
676 uint8_t *m_ImageRoiBuffer { nullptr };
677 /// Above buffer size in bytes
678 uint32_t m_ImageRoiBufferSize { 0 };
679 /// Is this a temporary file or one loaded from disk?
680 bool m_isTemporary { false };
681 /// is this file compress (.fits.fz)?
682 bool m_isCompressed { false };
683 /// Did we search for stars yet?
684 bool starsSearched { false };
685 ///Star Selection Algorithm
686 StarAlgorithm starAlgorithm { ALGORITHM_GRADIENT };
687 /// Do we have WCS keywords in this FITS data?
688 bool HasWCS { false }; /// Do we have WCS keywords in this FITS data?
689 /// Is the image debayarable?
690 bool HasDebayer { false };
691 /// Buffer to hold fpack uncompressed data
692 uint8_t *m_PackBuffer {nullptr};
693
694 /// Our very own file name
695 QString m_Filename, m_compressedFilename, m_Extension;
696 /// FITS Mode (Normal, WCS, Guide, Focus..etc)
697 FITSMode m_Mode;
698 // FITS Observed UTC date time
699 KStarsDateTime m_DateTime;
700
701 /// How many times the image was rotated? Useful for WCS keywords rotation on save.
702 int rotCounter { 0 };
703 /// How many times the image was flipped horizontally?
704 int flipHCounter { 0 };
705 /// How many times the image was flipped vertically?
706 int flipVCounter { 0 };
707
708 /// WCS Struct
709 struct wcsprm *m_WCSHandle
710 {
711 nullptr
712 };
713 /// Number of coordinate representations found.
714 int m_nwcs {0};
715 WCSState m_WCSState { Idle };
716 /// All the stars we detected, if any.
717 QList<Edge *> starCenters;
718 QList<Edge *> localStarCenters;
719 /// The biggest fattest star in the image.
720 Edge m_SelectedHFRStar;
721
722 /// Bayer parameters
723 BayerParams debayerParams;
724 QTemporaryFile m_TemporaryDataFile;
725
726 /// Data type of fits pixel in the image. Used when saving FITS again.
727 /// There is bit depth and also data type. They're not the same.
728 /// 16bit can be either SHORT_IMG or USHORT_IMG, so m_FITSBITPIX specifies which is
729 int m_FITSBITPIX {USHORT_IMG};
730 FITSImage::Statistic m_Statistics;
731 FITSImage::Statistic m_ROIStatistics;
732
733 // A list of header records
734 QList<Record> m_HeaderRecords;
735
736 QList<FITSSkyObject *> m_SkyObjects;
737 bool m_ObjectsSearched {false};
738
739 QString m_LastError;
740
741 ////////////////////////////////////////////////////////////////////////////////////////
742 ////////////////////////////////////////////////////////////////////////////////////////
743 /// Histogram Variables
744 ////////////////////////////////////////////////////////////////////////////////////////
745 ////////////////////////////////////////////////////////////////////////////////////////
746 QVector<QVector<uint32_t>> m_CumulativeFrequency;
747 QVector<QVector<double>> m_HistogramIntensity;
748 QVector<QVector<double>> m_HistogramFrequency;
749 QVector<double> m_HistogramBinWidth;
750 uint16_t m_HistogramBinCount { 0 };
751 double m_JMIndex { 1 };
752 bool m_HistogramConstructed { false };
753
754 ////////////////////////////////////////////////////////////////////////////////////////
755 ////////////////////////////////////////////////////////////////////////////////////////
756 /// Star Detector
757 ////////////////////////////////////////////////////////////////////////////////////////
758 ////////////////////////////////////////////////////////////////////////////////////////
759 // Sky Background
760 SkyBackground m_SkyBackground;
761 // Detector Settings
762 QVariantMap m_SourceExtractorSettings;
763 QFuture<bool> m_StarFindFuture;
765
766 // Cached values for hfr and eccentricity computations
767 double cacheHFR { -1 };
768 HFRType cacheHFRType { HFR_AVERAGE };
769 double cacheEccentricity { -1 };
770 QPoint roiCenter;
771};
Extension of QDateTime for KStars KStarsDateTime can represent the date/time as a Julian Day,...
The sky coordinates of a point in the sky.
Definition skypoint.h:45
void append(QList< T > &&value)
qsizetype count() const const
Q_OBJECTQ_OBJECT
Q_PROPERTY(...)
Object to hold FITS Header records.
Definition fitsdata.h:88
QString comment
FITS Header Value.
Definition fitsdata.h:93
QVariant value
FITS Header Key.
Definition fitsdata.h:92
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Fri May 17 2024 11:48:26 by doxygen 1.10.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.