SourceXtractorPlusPlus
0.21
SourceXtractor++, the next generation SExtractor
Loading...
Searching...
No Matches
SEImplementation
src
lib
Grouping
MoffatCriteria.cpp
Go to the documentation of this file.
1
17
/*
18
* MoffatCriteria.cpp
19
*
20
* Created on: 2019 M01 25
21
* Author: mschefer
22
*/
23
24
#include "
SEImplementation/Grouping/MoffatCriteria.h
"
25
#include "
SEImplementation/Plugin/MoffatModelFitting/MoffatModelFitting.h
"
26
#include "
SEImplementation/Plugin/MoffatModelFitting/MoffatModelEvaluator.h
"
27
28
#include "
SEImplementation/Plugin/PixelCentroid/PixelCentroid.h
"
29
#include "
SEImplementation/Plugin/PeakValue/PeakValue.h
"
30
31
namespace
SourceXtractor
{
32
33
using namespace
ModelFitting
;
34
35
bool
MoffatCriteria::doesImpact
(
const
SourceInterface
&
impactor
,
const
SourceInterface
&
impactee
)
const
{
36
auto
&
extended_model
=
impactor
.getProperty<
MoffatModelEvaluator
>();
37
if
(
extended_model
.getIterations() == 0) {
38
return
false
;
39
}
40
41
auto
&
centroid
=
impactee
.getProperty<
PixelCentroid
>();
42
auto
&
other_centroid
=
impactor
.getProperty<
PixelCentroid
>();
43
44
auto
dx
=
centroid
.getCentroidX() -
other_centroid
.getCentroidX();
45
auto
dy
=
centroid
.getCentroidY() -
other_centroid
.getCentroidY();
46
if
(
dx
*
dx
+
dy
*
dy
>
m_max_distance
*
m_max_distance
) {
47
return
false
;
48
}
49
50
auto
max_value
=
impactee
.getProperty<
PeakValue
>().getMaxValue();
51
52
double
model_value
=
extended_model
.getValue(
centroid
.getCentroidX(),
centroid
.getCentroidY());
53
54
return
(
model_value
/
max_value
) >
m_threshold
;
55
}
56
57
bool
MoffatCriteria::shouldGroup
(
const
SourceInterface
&
first
,
const
SourceInterface
& second)
const
{
58
return
doesImpact
(
first
, second) ||
doesImpact
(second,
first
);
59
}
60
61
std::set<PropertyId>
MoffatCriteria::requiredProperties
()
const
{
62
return
{
63
PropertyId::create<PixelCentroid>(),
64
PropertyId::create<PeakValue>(),
65
PropertyId::create<MoffatModelEvaluator>(),
66
};
67
}
68
69
}
// SourceXtractor namespace
70
71
MoffatCriteria.h
MoffatModelEvaluator.h
dx
std::shared_ptr< EngineParameter > dx
Definition
MoffatModelFittingTask.cpp:93
dy
std::shared_ptr< EngineParameter > dy
Definition
MoffatModelFittingTask.cpp:93
MoffatModelFitting.h
PeakValue.h
PixelCentroid.h
SourceXtractor::MoffatCriteria::m_threshold
double m_threshold
Definition
MoffatCriteria.h:52
SourceXtractor::MoffatCriteria::shouldGroup
bool shouldGroup(const SourceInterface &, const SourceInterface &) const override
Determines if the two sources should be grouped together.
Definition
MoffatCriteria.cpp:57
SourceXtractor::MoffatCriteria::doesImpact
bool doesImpact(const SourceInterface &impactor, const SourceInterface &impactee) const
Definition
MoffatCriteria.cpp:35
SourceXtractor::MoffatCriteria::requiredProperties
std::set< PropertyId > requiredProperties() const override
Return a set of used properties so they can be pre-fetched.
Definition
MoffatCriteria.cpp:61
SourceXtractor::MoffatCriteria::m_max_distance
double m_max_distance
Definition
MoffatCriteria.h:53
SourceXtractor::MoffatModelEvaluator
Definition
MoffatModelEvaluator.h:35
SourceXtractor::PeakValue
Definition
PeakValue.h:32
SourceXtractor::PixelCentroid
The centroid of all the pixels in the source, weighted by their DetectionImage pixel values.
Definition
PixelCentroid.h:37
SourceXtractor::SourceInterface
The SourceInterface is an abstract "source" that has properties attached to it.
Definition
SourceInterface.h:46
std::function
ModelFitting
Definition
AsinhChiSquareComparator.h:30
SourceXtractor
Definition
Aperture.h:30
Generated by
1.10.0