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

0001 /*
0002     SPDX-FileCopyrightText: 2004 Jasem Mutlaq
0003     SPDX-FileCopyrightText: 2020 Eric Dejouhanet <eric.dejouhanet@gmail.com>
0004 
0005     SPDX-License-Identifier: GPL-2.0-or-later
0006 
0007     Some code fragments were adapted from Peter Kirchgessner's FITS plugin
0008     SPDX-FileCopyrightText: Peter Kirchgessner <http://members.aol.com/pkirchg>
0009 */
0010 
0011 #ifndef FITSCENTROIDDETECTOR_H
0012 #define FITSCENTROIDDETECTOR_H
0013 
0014 #include <QObject>
0015 #include "fitsstardetector.h"
0016 
0017 class FITSCentroidDetector: public FITSStarDetector
0018 {
0019         Q_OBJECT
0020 
0021     public:
0022         explicit FITSCentroidDetector(FITSData * data): FITSStarDetector(data) {};
0023 
0024     public:
0025         /** @brief Find sources in the parent FITS data file.
0026          * @see FITSStarDetector::findSources().
0027          */
0028         QFuture<bool> findSources(QRect const &boundary = QRect()) override;
0029 
0030         /** @brief Configure the detection method.
0031          * @see FITSStarDetector::configure().
0032          * @see Detection parameters.
0033          */
0034         //void configure(const QString &setting, const QVariant &value) override;
0035 
0036     protected:
0037         /** @group Detection parameters. Use the names as strings for FITSStarDetector::configure().
0038          * @{ */
0039         /** @brief Initial variation, decreasing as search progresses. Configurable. */
0040         //int MINIMUM_STDVAR { 5 };
0041         /** @brief Initial source width, decreasing as search progresses. Configurable. */
0042         //int MINIMUM_PIXEL_RANGE { 5 };
0043         /** @brief Custom image contrast index from the frame histogram. Configurable. */
0044         //double JMINDEX { 100 };
0045         /** @brief Initial source count over which search stops. */
0046         int MINIMUM_EDGE_LIMIT { 2 };
0047         /** @brief Maximum source count over which search aborts. */
0048         int MAX_EDGE_LIMIT { 10000 };
0049         /** @brief Minimum value of JMINDEX under which the custom image contrast index from the histogram is used to redefine edge width and count. */
0050         double DIFFUSE_THRESHOLD { 0.15 };
0051         /** @brief */
0052         int MINIMUM_ROWS_PER_CENTER { 3 };
0053         /** @brief */
0054         int LOW_EDGE_CUTOFF_1  { 50 };
0055         /** @brief */
0056         int LOW_EDGE_CUTOFF_2  { 10 };
0057         /** @} */
0058 
0059     protected:
0060         /** @internal Find sources in the parent FITS data file, dependent of the pixel depth.
0061          * @see FITSGradientDetector::findSources.
0062          */
0063         template <typename T>
0064         bool findSources(const QRect &boundary);
0065 
0066         /** @internal Check whether two sources overlap.
0067          * @param s1, s2 are the two sources to check collision on.
0068          * @return true if the sources collide, else false.
0069          */
0070         bool checkCollision(Edge * s1, Edge * s2) const;
0071 };
0072 
0073 #endif // FITSCENTROIDDETECTOR_H