1 /*# ---------------------------------------------------------------------
3 # Copyright (c) CREATIS (Centre de Recherche en Acquisition et Traitement de l'Image
5 # Authors : Eduardo Davila, Frederic Cervenansky, Claire Mouton
6 # Previous Authors : Laurent Guigues, Jean-Pierre Roux
7 # CreaTools website : www.creatis.insa-lyon.fr/site/fr/creatools_accueil
9 # This software is governed by the CeCILL-B license under French law and
10 # abiding by the rules of distribution of free software. You can use,
11 # modify and/ or redistribute the software under the terms of the CeCILL-B
12 # license as circulated by CEA, CNRS and INRIA at the following URL
13 # http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html
14 # or in the file LICENSE.txt.
16 # As a counterpart to the access to the source code and rights to copy,
17 # modify and redistribute granted by the license, users are provided only
18 # with a limited warranty and the software's author, the holder of the
19 # economic rights, and the successive licensors have only limited
22 # The fact that you are presently reading this means that you have had
23 # knowledge of the CeCILL-B license and that you accept its terms.
24 # ------------------------------------------------------------------------ */
26 /*=========================================================================
29 Module: $RCSfile: CutModelManager.h,v $
31 Date: $Date: 2012/11/15 14:15:49 $
32 Version: $Revision: 1.6 $
34 Copyright: (c) 2002, 2003
37 This software is distributed WITHOUT ANY WARRANTY; without even
38 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
39 PURPOSE. See the above copyright notice for more information.
41 =========================================================================*/
46 #ifndef __CutModelManagerH__
47 #define __CutModelManagerH__
53 #include "vtkImageData.h"
54 #include "vtkRenderWindowInteractor.h"
55 #include "vtkRenderer.h"
56 #include "wxVtkBaseView.h"
57 #include "wxVtk3DBaseView.h"
58 #include <vtkPolyDataWriter.h>
60 #include "CutModelException.h"
61 #include "CutModelData.h"
62 #include "CutModelSaveBinInfo.h"
64 #include "vtkPoints.h"
65 #include "CutModelPolygon.h"
66 #include "vtkInteractorStyleTrackballCamera.h"
67 #include "vtkInteractorStyleCutter.h"
68 #include "wxVTKRenderWindowInteractor.h"
69 #include "vtkImplicitSelectionLoop.h"
70 #include "vtkPolyDataMapper.h"
71 #include "vtkSampleFunction.h"
72 #include "vtkContourFilter.h"
73 #include "vtkPolyData.h"
78 class CutModelManager {
81 CutModelManager(std::string path);
84 void setImageData(vtkImageData* img);
86 vtkImageData* getImageData();
88 void setInteractor(vtkRenderWindowInteractor* interactor);
90 void setRenderer(vtkRenderer* renderer);
92 void setBaseView(wxVtkBaseView* baseView);
94 void onAddCutModel(int id, vtkCommand* observer) throw( CutModelException);
96 double* getImageRange()throw( CutModelException);
98 void changeOpacity(int id,int opacity)throw( CutModelException);
100 void ShowViewBox(int id,bool check)throw( CutModelException);
102 void ChangeShape(int id,int selection)throw( CutModelException);
104 void changeColor(int id,double r,double g,double b)throw( CutModelException);
106 void updateActorDirection(int id)throw( CutModelException);
108 void RemoveActor(int id)throw( CutModelException);
110 void ExecuteCut(int id, double* range, bool isinside)throw( CutModelException);
112 vtkImageData* GetResultImage();
114 void RefreshActor(int id);
116 void SaveCutModelData(std::string filename)throw( CutModelException);
118 void LoadCutModelData(std::string filename)throw( CutModelException);
120 CutModelSaveBinInfo* AddActionUndo(int id, UNDOTYPE type)throw( CutModelException);
122 int Undo()throw( CutModelException);
124 int Redo()throw( CutModelException);
126 void ParallelProjectionOn();
128 void ParallelProjectionOff();
130 void UpdatePolygon(bool mode);
132 void ExecuteCutPolygon(bool inOutCut);
134 void InitializePolygonInteractorStyle();
140 void checkInvariant() throw( CutModelException);
144 vtkRenderer* _render;
145 vtkRenderWindowInteractor* _interactor;
147 std::vector<CutModelData*> _vectordata;
148 std::vector<CutModelSaveBinInfo*> _undoredo;
149 CutModelData* getCutModelData(int id)throw( CutModelException);
151 CutModelPolygon* _polygonCutter;
152 vtkPoints *contourPoints ;
153 double *contourDirection;
154 vtkInteractorStyleTrackballCamera *interactorstyle;
155 vtkInteractorStyleCutter *cutterstyle;
156 vtkContourFilter *contour;
157 vtkSampleFunction *sample;
160 vtkImplicitSelectionLoop *loop;
161 vtkPolyDataMapper *mapper;