CutModelManager.h
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021 #ifndef __CutModelManagerH__
00022 #define __CutModelManagerH__
00023
00024 #include <iostream>
00025 #include <stdio.h>
00026 #include <vector>
00027
00028 #include "vtkImageData.h"
00029 #include "vtkRenderWindowInteractor.h"
00030 #include "vtkRenderer.h"
00031 #include "wxVtkBaseView.h"
00032 #include "wxVtk3DBaseView.h"
00033 #include <vtkPolyDataWriter.h>
00034
00035 #include "CutModelException.h"
00036 #include "CutModelData.h"
00037 #include "CutModelSaveBinInfo.h"
00038
00039 #include "vtkPoints.h"
00040 #include "CutModelPolygon.h"
00041 #include "vtkInteractorStyleTrackballCamera.h"
00042 #include "vtkInteractorStyleCutter.h"
00043 #include "wxVTKRenderWindowInteractor.h"
00044 #include "vtkImplicitSelectionLoop.h"
00045 #include "vtkPolyDataMapper.h"
00046 #include "vtkSampleFunction.h"
00047 #include "vtkContourFilter.h"
00048 #include "vtkPolyData.h"
00049 #include "vtkActor.h"
00050
00051
00052
00053 class CutModelManager {
00054
00055 public:
00056 CutModelManager(std::string path);
00057 ~CutModelManager();
00058
00059 void setImageData(vtkImageData* img);
00060
00061 vtkImageData* getImageData();
00062
00063 void setInteractor(vtkRenderWindowInteractor* interactor);
00064
00065 void setRenderer(vtkRenderer* renderer);
00066
00067 void setBaseView(wxVtkBaseView* baseView);
00068
00069 void onAddCutModel(int id, vtkCommand* observer) throw( CutModelException);
00070
00071 double* getImageRange()throw( CutModelException);
00072
00073 void changeOpacity(int id,int opacity)throw( CutModelException);
00074
00075 void ShowViewBox(int id,bool check)throw( CutModelException);
00076
00077 void ChangeShape(int id,int selection)throw( CutModelException);
00078
00079 void changeColor(int id,double r,double g,double b)throw( CutModelException);
00080
00081 void updateActorDirection(int id)throw( CutModelException);
00082
00083 void RemoveActor(int id)throw( CutModelException);
00084
00085 void ExecuteCut(int id, double* range, bool isinside)throw( CutModelException);
00086
00087 vtkImageData* GetResultImage();
00088
00089 void RefreshActor(int id);
00090
00091 void SaveCutModelData(std::string filename)throw( CutModelException);
00092
00093 void LoadCutModelData(std::string filename)throw( CutModelException);
00094
00095 CutModelSaveBinInfo* AddActionUndo(int id, UNDOTYPE type)throw( CutModelException);
00096
00097 int Undo()throw( CutModelException);
00098
00099 int Redo()throw( CutModelException);
00100
00101 void ParallelProjectionOn();
00102
00103 void ParallelProjectionOff();
00104
00105 void UpdatePolygon(bool mode);
00106
00107 void ExecuteCutPolygon(bool inOutCut);
00108
00109 void InitializePolygonInteractorStyle();
00110
00111 private:
00112
00113 int _currentaction;
00114
00115 void checkInvariant() throw( CutModelException);
00116 std::string _path;
00117 vtkImageData* _img;
00118 vtkImageData* _img2;
00119 vtkRenderer* _render;
00120 vtkRenderWindowInteractor* _interactor;
00121
00122 std::vector<CutModelData*> _vectordata;
00123 std::vector<CutModelSaveBinInfo*> _undoredo;
00124 CutModelData* getCutModelData(int id)throw( CutModelException);
00125
00126 CutModelPolygon* _polygonCutter;
00127 vtkPoints *contourPoints ;
00128 double *contourDirection;
00129 vtkInteractorStyleTrackballCamera *interactorstyle;
00130 vtkInteractorStyleCutter *cutterstyle;
00131 vtkContourFilter *contour;
00132 vtkSampleFunction *sample;
00133 vtkPolyData *actor;
00134 vtkActor *actor3D;
00135 vtkImplicitSelectionLoop *loop;
00136 vtkPolyDataMapper *mapper;
00137
00138 };
00139
00140 #endif