]> Creatis software - clitk.git/blobdiff - vv/vvToolStructureSetManager.h
Add a list of open images to correctly release memory when the tool is closed
[clitk.git] / vv / vvToolStructureSetManager.h
index 0cd747345e302d85df99a1b0055040cfa4ba9e77..6ea88085905c8c7e947c2520bbaee140964de05a 100644 (file)
@@ -14,7 +14,7 @@
 
   - BSD        See included LICENSE.txt file
   - CeCILL-B   http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html
-======================================================================-====*/
+  ======================================================================-====*/
 
 #ifndef VVTOOLSTRUCTURESETMANAGER_H
 #define VVTOOLSTRUCTURESETMANAGER_H
@@ -35,8 +35,8 @@ class vvToolStructureSetManager:
   private Ui::vvToolStructureSetManager
 {
   Q_OBJECT
-    public:
-  vvToolStructureSetManager(vvMainWindowBase* parent=0, Qt::WindowFlags f=0);
+  public:
+  vvToolStructureSetManager(vvMainWindowBase* parent=0, Qt::WindowFlags f=0, vvSlicerManager * c = NULL);
   ~vvToolStructureSetManager();
 
   static void Initialize();
@@ -46,10 +46,13 @@ class vvToolStructureSetManager:
   void UpdateStructureSetInTreeWidget(int index, clitk::DicomRT_StructureSet * s);
   void AddRoiInTreeWidget(clitk::DicomRT_ROI * roi, QTreeWidget * w);
 
+  static vvToolStructureSetManager * AddImage(vvSlicerManager * m, std::string name, vvImage::Pointer image, double BG, bool modeBG=true);    
+  void AddImage(vvImage * image, std::string filename, double BG, bool modeBG=true);
+  void UpdateImage();
+
 public slots:
   virtual void apply();
   void Open(int type);
-  void LeftButtonReleaseEvent(int slicer);
   void OpenBinaryImage();
   void SelectedItemChangedInTree();
   void VisibleROIToggled(bool b);
@@ -58,11 +61,11 @@ public slots:
   void ChangeColor();
   void ChangeContourColor();
   void ChangeContourWidth(int n);
-  void AllVisibleROIToggled(bool b);
+  void AllVisibleROIToggled(int b);
   void AllVisibleContourROIToggled(bool b);
-  void AllOpacityChanged(int v);
+  void ReloadCurrentROI();
 
- protected:
+protected:
   Ui::vvToolStructureSetManager ui;
   clitk::DicomRT_StructureSet * mCurrentStructureSet;
   vvStructureSetActor * mCurrentStructureSetActor;
@@ -70,17 +73,29 @@ public slots:
   clitk::DicomRT_ROI * mCurrentROI;
   vvROIActor * mCurrentROIActor;
   vtkLookupTable * mDefaultLUTColor;
-  void setCurrentSelectedROI(clitk::DicomRT_ROI * roi);
-  std::vector<clitk::DicomRT_StructureSet*> mStructureSetsList;
-  std::vector<vvStructureSetActor *> mStructureSetActorsList;
-  std::map<int, QTreeWidgetItem *> mMapStructureSetIndexToTreeWidget;
-  std::map<clitk::DicomRT_ROI*, QTreeWidgetItem *> mMapROIToTreeWidget;
-  std::map<QTreeWidgetItem *, clitk::DicomRT_ROI*> mMapTreeWidgetToROI;
   bool mIsAllVisibleEnabled;
   int mNumberOfVisibleROI;
+  int mNumberOfVisibleContourROI;
+  std::vector<clitk::DicomRT_StructureSet* >       mStructureSetsList;
+  std::vector<vvStructureSetActor *>               mStructureSetActorsList;
+  std::map<int, QTreeWidgetItem *>                 mMapStructureSetIndexToTreeWidget;
+  std::map<clitk::DicomRT_ROI*, QTreeWidgetItem *> mMapROIToTreeWidget;
+  std::map<QTreeWidgetItem *, clitk::DicomRT_ROI*> mMapTreeWidgetToROI;
+  std::vector<int> mLoadedROIIndex;
+  std::vector<vvImage::Pointer> mOpenedBinaryImage;
+  void setCurrentSelectedROI(clitk::DicomRT_ROI * roi);
+  void UpdateAllROIStatus();
+  virtual bool close();
+  virtual void closeEvent(QCloseEvent *event);
 
+  // Management of all instances
+  virtual void CheckInputList(std::vector<vvSlicerManager*> & l, int & index);
+  static std::vector<vvSlicerManager*> mListOfInputs;
+  static std::map<vvSlicerManager*, vvToolStructureSetManager*> mListOfOpenTool;
+  static int m_NumberOfTool;
+  bool MustOpenDialogWhenCreated;
 }; // end class vvToolStructureSetManager
 //------------------------------------------------------------------------------