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 # ------------------------------------------------------------------------ */
27 #include <wx/tooltip.h>
28 #include <wx/config.h>
30 #include <iostream> // for std::cout
33 #include "wxPanelCuttingImageData.h"
35 //-------------------------------------------------------------------
37 #include <vtkProperty.h>
38 #include <vtkTextProperty.h>
39 #include <vtkProperty2D.h>
40 //-------------------------------------------------------------------
41 //-------------------------------------------------------------------
43 wxPanelCuttingImageData::wxPanelCuttingImageData (wxWindow *parent)
44 : wxPanel( parent, -1)
47 _histogrammeVector = NULL;
48 _wxvtk3Dbaseview = NULL;
49 _wxvtkbaseView = NULL;
52 Create3DViewObjects();
55 //-------------------------------------------------------------------
56 wxPanelCuttingImageData::~wxPanelCuttingImageData()
62 delete _modelCylinder;
64 _vtksphere -> Delete();
65 _vtkcylinder -> Delete();
66 _cubeMapper -> Delete();
67 _sphereMapper -> Delete();
68 _cylinderMapper -> Delete();
69 _cubeActor -> Delete();
70 _sphereActor -> Delete();
71 _cylinderActor -> Delete();
72 // _xyplot->RemoveAllInputs();
74 _histogrammeVector->Delete();
75 _renplotter->Delete();
77 if(_wxvtkbaseView!=NULL){
78 delete _wxvtkbaseView;
80 //delete _vtkclipping3Ddataviewer;
87 //-------------------------------------------------------------------
88 void wxPanelCuttingImageData::RemoveActors()
90 _wxvtk3Dbaseview->GetRenderer()->RemoveActor( _actualActor );
94 //-------------------------------------------------------------------
95 void wxPanelCuttingImageData::SetWxVtk3DBaseView( wxVtk3DBaseView * wxvtk3Dbaseview )
97 _wxvtk3Dbaseview=wxvtk3Dbaseview;
100 //-------------------------------------------------------------------
102 void wxPanelCuttingImageData::SetVtkClipping3DDataViewer( vtkClipping3DDataViewer *vtkclipping3Ddataviewer )
104 this->_vtkclipping3Ddataviewer = vtkclipping3Ddataviewer;
107 //-------------------------------------------------------------------
108 void wxPanelCuttingImageData::Create3DViewObjects()
111 _vtksphere = vtkSphereSource::New();
112 _vtksphere->SetThetaResolution (20);
113 _vtksphere->SetPhiResolution (20);
114 _sphereMapper = vtkPolyDataMapper::New();
115 //EED 2017-01-01 Migration VTK7
116 #if VTK_MAJOR_VERSION <= 5
117 _sphereMapper->SetInput( _vtksphere->GetOutput() );
119 _sphereMapper->SetInputData( _vtksphere->GetOutput() );
121 _sphereActor = vtkActor::New();
122 _sphereActor->SetMapper(_sphereMapper);
123 _sphereActor->SetOrigin(0, 0, 0);
124 _sphereActor->SetPosition(0, 0, 0);
125 _sphereActor->GetProperty()->SetColor(1, 0, 0);
126 _sphereActor->SetUserTransform( _modelSphere->GetVtkTransform() );
129 _vtkcube = vtkCubeSource::New();
130 _vtkcube->SetXLength (1);
131 _vtkcube->SetYLength (1);
132 _vtkcube->SetZLength (1);
133 _cubeMapper = vtkPolyDataMapper::New();
134 //EED 2017-01-01 Migration VTK7
135 #if VTK_MAJOR_VERSION <= 5
136 _cubeMapper->SetInput( _vtkcube->GetOutput() );
138 _cubeMapper->SetInputData( _vtkcube->GetOutput() );
140 _cubeActor = vtkActor::New();
141 _cubeActor->SetMapper(_cubeMapper);
142 _cubeActor->SetOrigin(0, 0, 0);
143 _cubeActor->SetPosition(0, 0, 0);
144 _cubeActor->GetProperty()->SetColor(1, 0, 0);
145 _cubeActor->SetUserTransform( _modelCube->GetVtkTransform() );
148 _vtkcylinder = vtkCylinderSource::New();
149 _vtkcylinder->SetResolution(20);
150 _cylinderMapper = vtkPolyDataMapper::New();
152 //EED 2017-01-01 Migration VTK7
153 #if VTK_MAJOR_VERSION <= 5
154 _cylinderMapper->SetInput( _vtkcylinder->GetOutput() );
156 _cylinderMapper->SetInputData( _vtkcylinder->GetOutput() );
159 _cylinderActor = vtkActor::New();
160 _cylinderActor->SetMapper(_cylinderMapper);
161 _cylinderActor->SetOrigin(0, 0, 0);
162 _cylinderActor->SetPosition(0, 0, 0);
163 _cylinderActor->GetProperty()->SetColor(1, 0, 0);
164 _cylinderActor->SetUserTransform( _modelCylinder->GetVtkTransform() );
169 //-------------------------------------------------------------------
170 void wxPanelCuttingImageData::CreateModel()
172 _modelCube = new figureCuttingCubeModel();
173 _modelSphere = new figureCuttingSphereModel();
174 _modelCylinder = new figureCuttingCylinderModel();
176 // _modelCube->SetVtkTransform( _modelCube->GetVtkTransform() );
177 // _modelSphere->SetVtkTransform( _modelSphere->GetVtkTransform() );
178 // _modelCylinder->SetVtkTransform( _modelCylinder->GetVtkTransform() );
181 //-------------------------------------------------------------------
183 void wxPanelCuttingImageData::InitHistogramme()
186 if (_imageData==NULL)
190 _imageData->GetScalarRange(rangeA);
192 //EED 2017-01-01 Migration VTK7
193 #if VTK_MAJOR_VERSION <= 5
194 _xyplot->RemoveAllInputs();
196 _xyplot->RemoveAllDataSetInputConnections();
199 if ( _histogrammeVector!=NULL )
201 _histogrammeVector -> Delete();
204 _histogrammeVector = vtkImageData::New();
205 _histogrammeVector -> SetDimensions ( (int)(rangeA[1]),1,1 );
206 //EED 2017-01-01 Migration VTK7
207 #if VTK_MAJOR_VERSION <= 5
208 _histogrammeVector -> SetScalarTypeToUnsignedShort();
209 _histogrammeVector -> AllocateScalars();
210 _histogrammeVector -> Update();
212 _histogrammeVector -> AllocateScalars(VTK_UNSIGNED_SHORT,1);
215 unsigned short *p_vol = (unsigned short*)_histogrammeVector->GetScalarPointer(0,0,0);
216 int i,size = (int) (rangeA[1]);
217 for (i=0; i < size; i++)
222 _xyplot->SetXRange(0, rangeA[1]);
223 _xyplot->SetYRange(0, 10);
226 //EED 2017-01-01 Migration VTK7
227 #if VTK_MAJOR_VERSION <= 5
228 _xyplot->AddInput( _histogrammeVector );
230 _xyplot->AddDataSetInput( _histogrammeVector );
235 //-------------------------------------------------------------------
236 wxWindow *wxPanelCuttingImageData::CreatePlotHistogrammeInterface()
238 _xyplot = vtkXYPlotActor::New();
240 _xyplot->GetPositionCoordinate()->SetValue(0.00, 0.00, 0);
241 _xyplot->GetPosition2Coordinate()->SetValue(1.0, 1.00, 0); //relative to Position
242 _xyplot->SetXValuesToArcLength();
243 _xyplot->SetNumberOfXLabels(6);
245 _xyplot->SetTitle("Histogramme");
246 _xyplot->SetXTitle("Gray level");
247 _xyplot->SetYTitle("Occurrences ");
248 _xyplot->GetProperty()->SetColor(1, 0, 0);
249 _xyplot->GetProperty()->SetPointSize(2);
250 vtkTextProperty *tprop = _xyplot->GetTitleTextProperty();
251 tprop->SetColor( 1,0,1 );
253 _xyplot->SetAxisTitleTextProperty(tprop);
254 _xyplot->SetAxisLabelTextProperty(tprop);
255 _xyplot->PlotPointsOn();
256 _xyplot->GetProperty()->SetPointSize(3);
258 _wxvtkbaseView = new wxVtkBaseView(this);
259 _wxvtkbaseView->Configure();
261 _renplotter = vtkRenderer::New();
262 vtkRenderWindow *renWin = _wxvtkbaseView->GetRenWin();
263 renWin->AddRenderer( _renplotter );
264 _renplotter->AddActor2D( _xyplot );
266 return _wxvtkbaseView->GetWxVTKRenderWindowInteractor();
269 //-------------------------------------------------------------------
271 void wxPanelCuttingImageData::CreateInterface()
274 wxBoxSizer *topsizer = new wxBoxSizer(wxVERTICAL); // Principal sizer
276 wxBoxSizer *sizerH0 = new wxBoxSizer(wxHORIZONTAL ); // type of segmentation figure
277 wxBoxSizer *sizerH2 = new wxBoxSizer(wxHORIZONTAL ); // scale
278 wxBoxSizer *sizerH3 = new wxBoxSizer(wxHORIZONTAL ); // rotation
279 wxBoxSizer *sizerH4 = new wxBoxSizer(wxHORIZONTAL ); // intern extern
280 wxBoxSizer *sizerH5 = new wxBoxSizer(wxHORIZONTAL ); // Isovalue
281 wxBoxSizer *sizerH6 = new wxBoxSizer(wxHORIZONTAL ); // Buttons
282 wxFlexGridSizer *sizerH7 = new wxFlexGridSizer(2 ); // Volumic information
285 _typeFig = new wxChoice(this,-1);
286 _opacityFig = new wxSlider(this,-1,100,0,100, wxDefaultPosition, wxDefaultSize, wxSL_HORIZONTAL | wxSL_LABELS);
288 _scaleX = new wxSlider(this,-1,6,0,500 , wxDefaultPosition, wxDefaultSize, wxSL_HORIZONTAL | wxSL_LABELS);
289 _scaleY = new wxSlider(this,-1,20,0,500 , wxDefaultPosition, wxDefaultSize, wxSL_HORIZONTAL | wxSL_LABELS);
290 _scaleZ = new wxSlider(this,-1,7,0,500 , wxDefaultPosition, wxDefaultSize, wxSL_HORIZONTAL | wxSL_LABELS);
292 _rotationX = new wxSlider(this,-1,0,-360,360, wxDefaultPosition, wxDefaultSize, wxSL_HORIZONTAL | wxSL_LABELS);
293 _rotationY = new wxSlider(this,-1,0,-360,360, wxDefaultPosition, wxDefaultSize, wxSL_HORIZONTAL | wxSL_LABELS);
294 _rotationZ = new wxSlider(this,-1,0,-360,360, wxDefaultPosition, wxDefaultSize, wxSL_HORIZONTAL | wxSL_LABELS);
296 _volIntern = new wxRadioButton(this,-1, _T("Volume intern " ));
297 _volExtern = new wxRadioButton(this,-1, _T("Volume extern " ));
299 _histogrammeAccumulated = new wxCheckBox(this,-1,_T("Histogramme accumulated"));
301 _isoValue = new wxSlider(this,-1, 200, 0,2000, wxDefaultPosition,wxDefaultSize, wxSL_HORIZONTAL | wxSL_LABELS);
302 _valueBeforeIsoValue = new wxSlider(this,-1,-1,-1,2000, wxDefaultPosition, wxDefaultSize, wxSL_HORIZONTAL | wxSL_LABELS);
303 _valueAfterIsoValue = new wxSlider(this,-1,-1,-1,2000, wxDefaultPosition, wxDefaultSize, wxSL_HORIZONTAL | wxSL_LABELS);
305 wxButton *btnExtract = new wxButton(this, -1,_T("Extract"));
307 _infoToVo = new wxStaticText(this,-1,_T("########################"));
308 _infoSuVoA = new wxStaticText(this,-1,_T("############"));
309 _infoSuVo = new wxStaticText(this,-1,_T("############"));
310 _infoPixLe = new wxStaticText(this,-1,_T("############"));
311 _infoPixHi = new wxStaticText(this,-1,_T("############"));
316 _typeFig->Append(_T("Cylindre"));
317 _typeFig->Append(_T("Cube"));
318 _typeFig->Append(_T("Sphere"));
319 _typeFig->SetSelection(0);
320 _volIntern->SetValue(true);
322 Connect(_typeFig->GetId() , wxEVT_COMMAND_CHOICE_SELECTED , (wxObjectEventFunction) &wxPanelCuttingImageData::OnTypeFig );
324 Connect(_opacityFig->GetId() , wxEVT_COMMAND_SLIDER_UPDATED , (wxObjectEventFunction) &wxPanelCuttingImageData::OnOpacityFig );
325 Connect(_rotationX->GetId() , wxEVT_COMMAND_SLIDER_UPDATED , (wxObjectEventFunction) &wxPanelCuttingImageData::OnTransform );
326 Connect(_rotationY->GetId() , wxEVT_COMMAND_SLIDER_UPDATED , (wxObjectEventFunction) &wxPanelCuttingImageData::OnTransform );
327 Connect(_rotationZ->GetId() , wxEVT_COMMAND_SLIDER_UPDATED , (wxObjectEventFunction) &wxPanelCuttingImageData::OnTransform );
328 Connect(_scaleX->GetId() , wxEVT_COMMAND_SLIDER_UPDATED , (wxObjectEventFunction) &wxPanelCuttingImageData::OnTransform );
329 Connect(_scaleY->GetId() , wxEVT_COMMAND_SLIDER_UPDATED , (wxObjectEventFunction) &wxPanelCuttingImageData::OnTransform );
330 Connect(_scaleZ->GetId() , wxEVT_COMMAND_SLIDER_UPDATED , (wxObjectEventFunction) &wxPanelCuttingImageData::OnTransform );
331 Connect(btnExtract->GetId() , wxEVT_COMMAND_BUTTON_CLICKED , (wxObjectEventFunction) &wxPanelCuttingImageData::OnExtract );
334 // wxStaticText *text=new wxStaticText(this,-1, " ");
336 sizerH0 -> Add( new wxStaticText(this,-1, _T("Fig. Type: "),wxDefaultPosition, wxSize(50,20)) ,1,wxALL ,0);
337 sizerH0 -> Add( _typeFig ,1,wxALL ,0);
338 sizerH0 -> Add( _opacityFig ,1,wxALL|wxEXPAND ,0);
340 sizerH2 -> Add( new wxStaticText(this,-1,_T("Scale : ")) ,1,wxALL ,0);
341 sizerH2 -> Add( _scaleX ,1,wxALL | wxEXPAND ,0 );
342 sizerH2 -> Add( _scaleY ,1,wxALL | wxEXPAND ,0 );
343 sizerH2 -> Add( _scaleZ ,1,wxALL | wxEXPAND ,0 );
345 sizerH3 -> Add( new wxStaticText(this,-1,_T("Rotation : ")) ,1,wxALL ,0);
346 sizerH3 -> Add( _rotationX ,1,wxALL | wxEXPAND ,0 );
347 sizerH3 -> Add( _rotationY ,1,wxALL | wxEXPAND ,0 );
348 sizerH3 -> Add( _rotationZ ,1,wxALL | wxEXPAND ,0 );
351 sizerH4 -> Add( new wxStaticText(this,-1,_T("Intern / Extern : ")) ,1,wxALL ,0);
352 sizerH4 -> Add( _volIntern ,1,wxALL ,0);
353 sizerH4 -> Add( new wxStaticText(this,-1, _T(" ")) ,1,wxALL ,0);
354 sizerH4 -> Add( _volExtern ,1,wxALL ,0);
356 sizerH5 -> Add( new wxStaticText(this,-1,_T("Isovalue ")) ,1,wxALL ,0);
357 sizerH5 -> Add( _isoValue ,1,wxALL | wxEXPAND ,0 );
358 sizerH5 -> Add( _valueBeforeIsoValue ,1,wxALL | wxEXPAND ,0 );
359 sizerH5 -> Add( _valueAfterIsoValue ,1,wxALL | wxEXPAND ,0 );
361 sizerH6 -> Add( new wxStaticText(this,-1, _T(" ")) ,1,wxALL ,0);
362 sizerH6 -> Add( btnExtract ,1,wxALL ,0);
364 sizerH7 -> Add( new wxStaticText(this,-1,_T("Total Volume: "), wxDefaultPosition, wxSize(200,12)) , 1 , wxALL ,0);
365 sizerH7 -> Add( _infoToVo , 1 , wxALL ,0);
366 sizerH7 -> Add( new wxStaticText(this,-1,_T("SubVolume: "), wxDefaultPosition, wxSize(200,12) ) , 1 , wxALL ,0);
367 sizerH7 -> Add( _infoSuVo , 1 , wxALL ,0);
368 sizerH7 -> Add( new wxStaticText(this,-1,_T("SubVolume (ana.): "), wxDefaultPosition, wxSize(200,12)) , 1 , wxALL ,0);
369 sizerH7 -> Add( _infoSuVoA , 1 , wxALL ,0);
370 sizerH7 -> Add( new wxStaticText(this,-1,_T("Pix < isovalue: ") , wxDefaultPosition, wxSize(200,12)) , 1 , wxALL ,0);
371 sizerH7 -> Add( _infoPixLe , 1 , wxALL ,0);
372 sizerH7 -> Add( new wxStaticText(this,-1,_T("Pix > isovalue: "), wxDefaultPosition, wxSize(200,12)) , 1 , wxALL ,0);
373 sizerH7 -> Add( _infoPixHi , 1 , wxALL ,0);
374 // sizerH7 -> SetMinSize(300, 120);
377 topsizer -> Add( sizerH0 ,1,wxALL|wxEXPAND ,0);
380 topsizer -> Add( sizerH2 ,1,wxALL|wxEXPAND ,0);
383 topsizer -> Add( sizerH3 ,1,wxALL|wxEXPAND ,0);
386 topsizer -> Add( sizerH4 ,1,wxALL ,0);
390 topsizer -> Add( sizerH5 ,1,wxALL |wxEXPAND ,0);
393 topsizer -> Add( sizerH6 , 1 , wxALL ,0);
396 topsizer -> Add( _histogrammeAccumulated ,1, wxALL ,0);
398 // Volumic information
399 topsizer -> Add( sizerH7 , 1 , wxALL|wxEXPAND ,0);
403 // wxBoxSizer *sizerHor = new wxBoxSizer(wxHORIZONTAL);
404 wxBoxSizer *sizerHor = new wxBoxSizer(wxVERTICAL);
405 sizerHor -> Add( topsizer , 1 , wxALL | wxEXPAND ,0);
408 wxWindow *panelPlotHistogramme = CreatePlotHistogrammeInterface();
409 sizerHor -> Add( panelPlotHistogramme , 1 , wxGROW ,0);
412 this->SetAutoLayout(true);
413 this->SetSizer( sizerHor );
416 // this->FitInside();
419 //-------------------------------------------------------------------
421 void wxPanelCuttingImageData::OnExtract(wxCommandEvent& event)
428 unsigned short *pOrg;
429 unsigned short *p_histogramme;
432 long int contAfter = 0;
433 long int contBefor = 0;
435 double min=999999999;
436 double max=-999999999;
438 volExt=_volExtern->GetValue();
439 volInt=_volIntern->GetValue();
440 int isoValue = _isoValue->GetValue();
441 int valueBeforeIsoValue = _valueBeforeIsoValue->GetValue();
442 int valueAfterIsoValue = _valueAfterIsoValue ->GetValue();
445 p_histogramme = (unsigned short*)_histogrammeVector->GetScalarPointer(0,0,0);
447 _imageData->GetDimensions(dim);
448 _imageData->GetSpacing(spc);
449 _actualCuttingModel->CalculeInversMatrix();
451 for (xx=0;xx<dim[0]; xx++)
453 for (yy=0;yy<dim[1]; yy++)
455 for (zz=0;zz<dim[2];zz++)
457 inside=_actualCuttingModel->IfPointInside(xx,yy,zz);
458 if ( ((inside==true)&&(volInt==true)) || ((!inside==true)&&(volExt==true)) )
460 pOrg=(unsigned short*)_imageData->GetScalarPointer (xx,yy,zz);
462 if ((*pOrg)<isoValue)
465 if (valueBeforeIsoValue!=-1)
467 *pOrg=valueBeforeIsoValue;
471 if (valueAfterIsoValue!=-1)
473 *pOrg=valueAfterIsoValue;
477 p_histogramme[*pOrg]++;
478 if (*pOrg<min) min=*pOrg;
479 if (*pOrg>max) max=*pOrg;
493 double volumeUnit = spc[0]*spc[1]*spc[2];
494 long int totalSubVolume = contBefor + contAfter;
495 double contBeforPorc = 100*(double)contBefor/(double)totalSubVolume;
496 double contAfterPorc = 100*(double)contAfter/(double)totalSubVolume;
497 infoToVo.Printf(_T("%dx%dx%d = %d"),dim[0],dim[1],dim[2], dim[0]*dim[1]*dim[2] );
498 infoSuVo.Printf(_T("%ld") , totalSubVolume);
499 infoSuVoA.Printf(_T("%.2f"), _actualCuttingModel->GetTheoricVolume() );
500 infoPixLe.Printf(_T("%ld pix. (%.2f %s) - %.2f mm^3"),contBefor, contBeforPorc ,_T("%"),contBefor*volumeUnit);
501 infoPixHi.Printf(_T("%ld pix. (%.2f %s) - %.2f mm^3"),contAfter, contAfterPorc ,_T("%"),contAfter*volumeUnit);
503 _infoToVo->SetLabel(infoToVo);
504 _infoSuVo->SetLabel(infoSuVo);
505 _infoSuVoA->SetLabel(infoSuVoA);
506 _infoPixLe->SetLabel(infoPixLe);
507 _infoPixHi->SetLabel(infoPixHi);
510 if ( _histogrammeAccumulated->GetValue()==true )
513 _histogrammeVector -> GetDimensions ( dimHist );
515 int i,size=dimHist[0];
516 for (i=1; i<=size; i++)
518 p_histogramme[i] = p_histogramme[i] + p_histogramme[i-1];
523 //EED 2017-01-01 Migration VTK7
524 #if VTK_MAJOR_VERSION <= 5
525 _histogrammeVector->Update();
527 _histogrammeVector->Modified();
530 _histogrammeVector->GetScalarRange(range);
531 _xyplot->SetYRange( 0 , range[1] );
532 _xyplot->SetXRange( min , max );
534 _vtkclipping3Ddataviewer->RefreshSurface();
535 _wxvtkbaseView->Refresh();
537 // _wxvtkbaseView->RefreshView();
538 wxCommandEvent newevent1(wxEVT_COMMAND_MENU_SELECTED,12121); // Refresh
539 //EED 2017-09-16 Migration wxWidgets 2.8 to 3.0
540 #if wxMAJOR_VERSION <= 2
541 _wxvtkbaseView->GetWxVTKRenderWindowInteractor()->GetParent()->ProcessEvent(newevent1);
543 _wxvtkbaseView->GetWxVTKRenderWindowInteractor()->GetParent()->ProcessWindowEvent(newevent1);
548 //-------------------------------------------------------------------
549 void wxPanelCuttingImageData::OnTypeFig(wxCommandEvent& event)
551 _wxvtk3Dbaseview->GetRenderer()->RemoveActor( _actualActor );
553 if (_typeFig->GetSelection()==0){
554 _actualCuttingModel=_modelCylinder;
555 _actualActor=_cylinderActor;
557 if (_typeFig->GetSelection()==1){
558 _actualCuttingModel=_modelCube;
559 _actualActor=_cubeActor;
561 if (_typeFig->GetSelection()==2){
562 _actualCuttingModel=_modelSphere;
563 _actualActor=_sphereActor;
565 _wxvtk3Dbaseview->GetRenderer()->AddActor( _actualActor );
570 //-------------------------------------------------------------------
571 void wxPanelCuttingImageData::RefreshOpacity()
573 double op= _opacityFig->GetValue()/100.0;
574 _actualActor->GetProperty()->SetOpacity( op );
577 //-------------------------------------------------------------------
578 void wxPanelCuttingImageData::OnOpacityFig(wxScrollEvent& event)
583 //-------------------------------------------------------------------
584 void wxPanelCuttingImageData::RefreshView()
586 SetParamsOfTransformation( );
589 //-------------------------------------------------------------------
590 void wxPanelCuttingImageData::Refresh()
592 _wxvtk3Dbaseview->Refresh();
595 //-------------------------------------------------------------------
596 void wxPanelCuttingImageData::SetParamsOfTransformation( )
599 vtkImageData *vtkimagedata = _vtkmprbasedata->GetImageData();
600 vtkimagedata->GetSpacing(spc);
601 int px = (int) (_vtkmprbasedata->GetX() );
602 int py = (int) (_vtkmprbasedata->GetY() );
603 int pz = (int) (_vtkmprbasedata->GetZ() );
604 int sx = (int) (_scaleX->GetValue() * spc[0] );
605 int sy = (int) (_scaleY->GetValue() * spc[1] );
606 int sz = (int) (_scaleZ->GetValue() * spc[2] );
607 _actualCuttingModel -> SetScale ( sx , sy , sz );
608 _actualCuttingModel -> SetPosition ( px , py , pz );
609 _actualCuttingModel -> SetRotation ( _rotationX->GetValue() , _rotationY->GetValue() , _rotationZ->GetValue() );
610 _actualCuttingModel -> SetSpacing ( spc[0] , spc[1] , spc[2] );
611 _actualCuttingModel -> CalculeMatrix();
614 //-------------------------------------------------------------------
616 void wxPanelCuttingImageData::OnTransform(wxScrollEvent& event)
621 //-------------------------------------------------------------------
622 void wxPanelCuttingImageData::SetVtkMPRBaseData( vtkMPRBaseData *vtkmprbasedata )
624 _vtkmprbasedata = vtkmprbasedata;
625 _imageData = _vtkmprbasedata->GetImageData();
628 //-------------------------------------------------------------------
630 void wxPanelCuttingImageData::Configure()
632 _actualCuttingModel=_modelCylinder;
633 _actualActor=_cylinderActor;
634 _wxvtk3Dbaseview->GetRenderer()->AddActor( _actualActor );
635 SetParamsOfTransformation();