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
22 #if QT_VERSION < 0x050000
23 #include <QtDesigner/QDesignerExportWidget>
25 #include <QtUiPlugin/QDesignerExportWidget>
28 #include "vvToolBase.h"
29 #include "vvToolWidgetBase.h"
30 #include "vvROIActor.h"
31 #include "ui_vvToolSegmentation.h"
33 #include "vtkLookupTable.h"
35 //------------------------------------------------------------------------------
36 class vvToolSegmentation:
37 public vvToolWidgetBase,
38 public vvToolBase<vvToolSegmentation>,
39 private Ui::vvToolSegmentation
43 vvToolSegmentation(vvMainWindowBase * parent=0, Qt::WindowFlags f=0);
44 ~vvToolSegmentation();
46 //-----------------------------------------------------
47 static void Initialize();
48 virtual void InputIsSelected(vvSlicerManager * m);
49 void OpenBinaryImage();
56 void UpdateAndRenderNewMask();
58 //-----------------------------------------------------
61 void KeyPressed(std::string KeyPress);
63 virtual void MousePositionChanged(int slicer);
66 Ui::vvToolSegmentation ui;
67 QSharedPointer<vvROIActor> mRefMaskActor;
68 QSharedPointer<vvROIActor> mCurrentMaskActor;
69 std::vector<QSharedPointer<vvROIActor> > mCurrentCCLActors;
70 vvImage::Pointer mRefMaskImage;
71 vvImage::Pointer mCurrentMaskImage;
72 vvImage::Pointer mCurrentCCLImage;
74 vtkSmartPointer<vtkLookupTable> mDefaultLUTColor;
75 enum { State_Default, State_CCL};
78 QSharedPointer<vvROIActor> CreateMaskActor(vvImage::Pointer image, int i, int colorID, bool BGMode=false);
80 double mCurrentLabelUnderMousePointer;
81 std::vector<double> mCurrentMousePositionInMM;
82 //std::vector<double> mCurrentMousePositionInPixel;
83 double GetBackgroundValue() { return 0; }
84 double GetForegroundValue() { return 1; }
85 long ComputeNumberOfPixels(vvImage::Pointer image, double value);
87 // Compute and store sizes of mask Foreground
88 void UpdateMaskSize(vvImage::Pointer image, long & pix, double & cc);
89 void UpdateMaskSizeLabels();
90 long mRefMaskSizeInPixels;
91 double mRefMaskSizeInCC;
92 long mCurrentMaskSizeInPixels;
93 double mCurrentMaskSizeInCC;
95 }; // end class vvToolSegmentation
96 //------------------------------------------------------------------------------