]> Creatis software - creaMaracasVisu.git/blob - lib/maracasVisuLib/src/CutModule/kernel/CutModelManager.h
14907c523c3ce70071cdbb9d15818d65d7d22013
[creaMaracasVisu.git] / lib / maracasVisuLib / src / CutModule / kernel / CutModelManager.h
1 /*=========================================================================
2
3   Program:   wxMaracas
4   Module:    $RCSfile: CutModelManager.h,v $
5   Language:  C++
6   Date:      $Date: 2009/09/08 08:14:27 $
7   Version:   $Revision: 1.3 $
8
9   Copyright: (c) 2002, 2003
10   License:
11   
12      This software is distributed WITHOUT ANY WARRANTY; without even 
13      the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 
14      PURPOSE.  See the above copyright notice for more information.
15
16 =========================================================================*/
17
18
19
20
21 #ifndef __CutModelManagerH__
22 #define __CutModelManagerH__
23
24 #include <iostream>
25 #include <stdio.h>
26 #include <vector>
27
28 #include "vtkImageData.h"
29 #include "vtkRenderWindowInteractor.h"
30 #include "vtkRenderer.h"
31 #include <vtkPolyDataWriter.h>
32
33 #include "CutModelException.h"
34 #include "CutModelData.h"
35 #include "CutModelSaveBinInfo.h"
36
37
38
39 class CutModelManager  {
40
41 public:
42         CutModelManager(std::string path);
43         ~CutModelManager();
44
45         void setImageData(vtkImageData* img);
46
47         void setInteractor(vtkRenderWindowInteractor* interactor);
48
49         void setRenderer(vtkRenderer* renderer);
50         
51         void onAddCutModel(int id, vtkCommand* observer) throw( CutModelException);
52
53         double* getImageRange()throw( CutModelException);
54
55         void changeOpacity(int id,int opacity)throw( CutModelException);
56
57         void ShowViewBox(int id,bool check)throw( CutModelException);
58
59         void ChangeShape(int id,int selection)throw( CutModelException);
60
61         void changeColor(int id,double r,double g,double b)throw( CutModelException);
62
63         void updateActorDirection(int id)throw( CutModelException);
64
65         void RemoveActor(int id)throw( CutModelException);
66
67         void ExecuteCut(int id, double* range, bool isinside)throw( CutModelException);
68
69         vtkImageData* GetResultImage();
70
71         void RefreshActor(int id);
72
73         void SaveCutModelData(std::string filename)throw( CutModelException);
74
75         void LoadCutModelData(std::string filename)throw( CutModelException);
76
77         CutModelSaveBinInfo* AddActionUndo(int id, UNDOTYPE type)throw( CutModelException);
78
79         int Undo()throw( CutModelException);
80
81         int Redo()throw( CutModelException);
82 private:
83         
84         int _currentaction;
85
86         void checkInvariant() throw( CutModelException);
87         std::string _path;
88         vtkImageData* _img;
89         vtkImageData* _copyimg;
90         vtkRenderer* _render;
91         vtkRenderWindowInteractor* _interactor;
92
93         std::vector<CutModelData*> _vectordata;
94         std::vector<CutModelSaveBinInfo*> _undoredo;
95         CutModelData* getCutModelData(int id)throw( CutModelException);
96         
97 };
98
99 #endif