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 ===========================================================================**/
19 #ifndef VVTOOLROIMANAGER_H
20 #define VVTOOLROIMANAGER_H
22 #include <QtDesigner/QDesignerExportWidget>
23 #include <QSharedPointer>
25 #include "vvToolBase.h"
26 #include "vvROIActor.h"
27 #include "clitkDicomRT_ROI.h"
28 #include "ui_vvToolROIManager.h"
32 //------------------------------------------------------------------------------
33 class vvToolROIManager:
35 public vvToolBase<vvToolROIManager>,
36 public Ui::vvToolROIManager
40 vvToolROIManager(vvMainWindowBase* parent=0, Qt::WindowFlags f=Qt::Dialog);
41 virtual ~vvToolROIManager();
43 static void Initialize();
44 virtual void InputIsSelected(vvSlicerManager *m);
46 void AddImage(vvImage * binaryImage, std::string filename, double BG, bool m_modeBG=true);
47 void UpdateAllContours();
48 void UpdateAllROIStatus();
49 virtual void SaveState(std::auto_ptr<QXmlStreamWriter> & m_XmlWriter);
50 virtual void InitializeNewTool(bool ReadStateFlag);
53 void AnImageIsBeingClosed(vvSlicerManager *);
54 void SelectedImageHasChanged(vvSlicerManager *);
55 void OpenBinaryImage();
56 void OpenBinaryImage(QStringList & filenames);
57 void OpenDicomImage();
58 void SelectedItemChangedInTree();
59 void VisibleROIToggled(bool b);
60 void VisibleContourROIToggled(bool b);
61 void OpacityChanged(int v);
63 void ChangeContourColor();
64 void ChangeContourWidth(int n);
65 void ChangeDepth(int n);
66 void AllVisibleROIToggled(int b);
67 void AllVisibleContourROIToggled(bool b);
68 void ReloadCurrentROI();
70 vvSlicerManager * GetCurrentSlicerManager() { return mCurrentSlicerManager; }
73 Ui::vvToolROIManager ui;
74 vvSlicerManager * mCurrentSlicerManager; // need it because do not inherit from vvToolWidgetBase
75 vvImage * mCurrentImage;
76 vvMainWindowBase * mMainWindow;
78 bool mOpenFileBrowserFlag;
80 int mNumberOfVisibleROI;
81 int mNumberOfVisibleContourROI;
83 vtkSmartPointer<vtkLookupTable> mDefaultLUTColor;
85 QStringList mOpenedBinaryImageFilenames;
86 std::vector<clitk::DicomRT_ROI::Pointer> mROIList;
87 std::vector<QSharedPointer<vvROIActor> > mROIActorsList;
89 // Data for the widget Tree
90 std::vector< QSharedPointer<QTreeWidgetItem> > mTreeWidgetList;
91 std::map<clitk::DicomRT_ROI::Pointer, QTreeWidgetItem *> mMapROIToTreeWidget;
92 std::map<QTreeWidgetItem *, clitk::DicomRT_ROI::Pointer> mMapTreeWidgetToROI;
94 // Data for current selected roi
95 clitk::DicomRT_ROI::Pointer mCurrentROI;
96 QSharedPointer<vvROIActor> mCurrentROIActor;
98 // Data for XML Reader
99 void ReadXMLInformation();
100 void ReadXMLInformation_ROI();
101 uint mInitialImageIndex;
102 QStringList mROIFilenames;
103 std::vector<QSharedPointer<vvROIActor> > mROIActorsParamList;
105 }; // end class vvToolROIManager
106 //------------------------------------------------------------------------------