SourceXtractorPlusPlus
0.19
SourceXtractor++, the next generation SExtractor
Main Page
Related Pages
Namespaces
Classes
Files
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Groups
Pages
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
std::shared_ptr
SourceXtractor::PipelineEmitter::sendProcessSignal
void sendProcessSignal(const ProcessSourcesEvent &event) const
Definition:
PipelineStage.h:92
SourceXtractor::SegmentationProgress
Used to notify observers of the progress of the processing of the image.
Definition:
Segmentation.h:43
SourceXtractor::Segmentation::LabellingListener::LabellingListener
LabellingListener(const Segmentation &segmentation, std::shared_ptr< DetectionImageFrame > detection_frame)
Definition:
Segmentation.h:85
SourceXtractor::SegmentationProgress::position
int position
Definition:
Segmentation.h:44
SourceXtractor::Segmentation::LabellingListener
Definition:
Segmentation.h:83
SourceXtractor::ProcessSourcesEvent
Event received by SourceGrouping to request the processing of some of the Sources stored...
Definition:
PipelineStage.h:33
SourceXtractor::Segmentation::Segmentation
Segmentation(std::shared_ptr< DetectionImageFrame::ImageFilter > image_processing)
Definition:
Segmentation.cpp:27
SourceXtractor::Segmentation
Segmentation takes an image and splits it into individual Sources for further refinement. Each Source results in a notification of the Segmentation's Observers.
Definition:
Segmentation.h:53
SourceXtractor::Segmentation::LabellingListener::m_detection_frame
std::shared_ptr< DetectionImageFrame > m_detection_frame
Definition:
Segmentation.h:104
PipelineStage.h
SourceXtractor::Segmentation::m_filter_image_processing
std::shared_ptr< DetectionImageFrame::ImageFilter > m_filter_image_processing
Definition:
Segmentation.h:79
std::is_constructible
SourceXtractor::Segmentation::LabellingListener::requestProcessing
void requestProcessing(const ProcessSourcesEvent &event)
Definition:
Segmentation.h:98
SourceXtractor::Segmentation::m_labelling
std::unique_ptr< Labelling > m_labelling
Definition:
Segmentation.h:78
SourceXtractor::DetectionFrame
Definition:
DetectionFrame.h:33
Image.h
SourceXtractor::Observable
Implements the Observer pattern. Notifications will be made using a message of type T...
Definition:
Observable.h:51
SourceXtractor::Segmentation::Labelling::labelImage
virtual void labelImage(Segmentation::LabellingListener &listener, std::shared_ptr< const DetectionImageFrame > frame)=0
Frame.h
DetectionFrame.h
std::move
T move(T...args)
SourceInterface.h
CoordinateSystem.h
SourceXtractor::Segmentation::LabellingListener::notifyProgress
void notifyProgress(int position, int total)
Definition:
Segmentation.h:94
std::unique_ptr
STL class.
SourceXtractor::Segmentation::Labelling::~Labelling
virtual ~Labelling()=default
SourceXtractor::SegmentationProgress::total
int total
Definition:
Segmentation.h:44
std::is_base_of
SourceXtractor::Segmentation::setLabelling
void setLabelling(Args...args)
Definition:
Segmentation.h:65
SourceXtractor::Segmentation::~Segmentation
virtual ~Segmentation()=default
Destructor.
SourceXtractor::Segmentation::Labelling::Labelling
Labelling()
Definition:
Segmentation.h:110
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::PipelineEmitter::sendSource
void sendSource(std::unique_ptr< T > source) const
Definition:
PipelineStage.h:85
SourceXtractor::Segmentation::LabellingListener::publishSource
void publishSource(std::unique_ptr< SourceInterface > source) const
Definition:
Segmentation.h:89
SourceXtractor::Segmentation::Labelling
Definition:
Segmentation.h:107
SourceGrouping.h
SourceXtractor::PipelineEmitter
Definition:
PipelineStage.h:68
SourceXtractor::Segmentation::LabellingListener::m_segmentation
const Segmentation & m_segmentation
Definition:
Segmentation.h:103
Generated by
1.8.5