SourceXtractorPlusPlus
0.11
Please provide a description of the project.
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 <
SEImplementation/Plugin/MeasurementFrame/MeasurementFrame.h
>
43
#include <
SEImplementation/Plugin/MeasurementFrameRectangle/MeasurementFrameRectangle.h
>
44
#include <
SEImplementation/Measurement/MultithreadedMeasurement.h
>
45
#include "
SEImplementation/Plugin/SaturateFlag/SaturateFlag.h
"
46
#include "
SEFramework/Task/SourceTask.h
"
47
#include "
SEFramework/Property/DetectionFrame.h
"
48
#include "
SEImplementation/Plugin/DetectionFramePixelValues/DetectionFramePixelValues.h
"
49
50
namespace
SourceXtractor
{
51
52
class
SaturateFlagSourceTask
:
public
SourceTask
{
53
public
:
54
SaturateFlagSourceTask
(
unsigned
instance):
m_instance
{instance} {}
55
56
virtual
~SaturateFlagSourceTask
() =
default
;
57
58
virtual
void
computeProperties
(
SourceInterface
&source)
const
{
59
std::lock_guard<std::recursive_mutex>
lock
(
MultithreadedMeasurement::g_global_mutex
);
60
61
bool
saturate_flag
=
false
;
62
63
const
auto
measurement_frame = source.
getProperty
<
MeasurementFrame
>(
m_instance
).getFrame();
64
const
auto
saturation = measurement_frame->getSaturation();
65
const
auto
measurement_rectangle = source.
getProperty
<
MeasurementFrameRectangle
>(
m_instance
);
66
67
if
(saturation > 0 && measurement_rectangle.getWidth()) {
68
// iterate over all pixel values
69
auto
image = measurement_frame->getOriginalImage();
70
auto
stamp = image->getChunk(
71
measurement_rectangle.getTopLeft().m_x, measurement_rectangle.getTopLeft().m_y,
72
measurement_rectangle.getWidth(), measurement_rectangle.getHeight());
73
74
for
(
int
y
= 0;
y
< stamp->getHeight(); ++
y
) {
75
for
(
int
x
= 0;
x
< stamp->getWidth(); ++
x
) {
76
if
(stamp->getValue(
x
,
y
) >= saturation) {
77
saturate_flag
=
true
;
78
break
;
79
}
80
}
81
}
82
}
83
84
// set the property
85
source.
setIndexedProperty
<
SaturateFlag
>(
m_instance
,
saturate_flag
);
86
};
87
private
:
88
unsigned
m_instance
;
89
90
};
// End of SaturateFlagSourceTask class
91
92
}
// namespace SourceXtractor
93
94
#endif
/* _SEIMPLEMENTATION_PLUGIN_ATURATEFLAGSOURCETASK_H_ */
95
96
97
SourceXtractor::SaturateFlagSourceTask::~SaturateFlagSourceTask
virtual ~SaturateFlagSourceTask()=default
MeasurementFrame.h
std::lock
T lock(T... args)
SourceXtractor::SaturateFlagSourceTask
Definition:
SaturateFlagSourceTask.h:52
SourceXtractor::SaturateFlagSourceTask::computeProperties
virtual void computeProperties(SourceInterface &source) const
Computes one or more properties for the Source.
Definition:
SaturateFlagSourceTask.h:58
SourceXtractor::MeasurementFrameRectangle
Definition:
MeasurementFrameRectangle.h:33
DetectionFrame.h
std::lock_guard
STL class.
SourceXtractor::MultithreadedMeasurement::g_global_mutex
static std::recursive_mutex g_global_mutex
Definition:
MultithreadedMeasurement.h:54
DetectionFramePixelValues.h
SourceXtractor
Definition:
Aperture.h:30
SourceXtractor::SaturateFlagSourceTask::m_instance
unsigned m_instance
Definition:
SaturateFlagSourceTask.h:86
SourceXtractor::SourceInterface::setIndexedProperty
void setIndexedProperty(std::size_t index, Args... args)
Convenience template method to call setProperty() with a more user-friendly syntax.
Definition:
SourceInterface.h:64
SourceXtractor::saturate_flag
static StaticPlugin< SaturateFlagPlugin > saturate_flag
Definition:
SaturateFlagPlugin.cpp:43
SourceXtractor::MeasurementFrame
Definition:
MeasurementFrame.h:36
SaturateFlag.h
SourceXtractor::SaturateFlag
Definition:
SaturateFlag.h:46
x
std::shared_ptr< DependentParameter< std::shared_ptr< EngineParameter > > > x
Definition:
MoffatModelFittingTask.cpp:93
SourceXtractor::SourceTask
A Task that acts on a Source to compute one or more properties.
Definition:
SourceTask.h:36
MultithreadedMeasurement.h
SourceXtractor::SaturateFlagSourceTask::SaturateFlagSourceTask
SaturateFlagSourceTask(unsigned instance)
Definition:
SaturateFlagSourceTask.h:54
SourceXtractor::SourceInterface::getProperty
const PropertyType & getProperty(unsigned int index=0) const
Convenience template method to call getProperty() with a more user-friendly syntax.
Definition:
SourceInterface.h:57
SourceXtractor::SourceInterface
The SourceInterface is an abstract "source" that has properties attached to it.
Definition:
SourceInterface.h:46
MeasurementFrameRectangle.h
y
std::shared_ptr< DependentParameter< std::shared_ptr< EngineParameter > > > y
Definition:
MoffatModelFittingTask.cpp:93
SourceTask.h
Generated by
1.8.18