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 #include "bbmaracasvisuViewerMPR.h"
27 #include "bbcreaMaracasVisuPackage.h"
28 namespace bbcreaMaracasVisu
31 //--------------------------------------------------------------------------
32 //--------------------------------------------------------------------------
33 //--------------------------------------------------------------------------
36 //--------------------------------------------------------------------------
38 //--------------------------------------------------------------------------
39 BEGIN_EVENT_TABLE( wxWidgetMPR, wxPanel )
40 EVT_MENU( 12121, wxWidgetMPR::OnRefreshView )
41 EVT_MENU( 12122, wxWidgetMPR::OnDClickLeft )
47 wxWidgetMPR::wxWidgetMPR(ViewerMPR* box,wxWindow* parent, marImageData *marimagedata)
48 : wxPanel( parent, -1 )
50 wxPanel *panel = this;
54 wxwidget = new wxMPRWidget2( panel, marimagedata , 1 );
56 if(marimagedata != NULL){
57 wxwidget->ConfigureVTK();
59 wxFlexGridSizer *sizer=new wxFlexGridSizer(1);
60 sizer -> Add( wxwidget,0,wxGROW );
61 sizer -> AddGrowableCol(1);
62 panel -> SetSizer(sizer);
63 panel -> SetAutoLayout(true);
67 void wxWidgetMPR::setImageData(vtkImageData* img){
68 wxwidget->setImageData(img, 1);
70 void wxWidgetMPR::ConfigureVTK(){
71 wxwidget->ConfigureVTK();
73 //--------------------------------------------------------------------------
74 wxWidgetMPR::~wxWidgetMPR()
78 //--------------------------------------------------------------------------
82 std::vector<int> wxWidgetMPR::GetPoint()
89 vtkRenderer* wxWidgetMPR::GetRenderer()
93 return wxwidget->GetWxvtkmpr3Dview_BB()->GetWxvtk3Dbaseview()->GetRenderer();
101 //--------------------------------------------------------------------------
102 void wxWidgetMPR::Refresh()
104 wxwidget->RefreshView();
107 //--------------------------------------------------------------------------
111 void wxWidgetMPR::OnRefreshView(wxCommandEvent &event)
113 printf("EED wxWidgetMPR::OnRefreshView 01\n");
114 if((wxwidget!=NULL) && (mbbViewerMPR!=NULL))
116 printf("EED wxWidgetMPR::OnRefreshView 02\n");
118 point.push_back((int)wxwidget->GetVtkMPRBaseData()->GetX());
119 point.push_back((int)wxwidget->GetVtkMPRBaseData()->GetY());
120 point.push_back((int)wxwidget->GetVtkMPRBaseData()->GetZ());
121 mbbViewerMPR->bbSetOutputPoint( GetPoint() );
122 mbbViewerMPR->bbSignalOutputModification(std::string("Point"));
123 wxwidget->RefreshView();
127 //--------------------------------------------------------------------------
128 void wxWidgetMPR::OnDClickLeft(wxCommandEvent & event)
130 wxwidget->RefreshView();
133 //--------------------------------------------------------------------------
134 //--------------------------------------------------------------------------
135 //--------------------------------------------------------------------------
144 BBTK_ADD_BLACK_BOX_TO_PACKAGE(creaMaracasVisu,ViewerMPR)
145 BBTK_BLACK_BOX_IMPLEMENTATION(ViewerMPR,bbtk::WxBlackBox);
146 void ViewerMPR::Process()
150 vtkImageData* img = bbGetInputIn();
151 if(img!=NULL && img != _img){
153 wxwidget->setImageData(_img);
154 wxwidget->ConfigureVTK();
156 // wxwidget->wxPanel::Refresh();
163 bbSetOutputPoint( wxwidget->GetPoint() );
164 bbSetOutputRenderer( wxwidget->GetRenderer() );
168 void ViewerMPR::CreateWidget(wxWindow* parent)
170 bbtkDebugMessageInc("Core",9,"ViewerMPR::CreateWidget() " <<std::endl);
171 //JCP 10 - 03 - 09 marImageData *marimagedata = new marImageData(bbGetInputIn() );
172 bbtkDebugDecTab("Core",9);
173 wxwidget = new wxWidgetMPR(this , parent);//JCP 10 - 03 - 09,marimagedata);
174 bbSetOutputWidget( wxwidget );
177 void ViewerMPR::bbUserSetDefaultValues()
185 //-----------------------------------------------------------------
186 void ViewerMPR::bbUserInitializeProcessing()
190 //-----------------------------------------------------------------
191 void ViewerMPR::bbUserFinalizeProcessing()
195 //-----------------------------------------------------------------
198 // EO namespace bbcreaMaracasVisu