SourceXtractorPlusPlus
0.21
SourceXtractor++, the next generation SExtractor
Loading...
Searching...
No Matches
SEImplementation
src
lib
Plugin
PixelBoundaries
PixelBoundariesTask.cpp
Go to the documentation of this file.
1
23
#include <climits>
24
25
#include "
SEImplementation/Property/PixelCoordinateList.h
"
26
#include "
SEImplementation/Plugin/PixelBoundaries/PixelBoundaries.h
"
27
#include "
SEImplementation/Plugin/DetectionFramePixelValues/DetectionFramePixelValues.h
"
28
#include "
SEImplementation/Plugin/PeakValue/PeakValue.h
"
29
#include "
SEImplementation/Plugin/PixelBoundaries/PixelBoundariesTask.h
"
30
31
namespace
SourceXtractor
{
32
33
void
PixelBoundariesTask::computeProperties
(
SourceInterface
&
source
)
const
{
34
int
min_x
=
INT_MAX
;
35
int
min_y
=
INT_MAX
;
36
int
max_x
=
INT_MIN
;
37
int
max_y
=
INT_MIN
;
38
39
for
(
auto
pixel_coord
:
source
.getProperty<
PixelCoordinateList
>().getCoordinateList()) {
40
min_x
=
std::min
(
min_x
,
pixel_coord
.m_x);
41
min_y
=
std::min
(
min_y
,
pixel_coord
.m_y);
42
max_x
=
std::max
(
max_x
,
pixel_coord
.m_x);
43
max_y
=
std::max
(
max_y
,
pixel_coord
.m_y);
44
}
45
46
source
.setProperty<
PixelBoundaries
>(
min_x
,
min_y
,
max_x
,
max_y
);
47
}
48
49
void
PixelBoundariesTaskHalfMaximum::computeProperties
(
SourceInterface
&
source
)
const
{
50
const
auto
&
pixel_values
=
source
.getProperty<
DetectionFramePixelValues
>().getFilteredValues();
51
SeFloat
half_maximum
=
source
.getProperty<
PeakValue
>().getMaxValue() / 2.0;
52
53
int
min_x_half
=
INT_MAX
;
54
int
min_y_half
=
INT_MAX
;
55
int
max_x_half
=
INT_MIN
;
56
int
max_y_half
=
INT_MIN
;
57
58
auto
i
=
pixel_values
.begin();
59
for
(
auto
pixel_coord
:
source
.getProperty<
PixelCoordinateList
>().getCoordinateList()) {
60
SeFloat
value = *
i
++;
61
62
if
(value >=
half_maximum
) {
63
min_x_half
=
std::min
(
min_x_half
,
pixel_coord
.m_x);
64
min_y_half
=
std::min
(
min_y_half
,
pixel_coord
.m_y);
65
max_x_half
=
std::max
(
max_x_half
,
pixel_coord
.m_x);
66
max_y_half
=
std::max
(
max_y_half
,
pixel_coord
.m_y);
67
}
68
}
69
70
source
.setProperty<
PixelBoundariesHalfMaximum
>(
min_x_half
,
min_y_half
,
max_x_half
,
max_y_half
);
71
}
72
73
}
// SEImplementation namespace
74
DetectionFramePixelValues.h
PeakValue.h
PixelBoundariesTask.h
PixelBoundaries.h
PixelCoordinateList.h
SourceXtractor::DetectionFramePixelValues
The values of a Source's pixels in the detection image. They are returned as a vector in the same ord...
Definition
DetectionFramePixelValues.h:39
SourceXtractor::PeakValue
Definition
PeakValue.h:32
SourceXtractor::PixelBoundariesHalfMaximum
Definition
PixelBoundaries.h:71
SourceXtractor::PixelBoundariesTaskHalfMaximum::computeProperties
void computeProperties(SourceInterface &source) const override
Computes one or more properties for the Source.
Definition
PixelBoundariesTask.cpp:49
SourceXtractor::PixelBoundariesTask::computeProperties
void computeProperties(SourceInterface &source) const override
Computes one or more properties for the Source.
Definition
PixelBoundariesTask.cpp:33
SourceXtractor::PixelBoundaries
The bounding box of all the pixels in the source. Both min and max coordinate are inclusive.
Definition
PixelBoundaries.h:37
SourceXtractor::PixelCoordinateList
Definition
PixelCoordinateList.h:33
SourceXtractor::SourceInterface
The SourceInterface is an abstract "source" that has properties attached to it.
Definition
SourceInterface.h:46
std::function
std::max
T max(T... args)
std::min
T min(T... args)
SourceXtractor
Definition
Aperture.h:30
Generated by
1.10.0