SourceXtractorPlusPlus  0.14
Please provide a description of the project.
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
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 
41 namespace 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().getAutoApertureImage();
86  if (aperture_check_img) {
87  auto src_id = source.getProperty<SourceID>().getId();
88  fillAperture<int>(ell_aper, centroid_x, centroid_y, aperture_check_img, src_id);
89  }
90 }
91 
92 }
std::shared_ptr< Image< SeFloat > > getLockedImage(FrameImageLayer layer) const
const PropertyType & getProperty(unsigned int index=0) const
Convenience template method to call getProperty() with a more user-friendly syntax.
SeFloat32 SeFloat
Definition: Types.h:32
The centroid of all the pixels in the source, weighted by their DetectionImage pixel values...
Definition: PixelCentroid.h:37
static CheckImages & getInstance()
Definition: CheckImages.h:136
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:34
virtual void computeProperties(SourceInterface &source) const override
Computes one or more properties for the Source.
The SourceInterface is an abstract &quot;source&quot; that has properties attached to it.
std::shared_ptr< WriteableImage< int > > getAutoApertureImage() const
Definition: CheckImages.h:78