SourceXtractorPlusPlus  0.19
SourceXtractor++, the next generation SExtractor
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Segmentation.h
Go to the documentation of this file.
1 
23 #ifndef _SEFRAMEWORK_PIPELINE_SEGMENTATION_H
24 #define _SEFRAMEWORK_PIPELINE_SEGMENTATION_H
25 
26 #include <memory>
27 #include <type_traits>
28 
36 
37 namespace SourceXtractor {
38 
45 };
46 
53 class Segmentation : public PipelineEmitter<SourceInterface> , public Observable<SegmentationProgress> {
54 
55 public:
56  class LabellingListener;
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");
69  "LabellingType must be constructible from args");
70 
71  m_labelling.reset(new LabellingType(std::forward<Args>(args)...));
72  }
73 
76 
77 private:
80 
81 }; /* End of Segmentation class */
82 
84 public:
86  m_segmentation(segmentation),
87  m_detection_frame(detection_frame) {}
88 
90  source->setProperty<DetectionFrame>(m_detection_frame);
92  }
93 
94  void notifyProgress(int position, int total) {
95  m_segmentation.Observable<SegmentationProgress>::notifyObservers(SegmentationProgress{position, total});
96  }
97 
100  }
101 
102 private:
105 };
106 
108 public:
109  virtual ~Labelling() = default;
111 
113 };
114 
115 } /* namespace SourceXtractor */
116 
117 #endif
void sendProcessSignal(const ProcessSourcesEvent &event) const
Definition: PipelineStage.h:92
Used to notify observers of the progress of the processing of the image.
Definition: Segmentation.h:43
LabellingListener(const Segmentation &segmentation, std::shared_ptr< DetectionImageFrame > detection_frame)
Definition: Segmentation.h:85
Event received by SourceGrouping to request the processing of some of the Sources stored...
Definition: PipelineStage.h:33
Segmentation(std::shared_ptr< DetectionImageFrame::ImageFilter > image_processing)
Segmentation takes an image and splits it into individual Sources for further refinement. Each Source results in a notification of the Segmentation&#39;s Observers.
Definition: Segmentation.h:53
std::shared_ptr< DetectionImageFrame > m_detection_frame
Definition: Segmentation.h:104
std::shared_ptr< DetectionImageFrame::ImageFilter > m_filter_image_processing
Definition: Segmentation.h:79
void requestProcessing(const ProcessSourcesEvent &event)
Definition: Segmentation.h:98
std::unique_ptr< Labelling > m_labelling
Definition: Segmentation.h:78
Implements the Observer pattern. Notifications will be made using a message of type T...
Definition: Observable.h:51
virtual void labelImage(Segmentation::LabellingListener &listener, std::shared_ptr< const DetectionImageFrame > frame)=0
T move(T...args)
void notifyProgress(int position, int total)
Definition: Segmentation.h:94
STL class.
void setLabelling(Args...args)
Definition: Segmentation.h:65
virtual ~Segmentation()=default
Destructor.
void processFrame(std::shared_ptr< DetectionImageFrame > frame) const
Processes a Frame notifying Observers with a Source object for each detection.
void sendSource(std::unique_ptr< T > source) const
Definition: PipelineStage.h:85
void publishSource(std::unique_ptr< SourceInterface > source) const
Definition: Segmentation.h:89