SourceXtractorPlusPlus 1.0.3
SourceXtractor++, the next generation SExtractor
Loading...
Searching...
No Matches
Segmentation.h
Go to the documentation of this file.
1
22
23#ifndef _SEFRAMEWORK_PIPELINE_SEGMENTATION_H
24#define _SEFRAMEWORK_PIPELINE_SEGMENTATION_H
25
26#include <memory>
27#include <type_traits>
28
36
37namespace SourceXtractor {
38
46
53class Segmentation : public PipelineEmitter<SourceInterface> , public Observable<SegmentationProgress> {
54
55public:
57 class Labelling;
58
60 virtual ~Segmentation() = default;
61
63
64 template<class LabellingType, typename ... Args>
65 void setLabelling(Args... args) {
67 "LabellingType must inherit from SourceXtractor::Segmentation::Labelling");
68 static_assert(std::is_constructible<LabellingType, Args...>::value,
69 "LabellingType must be constructible from args");
70
71 m_labelling.reset(new LabellingType(std::forward<Args>(args)...));
72 }
73
76
77private:
80
81}; /* End of Segmentation class */
82
84public:
86 m_segmentation(segmentation),
87 m_detection_frame(detection_frame) {}
88
91 source->setProperty<DetectionFrame>(m_detection_frame);
92 }
93 m_segmentation.sendSource(std::move(source));
94 }
95
96 void notifyProgress(int position, int total) {
97 m_segmentation.Observable<SegmentationProgress>::notifyObservers(SegmentationProgress{position, total});
98 }
99
101 m_segmentation.sendProcessSignal(event);
102 }
103
104private:
107};
108
110public:
111 virtual ~Labelling() = default;
113
115};
116
117} /* namespace SourceXtractor */
118
119#endif
Implements the Observer pattern. Notifications will be made using a message of type T.
Definition Observable.h:51
void requestProcessing(const ProcessSourcesEvent &event)
std::shared_ptr< DetectionImageFrame > m_detection_frame
LabellingListener(const Segmentation &segmentation, std::shared_ptr< DetectionImageFrame > detection_frame)
void publishSource(std::unique_ptr< SourceInterface > source) const
void notifyProgress(int position, int total)
virtual void labelImage(Segmentation::LabellingListener &listener, std::shared_ptr< const DetectionImageFrame > frame)=0
void setLabelling(Args... args)
std::shared_ptr< DetectionImageFrame::ImageFilter > m_filter_image_processing
Segmentation(std::shared_ptr< DetectionImageFrame::ImageFilter > image_processing)
void processFrame(std::shared_ptr< DetectionImageFrame > frame) const
Processes a Frame notifying Observers with a Source object for each detection.
std::unique_ptr< Labelling > m_labelling
virtual ~Segmentation()=default
Destructor.
T forward(T... args)
T move(T... args)
Event received by SourceGrouping to request the processing of some of the Sources stored.
Used to notify observers of the progress of the processing of the image.