]> Creatis software - clitk.git/blob - vv/vvToolStructureSetManager.h
Attempt to remove some leaks. DicomRT_Contour, DicomRT_ROI and DicomRT_StructureSet...
[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://oncora1.lyon.fnclcc.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 class vvStructureSetActor;
30
31 //------------------------------------------------------------------------------
32 class vvToolStructureSetManager:
33   public vvToolWidgetBase,
34   public vvToolBase<vvToolStructureSetManager>, 
35   private Ui::vvToolStructureSetManager
36 {
37   Q_OBJECT
38   public:
39   vvToolStructureSetManager(vvMainWindowBase* parent=0, Qt::WindowFlags f=0, vvSlicerManager * c = NULL);
40   ~vvToolStructureSetManager();
41
42   static void Initialize();
43   virtual void InputIsSelected(vvSlicerManager *m);
44
45   int AddStructureSet(clitk::DicomRT_StructureSet * mStructureSet);
46   void UpdateStructureSetInTreeWidget(int index, clitk::DicomRT_StructureSet * s);
47   void AddRoiInTreeWidget(clitk::DicomRT_ROI * roi, QTreeWidget * w);
48
49   static vvToolStructureSetManager * AddImage(vvSlicerManager * m, std::string name, vvImage::Pointer image, double BG, bool modeBG=true);    
50   void AddImage(vvImage * image, std::string filename, double BG, bool modeBG=true);
51   void UpdateImage();
52
53 public slots:
54   virtual void apply();
55   void Open(int type);
56   void OpenBinaryImage();
57   void SelectedItemChangedInTree();
58   void VisibleROIToggled(bool b);
59   void VisibleContourROIToggled(bool b);
60   void OpacityChanged(int v);
61   void ChangeColor();
62   void ChangeContourColor();
63   void ChangeContourWidth(int n);
64   void AllVisibleROIToggled(int b);
65   void AllVisibleContourROIToggled(bool b);
66   void ReloadCurrentROI();
67
68 protected:
69   Ui::vvToolStructureSetManager ui;
70   clitk::DicomRT_StructureSet* mCurrentStructureSet;
71   vvStructureSetActor * mCurrentStructureSetActor;
72   int mCurrentStructureSetIndex;
73   clitk::DicomRT_ROI::Pointer mCurrentROI;
74   vvROIActor * mCurrentROIActor;
75   vtkSmartPointer<vtkLookupTable> mDefaultLUTColor;
76   bool mIsAllVisibleEnabled;
77   int mNumberOfVisibleROI;
78   int mNumberOfVisibleContourROI;
79   std::vector<clitk::DicomRT_StructureSet::Pointer >       mStructureSetsList;
80   std::vector<vvStructureSetActor *>               mStructureSetActorsList;
81   std::map<int, QTreeWidgetItem *>                 mMapStructureSetIndexToTreeWidget;
82   std::map<clitk::DicomRT_ROI::Pointer, QTreeWidgetItem *> mMapROIToTreeWidget;
83   std::map<QTreeWidgetItem *, clitk::DicomRT_ROI::Pointer> mMapTreeWidgetToROI;
84   std::vector<int> mLoadedROIIndex;
85   std::vector<vvImage::Pointer> mOpenedBinaryImage;
86  
87   void setCurrentSelectedROI(clitk::DicomRT_ROI * roi);
88   void UpdateAllROIStatus();
89   virtual bool close();
90   virtual void closeEvent(QCloseEvent *event);
91
92   // Management of all instances
93   virtual void CheckInputList(std::vector<vvSlicerManager*> & l, int & index);
94   static std::vector<vvSlicerManager*> mListOfInputs;
95   static std::map<vvSlicerManager*, vvToolStructureSetManager*> mListOfOpenTool;
96   static int m_NumberOfTool;
97   bool MustOpenDialogWhenCreated;
98  
99 }; // end class vvToolStructureSetManager
100 //------------------------------------------------------------------------------
101
102 #endif
103