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 );
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)
69 wxwidget->setImageData(img);
72 void wxWidgetMPR::ConfigureVTK()
74 wxwidget->ConfigureVTK();
77 //--------------------------------------------------------------------------
78 wxWidgetMPR::~wxWidgetMPR()
82 //--------------------------------------------------------------------------
86 std::vector<int> wxWidgetMPR::GetPoint()
93 vtkRenderer* wxWidgetMPR::GetRenderer()
97 return wxwidget->GetWxvtkmpr3Dview_BB()->GetWxvtk3Dbaseview()->GetRenderer();
105 //--------------------------------------------------------------------------
106 void wxWidgetMPR::Refresh()
108 wxwidget->RefreshView();
111 //--------------------------------------------------------------------------
115 void wxWidgetMPR::OnRefreshView(wxCommandEvent &event)
117 printf("EED wxWidgetMPR::OnRefreshView 01\n");
118 if((wxwidget!=NULL) && (mbbViewerMPR!=NULL))
120 printf("EED wxWidgetMPR::OnRefreshView 02\n");
122 point.push_back((int)wxwidget->GetVtkMPRBaseData()->GetX());
123 point.push_back((int)wxwidget->GetVtkMPRBaseData()->GetY());
124 point.push_back((int)wxwidget->GetVtkMPRBaseData()->GetZ());
125 mbbViewerMPR->bbSetOutputPoint( GetPoint() );
126 mbbViewerMPR->bbSignalOutputModification(std::string("Point"));
127 wxwidget->RefreshView();
131 //--------------------------------------------------------------------------
132 void wxWidgetMPR::OnDClickLeft(wxCommandEvent & event)
134 wxwidget->RefreshView();
137 //--------------------------------------------------------------------------
138 //--------------------------------------------------------------------------
139 //--------------------------------------------------------------------------
148 BBTK_ADD_BLACK_BOX_TO_PACKAGE(creaMaracasVisu,ViewerMPR)
149 BBTK_BLACK_BOX_IMPLEMENTATION(ViewerMPR,bbtk::WxBlackBox);
150 void ViewerMPR::Process()
154 vtkImageData* img = bbGetInputIn();
155 if(img!=NULL && img != _img){
157 wxwidget->setImageData(_img);
158 wxwidget->ConfigureVTK();
160 // wxwidget->wxPanel::Refresh();
167 bbSetOutputPoint( wxwidget->GetPoint() );
168 bbSetOutputRenderer( wxwidget->GetRenderer() );
172 void ViewerMPR::CreateWidget(wxWindow* parent)
174 bbtkDebugMessageInc("Core",9,"ViewerMPR::CreateWidget() " <<std::endl);
175 //JCP 10 - 03 - 09 marImageData *marimagedata = new marImageData(bbGetInputIn() );
176 bbtkDebugDecTab("Core",9);
177 wxwidget = new wxWidgetMPR(this , parent);//JCP 10 - 03 - 09,marimagedata);
178 bbSetOutputWidget( wxwidget );
181 void ViewerMPR::bbUserSetDefaultValues()
189 //-----------------------------------------------------------------
190 void ViewerMPR::bbUserInitializeProcessing()
194 //-----------------------------------------------------------------
195 void ViewerMPR::bbUserFinalizeProcessing()
199 //-----------------------------------------------------------------
202 // EO namespace bbcreaMaracasVisu