SourceXtractorPlusPlus
0.21
SourceXtractor++, the next generation SExtractor
Loading...
Searching...
No Matches
SEImplementation
SEImplementation
Plugin
SaturateFlag
SaturateFlagSourceTask.h
Go to the documentation of this file.
1
17
/*
18
* Copyright (C) 2012-2020 Euclid Science Ground Segment
19
*
20
* This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General
21
* Public License as published by the Free Software Foundation; either version 3.0 of the License, or (at your option)
22
* any later version.
23
*
24
* This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied
25
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
26
* details.
27
*
28
* You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to
29
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
30
*/
31
39
#ifndef _SEIMPLEMENTATION_PLUGIN_ATURATEFLAGSOURCETASK_H_
40
#define _SEIMPLEMENTATION_PLUGIN_ATURATEFLAGSOURCETASK_H_
41
42
#include "
SEFramework/Task/SourceTask.h
"
43
#include "
SEFramework/Property/DetectionFrame.h
"
44
45
#include <
SEImplementation/Plugin/MeasurementFrameInfo/MeasurementFrameInfo.h
>
46
#include <
SEImplementation/Plugin/MeasurementFrameImages/MeasurementFrameImages.h
>
47
#include <
SEImplementation/Plugin/MeasurementFrameRectangle/MeasurementFrameRectangle.h
>
48
#include "
SEImplementation/Plugin/DetectionFramePixelValues/DetectionFramePixelValues.h
"
49
50
#include "
SEImplementation/Plugin/SaturateFlag/SaturateFlag.h
"
51
52
namespace
SourceXtractor
{
53
54
class
SaturateFlagSourceTask
:
public
SourceTask
{
55
public
:
56
explicit
SaturateFlagSourceTask
(
unsigned
instance
):
m_instance
{
instance
} {}
57
58
virtual
~SaturateFlagSourceTask
() =
default
;
59
60
virtual
void
computeProperties
(
SourceInterface
&
source
)
const
{
61
bool
saturate_flag
=
false
;
62
63
const
auto
&
measurement_frame_info
=
source
.getProperty<
MeasurementFrameInfo
>(
m_instance
);
64
const
auto
&
measurement_frame_images
=
source
.getProperty<
MeasurementFrameImages
>(
m_instance
);
65
66
const
auto
saturation =
measurement_frame_info
.getSaturation();
67
const
auto
measurement_rectangle
=
source
.getProperty<
MeasurementFrameRectangle
>(
m_instance
);
68
69
if
(saturation > 0 &&
measurement_rectangle
.getWidth()) {
70
// iterate over all pixel values
71
auto
stamp
=
measurement_frame_images
.getImageChunk(
LayerOriginalImage
,
72
measurement_rectangle
.getTopLeft().m_x,
measurement_rectangle
.getTopLeft().m_y,
73
measurement_rectangle
.getWidth(),
measurement_rectangle
.getHeight());
74
75
for
(
int
y
= 0;
y
<
stamp
->getHeight(); ++
y
) {
76
for
(
int
x
= 0;
x
<
stamp
->getWidth(); ++
x
) {
77
if
(
stamp
->getValue(
x
,
y
) >= saturation) {
78
saturate_flag
=
true
;
79
break
;
80
}
81
}
82
}
83
}
84
85
// set the property
86
source
.setIndexedProperty<
SaturateFlag
>(
m_instance
,
saturate_flag
);
87
};
88
private
:
89
unsigned
m_instance
;
90
91
};
// End of SaturateFlagSourceTask class
92
93
}
// namespace SourceXtractor
94
95
#endif
/* _SEIMPLEMENTATION_PLUGIN_ATURATEFLAGSOURCETASK_H_ */
96
97
98
DetectionFramePixelValues.h
DetectionFrame.h
MeasurementFrameImages.h
MeasurementFrameInfo.h
MeasurementFrameRectangle.h
x
std::shared_ptr< DependentParameter< std::shared_ptr< EngineParameter > > > x
Definition
MoffatModelFittingTask.cpp:94
y
std::shared_ptr< DependentParameter< std::shared_ptr< EngineParameter > > > y
Definition
MoffatModelFittingTask.cpp:94
SaturateFlag.h
SourceTask.h
SourceXtractor::MeasurementFrameImages
Definition
MeasurementFrameImages.h:31
SourceXtractor::MeasurementFrameInfo
Definition
MeasurementFrameInfo.h:28
SourceXtractor::MeasurementFrameRectangle
Definition
MeasurementFrameRectangle.h:34
SourceXtractor::SaturateFlagSourceTask
Definition
SaturateFlagSourceTask.h:54
SourceXtractor::SaturateFlagSourceTask::computeProperties
virtual void computeProperties(SourceInterface &source) const
Computes one or more properties for the Source.
Definition
SaturateFlagSourceTask.h:60
SourceXtractor::SaturateFlagSourceTask::SaturateFlagSourceTask
SaturateFlagSourceTask(unsigned instance)
Definition
SaturateFlagSourceTask.h:56
SourceXtractor::SaturateFlagSourceTask::m_instance
unsigned m_instance
Definition
SaturateFlagSourceTask.h:89
SourceXtractor::SaturateFlagSourceTask::~SaturateFlagSourceTask
virtual ~SaturateFlagSourceTask()=default
SourceXtractor::SaturateFlag
Definition
SaturateFlag.h:46
SourceXtractor::SourceInterface
The SourceInterface is an abstract "source" that has properties attached to it.
Definition
SourceInterface.h:46
SourceXtractor::SourceTask
A Task that acts on a Source to compute one or more properties.
Definition
SourceTask.h:36
std::function
SourceXtractor
Definition
Aperture.h:30
SourceXtractor::LayerOriginalImage
@ LayerOriginalImage
Definition
Frame.h:37
SourceXtractor::saturate_flag
static StaticPlugin< SaturateFlagPlugin > saturate_flag
Definition
SaturateFlagPlugin.cpp:43
Generated by
1.10.0