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

0001 /*
0002     SPDX-FileCopyrightText: 2020 Patrick Molenaar <pr_molenaar@hotmail.com>
0003 
0004     SPDX-License-Identifier: GPL-2.0-or-later
0005 */
0006 
0007 #ifndef FITSBAHTINOVDETECTOR_H
0008 #define FITSBAHTINOVDETECTOR_H
0009 
0010 #include "fitsstardetector.h"
0011 
0012 class BahtinovLineAverage
0013 {
0014     public:
0015         BahtinovLineAverage()
0016         {
0017             average = 0.0;
0018             offset = 0;
0019         }
0020         virtual ~BahtinovLineAverage() = default;
0021 
0022         double average;
0023         size_t offset;
0024 };
0025 
0026 class FITSBahtinovDetector: public FITSStarDetector
0027 {
0028         Q_OBJECT
0029 
0030     public:
0031         explicit FITSBahtinovDetector(FITSData *parent): FITSStarDetector(parent) {};
0032 
0033     public:
0034         /** @brief Find sources in the parent FITS data file.
0035          * @see FITSStarDetector::findSources().
0036          */
0037         QFuture<bool> findSources(QRect const &boundary = QRect()) override;
0038 
0039         /** @brief Configure the detection method.
0040          * @see FITSStarDetector::configure().
0041          * @note Parameter "numaveragerows" defaults to NUMBER_OF_AVERAGE_ROWS of the mean pixel value of the frame.
0042          * @todo Provide parameters for detection configuration.
0043          */
0044         //void configure(const QString &setting, const QVariant &value) override;
0045 
0046     public:
0047         /** @group Detection parameters.
0048          * @{ */
0049         //int NUMBER_OF_AVERAGE_ROWS { 1 };
0050         /** @} */
0051 
0052     protected:
0053         /** @internal Find sources in the parent FITS data file, dependent of the pixel depth.
0054          * @see FITSGradientDetector::findSources.
0055          */
0056         template <typename T>
0057         bool findBahtinovStar(const QRect &boundary);
0058 
0059     private:
0060         template <typename T>
0061         BahtinovLineAverage calculateMaxAverage(const FITSData *data, int angle);
0062         template <typename T>
0063         bool rotateImage(const FITSData *data, int angle, T * rotimage);
0064 };
0065 
0066 #endif // FITSBAHTINOVDETECTOR_H