X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=vv%2FvvToolSegmentation.h;h=4801403541d1aca2539637b18729b223ac8a3791;hb=7799c187328c3c00f84f820adb9341ca632f78ff;hp=84d99b5dbca4c1d0354ef791d42519bc44cbc1e9;hpb=0c99a00f9dfb4aa65dca28a55bc7c768b42f5559;p=clitk.git diff --git a/vv/vvToolSegmentation.h b/vv/vvToolSegmentation.h index 84d99b5..4801403 100644 --- a/vv/vvToolSegmentation.h +++ b/vv/vvToolSegmentation.h @@ -18,7 +18,12 @@ #ifndef VVTOOLSEGMENTATION_H #define VVTOOLSEGMENTATION_H +#include +#if QT_VERSION < QT_VERSION_CHECK(5, 5, 0) #include +#else +#include +#endif #include "vvToolBase.h" #include "vvToolWidgetBase.h" @@ -42,23 +47,22 @@ class vvToolSegmentation: static void Initialize(); virtual void InputIsSelected(vvSlicerManager * m); void OpenBinaryImage(); + void RegionGrowing(); void Erode(); void Dilate(); void Labelize(); + void Merge(); void RemoveLabel(); void UpdateAndRenderNewMask(); //----------------------------------------------------- public slots: virtual void apply(); - bool eventFilter(QObject *object, QEvent *event); + void KeyPressed(std::string KeyPress); virtual bool close(); virtual void MousePositionChanged(int slicer); - // virtual void keyPressEvent(QKeyEvent * event); - // virtual void reject(); protected: - // virtual void closeEvent(QCloseEvent *event); Ui::vvToolSegmentation ui; QSharedPointer mRefMaskActor; QSharedPointer mCurrentMaskActor; @@ -68,10 +72,25 @@ class vvToolSegmentation: vvImage::Pointer mCurrentCCLImage; int mKernelValue; vtkSmartPointer mDefaultLUTColor; - enum { Mode_Default, Mode_CCL}; - int mCurrentMode; + enum { State_Default, State_CCL}; + int mCurrentState; QSharedPointer CreateMaskActor(vvImage::Pointer image, int i, int colorID, bool BGMode=false); + + double mCurrentLabelUnderMousePointer; + std::vector mCurrentMousePositionInMM; + //std::vector mCurrentMousePositionInPixel; + double GetBackgroundValue() { return 0; } + double GetForegroundValue() { return 1; } + long ComputeNumberOfPixels(vvImage::Pointer image, double value); + + // Compute and store sizes of mask Foreground + void UpdateMaskSize(vvImage::Pointer image, long & pix, double & cc); + void UpdateMaskSizeLabels(); + long mRefMaskSizeInPixels; + double mRefMaskSizeInCC; + long mCurrentMaskSizeInPixels; + double mCurrentMaskSizeInCC; }; // end class vvToolSegmentation //------------------------------------------------------------------------------