SourceXtractorPlusPlus 1.0.3
SourceXtractor++, the next generation SExtractor
Loading...
Searching...
No Matches
AutoPhotometryFlagTask.cpp
Go to the documentation of this file.
1
17/*
18 * AutoPhotometryFlagTask.cpp
19 *
20 * Created on: Oct 10, 2018
21 * Author: Alejandro Alvarez Ayllon
22 */
23
27
36
40
41namespace SourceXtractor {
42
44
46 // get the detection frame info
47 const auto& detection_frame_info = source.getProperty<DetectionFrameInfo>();
48 const auto variance_threshold = detection_frame_info.getVarianceThreshold();
49
50 // get detection frame images
51 const auto& detection_frame_images = source.getProperty<DetectionFrameImages>();
52
53 const auto detection_image = detection_frame_images.getLockedImage(LayerSubtractedImage);
54 const auto detection_variance = detection_frame_images.getLockedImage(LayerVarianceMap);
55 const auto threshold_image = detection_frame_images.getLockedImage(LayerThresholdedImage);
56
57 // get the object center
58 const auto& centroid_x = source.getProperty<PixelCentroid>().getCentroidX();
59 const auto& centroid_y = source.getProperty<PixelCentroid>().getCentroidY();
60
61 // get the shape parameters
62 const auto& cxx = source.getProperty<ShapeParameters>().getEllipseCxx();
63 const auto& cyy = source.getProperty<ShapeParameters>().getEllipseCyy();
64 const auto& cxy = source.getProperty<ShapeParameters>().getEllipseCxy();
65
66 // get the pixel list
67 const auto& pix_list = source.getProperty<PixelCoordinateList>().getCoordinateList();
68
69 // get the kron-radius
70 SeFloat kron_radius_auto = m_kron_factor * source.getProperty<KronRadius>().getKronRadius();
71 if (kron_radius_auto < m_kron_minrad)
72 kron_radius_auto = m_kron_minrad;
73
74 // create the elliptical aperture
75 auto ell_aper = std::make_shared<EllipticalAperture>(cxx, cyy, cxy, kron_radius_auto);
76
77 // get the neighbourhood information
78 Flags global_flag = computeFlags(ell_aper, centroid_x, centroid_y, pix_list, detection_image,
79 detection_variance, threshold_image, variance_threshold);
80
81 // set the source properties
82 source.setProperty<AutoPhotometryFlag>(global_flag);
83
84 // Draw the aperture
85 auto aperture_check_img = CheckImages::getInstance().getDetectionAutoApertureImage(detection_frame_info.getHduIndex());
86 if (aperture_check_img) {
87 auto src_id = source.getProperty<SourceID>().getId();
88 drawAperture<int>(ell_aper, centroid_x, centroid_y, aperture_check_img, src_id);
89 }
90}
91
92}
void computeProperties(SourceInterface &source) const override
Computes one or more properties for the Source.
static CheckImages & getInstance()
std::shared_ptr< WriteableImage< int > > getDetectionAutoApertureImage(size_t index) const
Definition CheckImages.h:84
std::shared_ptr< ImageAccessor< SeFloat > > getLockedImage(FrameImageLayer layer) const
The centroid of all the pixels in the source, weighted by their DetectionImage pixel values.
The SourceInterface is an abstract "source" that has properties attached to it.
const PropertyType & getProperty(unsigned int index=0) const
Convenience template method to call getProperty() with a more user-friendly syntax.
T make_shared(T... args)
Flags computeFlags(const std::shared_ptr< Aperture > &aperture, SeFloat centroid_x, SeFloat centroid_y, const std::vector< PixelCoordinate > &pix_list, const std::shared_ptr< Image< SeFloat > > &detection_img, const std::shared_ptr< Image< SeFloat > > &detection_variance, const std::shared_ptr< Image< SeFloat > > &threshold_image, SeFloat variance_threshold)
Definition Flagging.cpp:27
Flags
Flagging of bad sources.
Definition SourceFlags.h:37
@ LayerVarianceMap
Definition Frame.h:45
@ LayerThresholdedImage
Definition Frame.h:41
@ LayerSubtractedImage
Definition Frame.h:39
SeFloat32 SeFloat
Definition Types.h:32
void drawAperture(const std::shared_ptr< Aperture > &aperture, SeFloat centroid_x, SeFloat centroid_y, const std::shared_ptr< WriteableImage< T > > &img, T value)