SourceXtractorPlusPlus 0.19.2
SourceXtractor++, the next generation SExtractor
Loading...
Searching...
No Matches
MeasurementFramePixelCentroidTask.cpp
Go to the documentation of this file.
1
17/*
18 * MeasurementFramePixelCentroidTask.cpp
19 *
20 * Created on: Oct 31, 2016
21 * Author: mschefer
22 */
23
26
30
31namespace SourceXtractor {
32
34 auto detection_coordinate_system = source.getProperty<DetectionFrameCoordinates>().getCoordinateSystem();
35 auto measurement_coordinate_system = source.getProperty<MeasurementFrameCoordinates>(m_instance).getCoordinateSystem();
36 auto pixel_centroid = source.getProperty<PixelCentroid>();
37
38 ImageCoordinate detection_image_coordinate(pixel_centroid.getCentroidX(), pixel_centroid.getCentroidY());
39 auto world_coordinate = detection_coordinate_system->imageToWorld(detection_image_coordinate);
40
41 try {
42 auto measurement_image_coordinate = measurement_coordinate_system->worldToImage(world_coordinate);
43 source.setIndexedProperty<MeasurementFramePixelCentroid>(m_instance, measurement_image_coordinate.m_x,
44 measurement_image_coordinate.m_y);
45 }
46 catch (const InvalidCoordinatesException&) {
48 }
49}
50
51}
52
void computeProperties(SourceInterface &source) const override
Computes one or more properties for the Source.
The centroid of all the pixels in the source, weighted by their DetectionImage pixel values.
Definition: PixelCentroid.h:37
The SourceInterface is an abstract "source" that has properties attached to it.
void setIndexedProperty(std::size_t index, Args... args)
Convenience template method to call setProperty() with a more user-friendly syntax.
const PropertyType & getProperty(unsigned int index=0) const
Convenience template method to call getProperty() with a more user-friendly syntax.