13 #ifndef mitkGrabCutOpenCVImageFilter_h
14 #define mitkGrabCutOpenCVImageFilter_h
21 #include "itkObjectFactory.h"
22 #include <itkThreadSupport.h>
25 #include <opencv2/core.hpp>
27 #include <condition_variable>
32 template<
unsigned int T>
class Index;
35 class ConditionVariable;
69 itkFactorylessNewMacro(Self);
85 bool OnFilterImage( cv::Mat& image )
override;
103 void SetModelPoints(cv::Mat foregroundMask);
110 void SetModelPoints(cv::Mat foregroundMask, cv::Mat backgroundMask);
124 void SetModelPointsDilationSize(
int modelPointsDilationSize);
137 void SetUseOnlyRegionAroundModelPoints(
unsigned int additionalBorder);
145 void SetUseFullImage();
153 cv::Rect GetRegionAroundModelPoints();
166 int GetResultImageId();
176 cv::Mat GetResultMask();
192 std::vector<ModelPointsList> GetResultContours();
218 cv::Mat GetMaskFromPointSets();
225 cv::Rect GetBoundingRectFromMask(cv::Mat mask);
233 cv::Mat RunSegmentation(cv::Mat input, cv::Mat mask);
269 void SegmentationWorker();
271 std::thread m_Thread;
276 std::condition_variable m_WorkerBarrier;
279 std::mutex m_ImageMutex;
282 std::mutex m_ResultMutex;
285 std::mutex m_PointSetsMutex;