X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=vv%2FvvToolSegmentation.h;h=7e49dc46efc67486f496eb0be6c0093da113ac77;hb=HEAD;hp=21cdaf65215477824aa83b215e7fc77c855a98ad;hpb=916bb609956d9a3aa8e642dccd3fd8c46261b684;p=clitk.git diff --git a/vv/vvToolSegmentation.h b/vv/vvToolSegmentation.h index 21cdaf6..7e49dc4 100644 --- a/vv/vvToolSegmentation.h +++ b/vv/vvToolSegmentation.h @@ -18,13 +18,20 @@ #ifndef VVTOOLSEGMENTATION_H #define VVTOOLSEGMENTATION_H +#include +#if QT_VERSION >= 0x050000 +#include +#else #include +#endif #include "vvToolBase.h" #include "vvToolWidgetBase.h" #include "vvROIActor.h" #include "ui_vvToolSegmentation.h" +#include "vtkLookupTable.h" + //------------------------------------------------------------------------------ class vvToolSegmentation: public vvToolWidgetBase, @@ -40,25 +47,50 @@ class vvToolSegmentation: static void Initialize(); virtual void InputIsSelected(vvSlicerManager * m); void OpenBinaryImage(); + void RegionGrowing(); void Erode(); void Dilate(); - void UpdateAndRender(); + void Labelize(); + void Merge(); + void RemoveLabel(); + void UpdateAndRenderNewMask(); //----------------------------------------------------- public slots: virtual void apply(); - virtual void keyPressEvent(QKeyEvent * event); + void KeyPressed(std::string KeyPress); virtual bool close(); - // virtual void reject(); + virtual void MousePositionChanged(int slicer); protected: - // virtual void closeEvent(QCloseEvent *event); Ui::vvToolSegmentation ui; QSharedPointer mRefMaskActor; QSharedPointer mCurrentMaskActor; + std::vector > mCurrentCCLActors; vvImage::Pointer mRefMaskImage; vvImage::Pointer mCurrentMaskImage; + vvImage::Pointer mCurrentCCLImage; int mKernelValue; + vtkSmartPointer mDefaultLUTColor; + 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 //------------------------------------------------------------------------------