1 /*=========================================================================
4 Module: $RCSfile: CutModelManager.h,v $
6 Date: $Date: 2010/02/24 13:56:08 $
7 Version: $Revision: 1.5 $
9 Copyright: (c) 2002, 2003
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.
16 =========================================================================*/
21 #ifndef __CutModelManagerH__
22 #define __CutModelManagerH__
28 #include "vtkImageData.h"
29 #include "vtkRenderWindowInteractor.h"
30 #include "vtkRenderer.h"
31 #include "wxVtkBaseView.h"
32 #include "wxVtk3DBaseView.h"
33 #include <vtkPolyDataWriter.h>
35 #include "CutModelException.h"
36 #include "CutModelData.h"
37 #include "CutModelSaveBinInfo.h"
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"
53 class CutModelManager {
56 CutModelManager(std::string path);
59 void setImageData(vtkImageData* img);
61 vtkImageData* getImageData();
63 void setInteractor(vtkRenderWindowInteractor* interactor);
65 void setRenderer(vtkRenderer* renderer);
67 void setBaseView(wxVtkBaseView* baseView);
69 void onAddCutModel(int id, vtkCommand* observer) throw( CutModelException);
71 double* getImageRange()throw( CutModelException);
73 void changeOpacity(int id,int opacity)throw( CutModelException);
75 void ShowViewBox(int id,bool check)throw( CutModelException);
77 void ChangeShape(int id,int selection)throw( CutModelException);
79 void changeColor(int id,double r,double g,double b)throw( CutModelException);
81 void updateActorDirection(int id)throw( CutModelException);
83 void RemoveActor(int id)throw( CutModelException);
85 void ExecuteCut(int id, double* range, bool isinside)throw( CutModelException);
87 vtkImageData* GetResultImage();
89 void RefreshActor(int id);
91 void SaveCutModelData(std::string filename)throw( CutModelException);
93 void LoadCutModelData(std::string filename)throw( CutModelException);
95 CutModelSaveBinInfo* AddActionUndo(int id, UNDOTYPE type)throw( CutModelException);
97 int Undo()throw( CutModelException);
99 int Redo()throw( CutModelException);
101 void ParallelProjectionOn();
103 void ParallelProjectionOff();
105 void UpdatePolygon(bool mode);
107 void ExecuteCutPolygon(bool inOutCut);
109 void InitializePolygonInteractorStyle();
115 void checkInvariant() throw( CutModelException);
119 vtkRenderer* _render;
120 vtkRenderWindowInteractor* _interactor;
122 std::vector<CutModelData*> _vectordata;
123 std::vector<CutModelSaveBinInfo*> _undoredo;
124 CutModelData* getCutModelData(int id)throw( CutModelException);
126 CutModelPolygon* _polygonCutter;
127 vtkPoints *contourPoints ;
128 double *contourDirection;
129 vtkInteractorStyleTrackballCamera *interactorstyle;
130 vtkInteractorStyleCutter *cutterstyle;
131 vtkContourFilter *contour;
132 vtkSampleFunction *sample;
135 vtkImplicitSelectionLoop *loop;
136 vtkPolyDataMapper *mapper;