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: CutModelMainPanel.h,v $
31 Date: $Date: 2012/11/15 14:16:20 $
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 =========================================================================*/
43 #ifndef __CutModelMainPanelPanelH__
44 #define __CutModelMainPanelPanelH__
48 #include <wx/treebook.h>
49 #include "wx/aui/aui.h"
50 #include <wx/toolbar.h>
56 #include "CutModelManager.h"
57 #include "CutModelException.h"
58 #include "CutModelView.h"
60 #include "vtkImageData.h"
61 #include "vtkRenderWindowInteractor.h"
63 //RaC 02-2010 Add tabs
64 #include <wx/aui/auibook.h>
66 #include <wx/checkbox.h>
67 #include <wx/button.h>
69 #include <wx/stattext.h>
70 #include <wx/radiobox.h>
74 class creaMaracasVisu_EXPORT CutModelMainPanel : public wxPanel
79 ~CutModelMainPanel( );
81 static CutModelMainPanel* getInstance(wxWindow* parent=NULL, std::string path ="");
83 //static CutModelMainPanel* getInstance();
85 void setImageData(vtkImageData* img);
87 void setInteractor(vtkRenderWindowInteractor* interactor);
89 void setRenderer(vtkRenderer* renderer);
91 void initialize(std::string path);
93 //RaC PolygonCutter changes
94 void onCheckChanged();
95 void onExecuteCutPolygon();
96 void UpdatePolygon(bool isChecked);
105 void changeOpacity(int id,int opacity);
107 void ShowViewBox(int id,bool check);
109 void ChangeShape(int id,int selection);
111 void changeColor(int id,double r,double g,double b);
113 void updateActorDirection(int id);
115 void RemoveActor(int id);
117 void ExecuteCut(int id, double* range, bool isinside);
121 vtkImageData* GetResultImage();
123 void ShowCurrentPanel(int id);
125 void ShowPopUpMenu(int id);
127 void ShowStatistics(int id);
129 void SetType(int type);
136 CutModelMainPanel( wxWindow* parent, std::string path);
138 static CutModelMainPanel* instance;
140 CutModelManager* cutmanager;
142 void checkInvariant() throw( CutModelException);
144 void showErrorDialog(std::string str);
146 void SaveCutModelData(std::string filename);
148 void LoadCutModelData(std::string filename);
150 std::vector<CutModelView*> viewpanels;
152 wxAuiManager* _wxauimanager;
154 int addNewViewPanel()throw( CutModelException);
156 CutModelView* getModelView(int id)throw( CutModelException);
162 //RaC 02-2010 Add tabs
163 wxAuiNotebook* _notebook;
165 //RaC Adds Tab to cut a prism with the polygon as the base
166 void addPolygonCutterTab();
172 wxButton *btnExecutePolygonCut;
173 wxStaticText* lblMessagePolygon;
174 wxRadioBox* _radioinsideout;
179 class ToolBarEventHandlerCutModel : public wxEvtHandler{
182 ToolBarEventHandlerCutModel();
183 ~ToolBarEventHandlerCutModel();
185 void onAdd(wxCommandEvent& event);
187 void onUndo(wxCommandEvent& event);
189 void onRedo(wxCommandEvent& event);
191 void onExecuteAll(wxCommandEvent& event);
195 DECLARE_EVENT_TABLE()
198 class PolygonCutterEventHandlerCutModel : public wxEvtHandler{
201 PolygonCutterEventHandlerCutModel(): wxEvtHandler(){};
202 ~PolygonCutterEventHandlerCutModel(){};
204 void onCheckChanged(wxCommandEvent& event);
205 void onExecuteCutPolygon(wxCommandEvent& event);
210 class ToolBarCutModel : public wxToolBar{
214 ToolBarCutModel(wxWindow * parent);
215 ~ToolBarCutModel(void);
220 ToolBarEventHandlerCutModel* _evthand;