]> Creatis software - creaMaracasVisu.git/blob - lib/maracasVisuLib/src/CutModule/kernel/CutModelManager.h
abc8d3e95686142707cf1d225f6da9b39aa95075
[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: 2010/02/24 13:56:08 $
7 Version:   $Revision: 1.5 $
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 "wxVtkBaseView.h"
32 #include "wxVtk3DBaseView.h"
33 #include <vtkPolyDataWriter.h>
34
35 #include "CutModelException.h"
36 #include "CutModelData.h"
37 #include "CutModelSaveBinInfo.h"
38
39 #include "vtkPoints.h"
40 #include "CutModelPolygon.h"
41 #include "vtkInteractorStyleTrackballCamera.h"
42 #include "vtkInteractorStyleCutter.h"
43 #include "wxVTKRenderWindowInteractor.h"
44 #include "vtkImplicitSelectionLoop.h"
45 #include "vtkPolyDataMapper.h"
46 #include "vtkSampleFunction.h"
47 #include "vtkContourFilter.h"
48 #include "vtkPolyData.h"
49 #include "vtkActor.h"
50
51
52
53 class CutModelManager  {
54
55 public:
56         CutModelManager(std::string path);
57         ~CutModelManager();
58
59         void setImageData(vtkImageData* img);
60
61         vtkImageData* getImageData();
62
63         void setInteractor(vtkRenderWindowInteractor* interactor);
64
65         void setRenderer(vtkRenderer* renderer);
66
67         void setBaseView(wxVtkBaseView* baseView);
68
69         void onAddCutModel(int id, vtkCommand* observer) throw( CutModelException);
70
71         double* getImageRange()throw( CutModelException);
72
73         void changeOpacity(int id,int opacity)throw( CutModelException);
74
75         void ShowViewBox(int id,bool check)throw( CutModelException);
76
77         void ChangeShape(int id,int selection)throw( CutModelException);
78
79         void changeColor(int id,double r,double g,double b)throw( CutModelException);
80
81         void updateActorDirection(int id)throw( CutModelException);
82
83         void RemoveActor(int id)throw( CutModelException);
84
85         void ExecuteCut(int id, double* range, bool isinside)throw( CutModelException);
86
87         vtkImageData* GetResultImage();
88
89         void RefreshActor(int id);
90
91         void SaveCutModelData(std::string filename)throw( CutModelException);
92
93         void LoadCutModelData(std::string filename)throw( CutModelException);
94
95         CutModelSaveBinInfo* AddActionUndo(int id, UNDOTYPE type)throw( CutModelException);
96
97         int Undo()throw( CutModelException);
98
99         int Redo()throw( CutModelException);
100
101         void ParallelProjectionOn();
102
103         void ParallelProjectionOff();
104
105         void UpdatePolygon(bool mode);
106
107         void ExecuteCutPolygon(bool inOutCut);
108
109         void InitializePolygonInteractorStyle();
110
111 private:
112
113         int _currentaction;
114
115         void checkInvariant() throw( CutModelException);
116         std::string _path;
117         vtkImageData* _img;
118         vtkImageData* _img2;
119         vtkRenderer* _render;
120         vtkRenderWindowInteractor* _interactor;
121
122         std::vector<CutModelData*> _vectordata;
123         std::vector<CutModelSaveBinInfo*> _undoredo;
124         CutModelData* getCutModelData(int id)throw( CutModelException);
125
126         CutModelPolygon* _polygonCutter;
127         vtkPoints *contourPoints ;
128         double *contourDirection;       
129         vtkInteractorStyleTrackballCamera *interactorstyle;
130         vtkInteractorStyleCutter *cutterstyle;
131         vtkContourFilter *contour;
132         vtkSampleFunction *sample;
133         vtkPolyData *actor;
134         vtkActor *actor3D;
135         vtkImplicitSelectionLoop *loop;
136         vtkPolyDataMapper *mapper;
137
138 };
139
140 #endif