SourceXtractorPlusPlus 0.21
SourceXtractor++, the next generation SExtractor
Loading...
Searching...
No Matches
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
46
47namespace SourceXtractor {
48
50public:
51
53
54 virtual ~BoundaryFlagSourceTask() = default;
55
57 bool boundary_flag = false;
58
59 // get the image dimensions
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
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
79private:
80 unsigned m_instance;
81}; // End of BoundaryFlagSourceTask class
82
83} // namespace SourceXtractor
84
85#endif /* _SEIMPLEMENTATION_PLUGIN_BOUNDARYFLAGSOURCETASK_H_ */
86
87
88
virtual void computeProperties(SourceInterface &source) const
Computes one or more properties for the Source.
The SourceInterface is an abstract "source" that has properties attached to it.
A Task that acts on a Source to compute one or more properties.
Definition SourceTask.h:36
static StaticPlugin< BoundaryFlagPlugin > boundary_flag