Kstars

fitsstardetector.h
1/*
2 SPDX-FileCopyrightText: 2004 Jasem Mutlaq
3 SPDX-FileCopyrightText: 2020 Eric Dejouhanet <eric.dejouhanet@gmail.com>
4
5 SPDX-License-Identifier: GPL-2.0-or-later
6
7 Some code fragments were adapted from Peter Kirchgessner's FITS plugin
8 SPDX-FileCopyrightText: Peter Kirchgessner <http://members.aol.com/pkirchg>
9*/
10
11#pragma once
12
13#include <QObject>
14#include <QHash>
15#include <QStandardItem>
16#include <QFuture>
17
18class FITSData;
19
20class Edge
21{
22 public:
23 virtual ~Edge() = default;
24 void invalidate()
25 {
26 x = y = val = HFR = -1;
27 }
28 float x {0};
29 float y {0};
30 int val {0};
31 int scanned {0};
32 float width {0};
33 float HFR {-1};
34 float sum {0};
35 float numPixels {0};
36 float ellipticity {0};
37};
38
39class BahtinovEdge : public Edge
40{
41 public:
42 virtual ~BahtinovEdge() = default;
43 QVector<QLineF> line;
44 QPointF offset;
45};
46
47class FITSStarDetector : public QObject
48{
50
51 public:
52 /** @brief Instantiate a detector for a FITS data file.
53 */
54 explicit FITSStarDetector(FITSData *data): QObject(), m_ImageData(data) {};
55
56 /** @brief Find sources in the parent FITS data file.
57 * @param starCenters is the list of sources to append to.
58 * @param boundary is the rectangle in which to find sources, by default the full frame.
59 * @return The number of sources detected by the procedure.
60 */
61 virtual QFuture<bool> findSources(QRect const &boundary = QRect()) = 0;
62
63 /** @brief Configure the detection method.
64 * @param setting is the name of a detection setting.
65 * @param value is the value of the detection setting identified by 'setting'.
66 * @return The detector as a chain to call the overridden findSources.
67 */
68 virtual void configure(const QString &key, const QVariant &value);
69
70 void setSettings(const QVariantMap &settings)
71 {
72 m_Settings = settings;
73 }
74 QVariant getValue(const QString &key, QVariant defaultValue = QVariant()) const;
75
76 /** @brief Helper to configure the detection method from a data model.
77 * @param settings is the list of key/value pairs for the method to use settings from.
78 * @note Data model 'settings' is considered a key/value list, using column 1 text as case-insensitive keys and column 2 data as values.
79 * @return The detector as a chain to call the overridden findSources.
80 */
81 //void configure(QStandardItemModel const &settings);
82
83 protected:
84 FITSData *m_ImageData {nullptr};
85 QVariantMap m_Settings;
86};
87
Q_OBJECTQ_OBJECT
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.