1 /*=========================================================================
2 Program: vv http://www.creatis.insa-lyon.fr/rio/vv
5 - University of LYON http://www.universite-lyon.fr/
6 - Léon Bérard cancer center http://www.centreleonberard.fr
7 - CREATIS CNRS laboratory http://www.creatis.insa-lyon.fr
9 This software is distributed WITHOUT ANY WARRANTY; without even
10 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
11 PURPOSE. See the copyright notices for more information.
13 It is distributed under dual licence
15 - BSD See included LICENSE.txt file
16 - CeCILL-B http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html
17 ===========================================================================**/
18 #ifndef VVTOOLSEGMENTATION_H
19 #define VVTOOLSEGMENTATION_H
21 #if QT_VERSION < 0x050000
22 #include <QtDesigner/QDesignerExportWidget>
24 #include <QtUiPlugin/QDesignerExportWidget>
27 #include "vvToolBase.h"
28 #include "vvToolWidgetBase.h"
29 #include "vvROIActor.h"
30 #include "ui_vvToolSegmentation.h"
32 #include "vtkLookupTable.h"
34 //------------------------------------------------------------------------------
35 class vvToolSegmentation:
36 public vvToolWidgetBase,
37 public vvToolBase<vvToolSegmentation>,
38 private Ui::vvToolSegmentation
42 vvToolSegmentation(vvMainWindowBase * parent=0, Qt::WindowFlags f=0);
43 ~vvToolSegmentation();
45 //-----------------------------------------------------
46 static void Initialize();
47 virtual void InputIsSelected(vvSlicerManager * m);
48 void OpenBinaryImage();
55 void UpdateAndRenderNewMask();
57 //-----------------------------------------------------
60 void KeyPressed(std::string KeyPress);
62 virtual void MousePositionChanged(int slicer);
65 Ui::vvToolSegmentation ui;
66 QSharedPointer<vvROIActor> mRefMaskActor;
67 QSharedPointer<vvROIActor> mCurrentMaskActor;
68 std::vector<QSharedPointer<vvROIActor> > mCurrentCCLActors;
69 vvImage::Pointer mRefMaskImage;
70 vvImage::Pointer mCurrentMaskImage;
71 vvImage::Pointer mCurrentCCLImage;
73 vtkSmartPointer<vtkLookupTable> mDefaultLUTColor;
74 enum { State_Default, State_CCL};
77 QSharedPointer<vvROIActor> CreateMaskActor(vvImage::Pointer image, int i, int colorID, bool BGMode=false);
79 double mCurrentLabelUnderMousePointer;
80 std::vector<double> mCurrentMousePositionInMM;
81 //std::vector<double> mCurrentMousePositionInPixel;
82 double GetBackgroundValue() { return 0; }
83 double GetForegroundValue() { return 1; }
84 long ComputeNumberOfPixels(vvImage::Pointer image, double value);
86 // Compute and store sizes of mask Foreground
87 void UpdateMaskSize(vvImage::Pointer image, long & pix, double & cc);
88 void UpdateMaskSizeLabels();
89 long mRefMaskSizeInPixels;
90 double mRefMaskSizeInCC;
91 long mCurrentMaskSizeInPixels;
92 double mCurrentMaskSizeInCC;
94 }; // end class vvToolSegmentation
95 //------------------------------------------------------------------------------