SourceXtractorPlusPlus  0.13
Please provide a description of the project.
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 }
PixelCoordinateList.h
SourceXtractor::AutoPhotometryFlag
Definition: AutoPhotometryFlag.h:34
SourceXtractor::PixelCoordinateList
Definition: PixelCoordinateList.h:31
SourceXtractor::DetectionFrameImages
Definition: DetectionFrameImages.h:32
FluxMeasurement.h
CheckImages.h
SourceXtractor::DetectionFrameInfo
Definition: DetectionFrameInfo.h:28
AutoPhotometryFlagTask.h
SourceXtractor::PixelCentroid
The centroid of all the pixels in the source, weighted by their DetectionImage pixel values.
Definition: PixelCentroid.h:37
SourceXtractor::computeFlags
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
SourceXtractor::SeFloat
SeFloat32 SeFloat
Definition: Types.h:32
SourceXtractor::AutoPhotometryFlagTask::m_kron_factor
SeFloat m_kron_factor
Definition: AutoPhotometryFlagTask.h:43
SourceXtractor::KronRadius
Kron radius.
Definition: KronRadius.h:36
SourceXtractor::DetectionFrameInfo::getVarianceThreshold
SeFloat getVarianceThreshold() const
Definition: DetectionFrameInfo.h:55
SourceXtractor::Flags
Flags
Flagging of bad sources.
Definition: SourceFlags.h:34
DetectionFrameInfo.h
SourceXtractor::CheckImages::getAutoApertureImage
std::shared_ptr< WriteableImage< int > > getAutoApertureImage() const
Definition: CheckImages.h:78
SourceXtractor::LayerVarianceMap
@ LayerVarianceMap
Definition: Frame.h:44
SourceID.h
SourceXtractor::SourceID
Definition: SourceID.h:33
EllipticalAperture.h
SourceXtractor::CheckImages::getInstance
static CheckImages & getInstance()
Definition: CheckImages.h:136
SourceXtractor
Definition: Aperture.h:30
Flagging.h
SourceXtractor::AutoPhotometryFlagTask::computeProperties
virtual void computeProperties(SourceInterface &source) const override
Computes one or more properties for the Source.
Definition: AutoPhotometryFlagTask.cpp:45
SourceXtractor::AutoPhotometryFlagTask::m_kron_minrad
SeFloat m_kron_minrad
Definition: AutoPhotometryFlagTask.h:44
SourceXtractor::SourceInterface::getProperty
const PropertyType & getProperty(unsigned int index=0) const
Convenience template method to call getProperty() with a more user-friendly syntax.
Definition: SourceInterface.h:57
SourceXtractor::LayerSubtractedImage
@ LayerSubtractedImage
Definition: Frame.h:38
ShapeParameters.h
AutoPhotometryFlag.h
SourceXtractor::SourceInterface
The SourceInterface is an abstract "source" that has properties attached to it.
Definition: SourceInterface.h:46
SourceXtractor::DetectionFrameImages::getLockedImage
std::shared_ptr< Image< SeFloat > > getLockedImage(FrameImageLayer layer) const
Definition: DetectionFrameImages.h:40
AutoPhotometry.h
SourceXtractor::SourceInterface::setProperty
void setProperty(Args... args)
Definition: SourceInterface.h:72
SourceXtractor::ShapeParameters
Definition: ShapeParameters.h:32
PixelCentroid.h
KronRadius.h
DetectionFrameImages.h
SourceXtractor::LayerThresholdedImage
@ LayerThresholdedImage
Definition: Frame.h:40