SourceXtractorPlusPlus
0.19.2
SourceXtractor++, the next generation SExtractor
Loading...
Searching...
No Matches
SEFramework
SEFramework
Pipeline
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
29
#include "
SEFramework/CoordinateSystem/CoordinateSystem.h
"
30
#include "
SEFramework/Frame/Frame.h
"
31
#include "
SEFramework/Image/Image.h
"
32
#include "
SEFramework/Pipeline/PipelineStage.h
"
33
#include "
SEFramework/Pipeline/SourceGrouping.h
"
34
#include "
SEFramework/Property/DetectionFrame.h
"
35
#include "
SEFramework/Source/SourceInterface.h
"
36
37
namespace
SourceXtractor
{
38
43
struct
SegmentationProgress
{
44
int
position
,
total
;
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
62
explicit
Segmentation
(
std::shared_ptr<DetectionImageFrame::ImageFilter>
image_processing);
63
64
template
<
class
LabellingType,
typename
... Args>
65
void
setLabelling
(Args... args) {
66
static_assert
(
std::is_base_of<Labelling, LabellingType>::value
,
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
75
void
processFrame
(
std::shared_ptr<DetectionImageFrame>
frame)
const
;
76
77
private
:
78
std::unique_ptr<Labelling>
m_labelling
;
79
std::shared_ptr<DetectionImageFrame::ImageFilter>
m_filter_image_processing
;
80
81
};
/* End of Segmentation class */
82
83
class
Segmentation::LabellingListener
{
84
public
:
85
LabellingListener
(
const
Segmentation
& segmentation,
std::shared_ptr<DetectionImageFrame>
detection_frame) :
86
m_segmentation
(segmentation),
87
m_detection_frame
(detection_frame) {}
88
89
void
publishSource
(
std::unique_ptr<SourceInterface>
source)
const
{
90
source->setProperty<
DetectionFrame
>(
m_detection_frame
);
91
m_segmentation
.
sendSource
(
std::move
(source));
92
}
93
94
void
notifyProgress
(
int
position,
int
total) {
95
m_segmentation
.Observable<SegmentationProgress>::notifyObservers(
SegmentationProgress
{position, total});
96
}
97
98
void
requestProcessing
(
const
ProcessSourcesEvent
& event) {
99
m_segmentation
.
sendProcessSignal
(event);
100
}
101
102
private
:
103
const
Segmentation
&
m_segmentation
;
104
std::shared_ptr<DetectionImageFrame>
m_detection_frame
;
105
};
106
107
class
Segmentation::Labelling
{
108
public
:
109
virtual
~Labelling
() =
default
;
110
Labelling
() {}
111
112
virtual
void
labelImage
(
Segmentation::LabellingListener
& listener,
std::shared_ptr<const DetectionImageFrame>
frame) = 0;
113
};
114
115
}
/* namespace SourceXtractor */
116
117
#endif
CoordinateSystem.h
DetectionFrame.h
Frame.h
Image.h
PipelineStage.h
SourceGrouping.h
SourceInterface.h
SourceXtractor::DetectionFrame
Definition
DetectionFrame.h:33
SourceXtractor::Observable
Implements the Observer pattern. Notifications will be made using a message of type T.
Definition
Observable.h:51
SourceXtractor::PipelineEmitter
Definition
PipelineStage.h:68
SourceXtractor::PipelineEmitter::sendProcessSignal
void sendProcessSignal(const ProcessSourcesEvent &event) const
Definition
PipelineStage.h:92
SourceXtractor::PipelineEmitter::sendSource
void sendSource(std::unique_ptr< T > source) const
Definition
PipelineStage.h:85
SourceXtractor::Segmentation::LabellingListener
Definition
Segmentation.h:83
SourceXtractor::Segmentation::LabellingListener::requestProcessing
void requestProcessing(const ProcessSourcesEvent &event)
Definition
Segmentation.h:98
SourceXtractor::Segmentation::LabellingListener::m_detection_frame
std::shared_ptr< DetectionImageFrame > m_detection_frame
Definition
Segmentation.h:104
SourceXtractor::Segmentation::LabellingListener::LabellingListener
LabellingListener(const Segmentation &segmentation, std::shared_ptr< DetectionImageFrame > detection_frame)
Definition
Segmentation.h:85
SourceXtractor::Segmentation::LabellingListener::publishSource
void publishSource(std::unique_ptr< SourceInterface > source) const
Definition
Segmentation.h:89
SourceXtractor::Segmentation::LabellingListener::m_segmentation
const Segmentation & m_segmentation
Definition
Segmentation.h:103
SourceXtractor::Segmentation::LabellingListener::notifyProgress
void notifyProgress(int position, int total)
Definition
Segmentation.h:94
SourceXtractor::Segmentation::Labelling
Definition
Segmentation.h:107
SourceXtractor::Segmentation::Labelling::labelImage
virtual void labelImage(Segmentation::LabellingListener &listener, std::shared_ptr< const DetectionImageFrame > frame)=0
SourceXtractor::Segmentation::Labelling::Labelling
Labelling()
Definition
Segmentation.h:110
SourceXtractor::Segmentation::Labelling::~Labelling
virtual ~Labelling()=default
SourceXtractor::Segmentation
Segmentation takes an image and splits it into individual Sources for further refinement....
Definition
Segmentation.h:53
SourceXtractor::Segmentation::setLabelling
void setLabelling(Args... args)
Definition
Segmentation.h:65
SourceXtractor::Segmentation::m_filter_image_processing
std::shared_ptr< DetectionImageFrame::ImageFilter > m_filter_image_processing
Definition
Segmentation.h:79
SourceXtractor::Segmentation::processFrame
void processFrame(std::shared_ptr< DetectionImageFrame > frame) const
Processes a Frame notifying Observers with a Source object for each detection.
Definition
Segmentation.cpp:31
SourceXtractor::Segmentation::m_labelling
std::unique_ptr< Labelling > m_labelling
Definition
Segmentation.h:78
SourceXtractor::Segmentation::~Segmentation
virtual ~Segmentation()=default
Destructor.
std::is_base_of
std::is_constructible
std::move
T move(T... args)
SourceXtractor
Definition
Aperture.h:30
std::shared_ptr
SourceXtractor::ProcessSourcesEvent
Event received by SourceGrouping to request the processing of some of the Sources stored.
Definition
PipelineStage.h:33
SourceXtractor::SegmentationProgress
Used to notify observers of the progress of the processing of the image.
Definition
Segmentation.h:43
SourceXtractor::SegmentationProgress::position
int position
Definition
Segmentation.h:44
SourceXtractor::SegmentationProgress::total
int total
Definition
Segmentation.h:44
std::unique_ptr
Generated by
1.9.7