]> Creatis software - clitk.git/blob - vv/vvToolStructureSetManager.h
Be sure to have memory consuption in kB, MB, GB instead of kibibytes, ...
[clitk.git] / vv / vvToolStructureSetManager.h
1 /*=========================================================================
2   Program:   vv                     http://www.creatis.insa-lyon.fr/rio/vv
3
4   Authors belong to: 
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
8
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.
12
13   It is distributed under dual licence
14
15   - BSD        See included LICENSE.txt file
16   - CeCILL-B   http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html
17   ===========================================================================**/
18
19 #ifndef VVTOOLSTRUCTURESETMANAGER_H
20 #define VVTOOLSTRUCTURESETMANAGER_H
21
22 #include <QtDesigner/QDesignerExportWidget>
23 #include "vvToolBase.h"
24 #include "vvToolWidgetBase.h"
25 #include "clitkDicomRT_StructureSet.h"
26 #include "ui_vvToolStructureSetManager.h"
27 #include "vvROIActor.h"
28
29 #include <QSharedPointer>
30
31 class vvStructureSetActor;
32
33 //------------------------------------------------------------------------------
34 class vvToolStructureSetManager:
35   public vvToolWidgetBase,
36   public vvToolBase<vvToolStructureSetManager>, 
37   private Ui::vvToolStructureSetManager
38 {
39   Q_OBJECT
40   public:
41   vvToolStructureSetManager(vvMainWindowBase* parent=0, Qt::WindowFlags f=0, vvSlicerManager * c = NULL);
42   virtual ~vvToolStructureSetManager();
43
44   static void Initialize();
45   virtual void InputIsSelected(vvSlicerManager *m);
46
47   int AddStructureSet(clitk::DicomRT_StructureSet * mStructureSet);
48   void UpdateStructureSetInTreeWidget(int index, clitk::DicomRT_StructureSet * s);
49   void AddRoiInTreeWidget(clitk::DicomRT_ROI * roi, QTreeWidget * w);
50
51   static vvToolStructureSetManager * AddImage(vvSlicerManager * m, std::string name, vvImage::Pointer image, double BG, bool modeBG=true);    
52   void AddImage(vvImage * image, std::string filename, double BG, bool modeBG=true);
53   void UpdateImage();
54
55 public slots:
56   virtual void apply();
57   void Open(int type);
58   void OpenBinaryImage();
59   void SelectedItemChangedInTree();
60   void VisibleROIToggled(bool b);
61   void VisibleContourROIToggled(bool b);
62   void OpacityChanged(int v);
63   void ChangeColor();
64   void ChangeContourColor();
65   void ChangeContourWidth(int n);
66   void ChangeDepth(int n);
67   void AllVisibleROIToggled(int b);
68   void AllVisibleContourROIToggled(bool b);
69   void ReloadCurrentROI();
70
71 protected:
72   Ui::vvToolStructureSetManager ui;
73   clitk::DicomRT_StructureSet* mCurrentStructureSet;
74   vvStructureSetActor * mCurrentStructureSetActor;
75   int mCurrentStructureSetIndex;
76   clitk::DicomRT_ROI::Pointer mCurrentROI;
77   vvROIActor * mCurrentROIActor;
78   vtkSmartPointer<vtkLookupTable> mDefaultLUTColor;
79   bool mIsAllVisibleEnabled;
80   int mNumberOfVisibleROI;
81   int mNumberOfVisibleContourROI;
82   std::vector<clitk::DicomRT_StructureSet::Pointer > mStructureSetsList;
83   std::vector< QSharedPointer<vvStructureSetActor> > mStructureSetActorsList;
84   std::vector< QSharedPointer<QTreeWidgetItem> > mTreeWidgetList;
85   std::map<clitk::DicomRT_ROI::Pointer, QTreeWidgetItem *> mMapROIToTreeWidget;
86   std::map<QTreeWidgetItem *, clitk::DicomRT_ROI::Pointer> mMapTreeWidgetToROI;
87   std::vector<int> mLoadedROIIndex;
88   std::vector<vvImage::Pointer> mOpenedBinaryImage;
89  
90   void setCurrentSelectedROI(clitk::DicomRT_ROI * roi);
91   void UpdateAllROIStatus();
92   virtual bool close();
93   virtual void closeEvent(QCloseEvent *event);
94
95   // Management of all instances
96   virtual void CheckInputList(std::vector<vvSlicerManager*> & l, int & index);
97   static std::vector<vvSlicerManager*> mListOfInputs;
98   static std::map<vvSlicerManager*, vvToolStructureSetManager*> mListOfOpenTool;
99   static int m_NumberOfTool;
100   bool MustOpenDialogWhenCreated;
101  
102 }; // end class vvToolStructureSetManager
103 //------------------------------------------------------------------------------
104
105 #endif
106