SourceXtractorPlusPlus
0.21
SourceXtractor++, the next generation SExtractor
Loading...
Searching...
No Matches
SEImplementation
SEImplementation
Plugin
BoundaryFlag
BoundaryFlagSourceTask.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_BOUNDARYFLAGSOURCETASK_H_
40
#define _SEIMPLEMENTATION_PLUGIN_BOUNDARYFLAGSOURCETASK_H_
41
42
#include "
SEImplementation/Plugin/BoundaryFlag/BoundaryFlag.h
"
43
#include "
SEFramework/Task/SourceTask.h
"
44
#include "
SEImplementation/Plugin/MeasurementFrameInfo/MeasurementFrameInfo.h
"
45
#include "
SEImplementation/Plugin/MeasurementFrameRectangle/MeasurementFrameRectangle.h
"
46
47
namespace
SourceXtractor
{
48
49
class
BoundaryFlagSourceTask
:
public
SourceTask
{
50
public
:
51
52
explicit
BoundaryFlagSourceTask
(
unsigned
instance
):
m_instance
{
instance
} {}
53
54
virtual
~BoundaryFlagSourceTask
() =
default
;
55
56
virtual
void
computeProperties
(
SourceInterface
&
source
)
const
{
57
bool
boundary_flag
=
false
;
58
59
// get the image dimensions
60
const
auto
&
measurement_frame_info
=
source
.getProperty<
MeasurementFrameInfo
>(
m_instance
);
61
auto
x_border
=
measurement_frame_info
.getWidth() - 1;
62
auto
y_border
=
measurement_frame_info
.getHeight() - 1;
63
64
// iterate over all pixel coordinates
65
auto
measurement_rectangle
=
source
.getProperty<
MeasurementFrameRectangle
>(
m_instance
);
66
67
if
(
measurement_rectangle
.getHeight() &&
measurement_rectangle
.getWidth()) {
68
auto
top_left
=
measurement_rectangle
.getTopLeft();
69
auto
bottom_right
=
measurement_rectangle
.getBottomRight();
70
71
if
(
top_left
.m_x <= 0 ||
top_left
.m_y <= 0 ||
bottom_right
.m_x >=
x_border
||
bottom_right
.m_y >=
y_border
) {
72
boundary_flag
=
true
;
73
}
74
}
75
76
source
.setIndexedProperty<
BoundaryFlag
>(
m_instance
,
boundary_flag
);
77
};
78
79
private
:
80
unsigned
m_instance
;
81
};
// End of BoundaryFlagSourceTask class
82
83
}
// namespace SourceXtractor
84
85
#endif
/* _SEIMPLEMENTATION_PLUGIN_BOUNDARYFLAGSOURCETASK_H_ */
86
87
88
BoundaryFlag.h
MeasurementFrameInfo.h
MeasurementFrameRectangle.h
SourceTask.h
SourceXtractor::BoundaryFlagSourceTask
Definition
BoundaryFlagSourceTask.h:49
SourceXtractor::BoundaryFlagSourceTask::m_instance
unsigned m_instance
Definition
BoundaryFlagSourceTask.h:80
SourceXtractor::BoundaryFlagSourceTask::BoundaryFlagSourceTask
BoundaryFlagSourceTask(unsigned instance)
Definition
BoundaryFlagSourceTask.h:52
SourceXtractor::BoundaryFlagSourceTask::computeProperties
virtual void computeProperties(SourceInterface &source) const
Computes one or more properties for the Source.
Definition
BoundaryFlagSourceTask.h:56
SourceXtractor::BoundaryFlagSourceTask::~BoundaryFlagSourceTask
virtual ~BoundaryFlagSourceTask()=default
SourceXtractor::BoundaryFlag
Definition
BoundaryFlag.h:46
SourceXtractor::MeasurementFrameInfo
Definition
MeasurementFrameInfo.h:28
SourceXtractor::MeasurementFrameRectangle
Definition
MeasurementFrameRectangle.h:34
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::boundary_flag
static StaticPlugin< BoundaryFlagPlugin > boundary_flag
Definition
BoundaryFlagPlugin.cpp:43
Generated by
1.10.0