SourceXtractorPlusPlus  0.16
Please provide a description of the project.
DetectionFrameSourceStampTask.cpp
Go to the documentation of this file.
1 
23 #include <mutex>
24 
29 
32 
34 
35 namespace SourceXtractor {
36 
38 
39  auto detection_frame_images = source.getProperty<DetectionFrameImages>();
40 
41  const auto& boundaries = source.getProperty<PixelBoundaries>();
42  auto min = boundaries.getMin();
43  auto max = boundaries.getMax();
44 
45  // FIXME temporary, for now just enlarge the area by a fixed amount of pixels
46  PixelCoordinate border = (max - min) * .8 + PixelCoordinate(2, 2);
47 
48  min -= border;
49  max += border;
50 
51  // clip to image size
52  min.m_x = std::max(min.m_x, 0);
53  min.m_y = std::max(min.m_y, 0);
54  max.m_x = std::min(max.m_x, detection_frame_images.getWidth() - 1);
55  max.m_y = std::min(max.m_y, detection_frame_images.getHeight() - 1);
56 
57  auto width = max.m_x - min.m_x +1;
58  auto height = max.m_y - min.m_y + 1;
59 
61  *detection_frame_images.getImageChunk(LayerSubtractedImage, min.m_x, min.m_y, width, height));
63  *detection_frame_images.getImageChunk(LayerFilteredImage, min.m_x, min.m_y, width, height));
64  auto thresholded_stamp = VectorImage<DetectionImage::PixelType>::create(
65  *detection_frame_images.getImageChunk(LayerThresholdedImage, min.m_x, min.m_y, width, height));
66  auto variance_stamp = VectorImage<WeightImage::PixelType>::create(
67  *detection_frame_images.getImageChunk(LayerVarianceMap, min.m_x, min.m_y, width, height));
68  auto threshold_map_stamp = VectorImage<DetectionImage::PixelType>::create(
69  *detection_frame_images.getImageChunk(LayerDetectionThresholdMap, min.m_x, min.m_y, width, height));
70 
71  source.setProperty<DetectionFrameSourceStamp>(stamp, filtered_stamp, thresholded_stamp, min, variance_stamp, threshold_map_stamp);
72 }
73 
74 } // SEImplementation namespace
virtual void computeProperties(SourceInterface &source) const override
Computes one or more properties for the Source.
A copy of the rectangular region of the detection image just large enough to include the whole Source...
The bounding box of all the pixels in the source. Both min and max coordinate are inclusive.
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.
static std::shared_ptr< VectorImage< T > > create(Args &&... args)
Definition: VectorImage.h:100
T max(T... args)
T min(T... args)
@ LayerVarianceMap
Definition: Frame.h:44
@ LayerFilteredImage
Definition: Frame.h:39
@ LayerDetectionThresholdMap
Definition: Frame.h:45
@ LayerThresholdedImage
Definition: Frame.h:40
@ LayerSubtractedImage
Definition: Frame.h:38
A pixel coordinate made of two integers m_x and m_y.