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 #include <QtDesigner/QDesignerExportWidget>
24 #include "vvToolBase.h"
25 #include "vvToolWidgetBase.h"
26 #include "vvROIActor.h"
27 #include "ui_vvToolSegmentation.h"
29 #include "vtkLookupTable.h"
31 //------------------------------------------------------------------------------
32 class vvToolSegmentation:
33 public vvToolWidgetBase,
34 public vvToolBase<vvToolSegmentation>,
35 private Ui::vvToolSegmentation
39 vvToolSegmentation(vvMainWindowBase * parent=0, Qt::WindowFlags f=0);
40 ~vvToolSegmentation();
42 //-----------------------------------------------------
43 static void Initialize();
44 virtual void InputIsSelected(vvSlicerManager * m);
45 void OpenBinaryImage();
52 void UpdateAndRenderNewMask();
54 //-----------------------------------------------------
57 void KeyPressed(std::string KeyPress);
59 virtual void MousePositionChanged(int slicer);
62 Ui::vvToolSegmentation ui;
63 QSharedPointer<vvROIActor> mRefMaskActor;
64 QSharedPointer<vvROIActor> mCurrentMaskActor;
65 std::vector<QSharedPointer<vvROIActor> > mCurrentCCLActors;
66 vvImage::Pointer mRefMaskImage;
67 vvImage::Pointer mCurrentMaskImage;
68 vvImage::Pointer mCurrentCCLImage;
70 vtkSmartPointer<vtkLookupTable> mDefaultLUTColor;
71 enum { State_Default, State_CCL};
74 QSharedPointer<vvROIActor> CreateMaskActor(vvImage::Pointer image, int i, int colorID, bool BGMode=false);
76 double mCurrentLabelUnderMousePointer;
77 std::vector<double> mCurrentMousePositionInMM;
78 //std::vector<double> mCurrentMousePositionInPixel;
79 double GetBackgroundValue() { return 0; }
80 double GetForegroundValue() { return 1; }
81 long ComputeNumberOfPixels(vvImage::Pointer image, double value);
83 // Compute and store sizes of mask Foreground
84 void UpdateMaskSize(vvImage::Pointer image, long & pix, double & cc);
85 void UpdateMaskSizeLabels();
86 long mRefMaskSizeInPixels;
87 double mRefMaskSizeInCC;
88 long mCurrentMaskSizeInPixels;
89 double mCurrentMaskSizeInCC;
91 }; // end class vvToolSegmentation
92 //------------------------------------------------------------------------------