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 "wxPanelCuttingImageData.h"
29 //-------------------------------------------------------------------
31 #include <vtkProperty.h>
32 #include <vtkTextProperty.h>
33 #include <vtkProperty2D.h>
34 //-------------------------------------------------------------------
35 //-------------------------------------------------------------------
37 wxPanelCuttingImageData::wxPanelCuttingImageData (wxWindow *parent)
38 : wxPanel( parent, -1)
41 _histogrammeVector = NULL;
42 _wxvtk3Dbaseview = NULL;
43 _wxvtkbaseView = NULL;
46 Create3DViewObjects();
49 //-------------------------------------------------------------------
50 wxPanelCuttingImageData::~wxPanelCuttingImageData()
56 delete _modelCylinder;
58 _vtksphere -> Delete();
59 _vtkcylinder -> Delete();
60 _cubeMapper -> Delete();
61 _sphereMapper -> Delete();
62 _cylinderMapper -> Delete();
63 _cubeActor -> Delete();
64 _sphereActor -> Delete();
65 _cylinderActor -> Delete();
66 // _xyplot->RemoveAllInputs();
68 _histogrammeVector->Delete();
69 _renplotter->Delete();
71 if(_wxvtkbaseView!=NULL){
72 delete _wxvtkbaseView;
74 //delete _vtkclipping3Ddataviewer;
81 //-------------------------------------------------------------------
82 void wxPanelCuttingImageData::RemoveActors()
84 _wxvtk3Dbaseview->GetRenderer()->RemoveActor( _actualActor );
88 //-------------------------------------------------------------------
89 void wxPanelCuttingImageData::SetWxVtk3DBaseView( wxVtk3DBaseView * wxvtk3Dbaseview )
91 _wxvtk3Dbaseview=wxvtk3Dbaseview;
94 //-------------------------------------------------------------------
96 void wxPanelCuttingImageData::SetVtkClipping3DDataViewer( vtkClipping3DDataViewer *vtkclipping3Ddataviewer )
98 this->_vtkclipping3Ddataviewer = vtkclipping3Ddataviewer;
101 //-------------------------------------------------------------------
102 void wxPanelCuttingImageData::Create3DViewObjects()
105 _vtksphere = vtkSphereSource::New();
106 _vtksphere->SetThetaResolution (20);
107 _vtksphere->SetPhiResolution (20);
108 _sphereMapper = vtkPolyDataMapper::New();
109 //EED 2017-01-01 Migration VTK7
110 #if VTK_MAJOR_VERSION <= 5
111 _sphereMapper->SetInput( _vtksphere->GetOutput() );
113 _sphereMapper->SetInputData( _vtksphere->GetOutput() );
115 _sphereActor = vtkActor::New();
116 _sphereActor->SetMapper(_sphereMapper);
117 _sphereActor->SetOrigin(0, 0, 0);
118 _sphereActor->SetPosition(0, 0, 0);
119 _sphereActor->GetProperty()->SetColor(1, 0, 0);
120 _sphereActor->SetUserTransform( _modelSphere->GetVtkTransform() );
123 _vtkcube = vtkCubeSource::New();
124 _vtkcube->SetXLength (1);
125 _vtkcube->SetYLength (1);
126 _vtkcube->SetZLength (1);
127 _cubeMapper = vtkPolyDataMapper::New();
128 //EED 2017-01-01 Migration VTK7
129 #if VTK_MAJOR_VERSION <= 5
130 _cubeMapper->SetInput( _vtkcube->GetOutput() );
132 _cubeMapper->SetInputData( _vtkcube->GetOutput() );
134 _cubeActor = vtkActor::New();
135 _cubeActor->SetMapper(_cubeMapper);
136 _cubeActor->SetOrigin(0, 0, 0);
137 _cubeActor->SetPosition(0, 0, 0);
138 _cubeActor->GetProperty()->SetColor(1, 0, 0);
139 _cubeActor->SetUserTransform( _modelCube->GetVtkTransform() );
142 _vtkcylinder = vtkCylinderSource::New();
143 _vtkcylinder->SetResolution(20);
144 _cylinderMapper = vtkPolyDataMapper::New();
146 //EED 2017-01-01 Migration VTK7
147 #if VTK_MAJOR_VERSION <= 5
148 _cylinderMapper->SetInput( _vtkcylinder->GetOutput() );
150 _cylinderMapper->SetInputData( _vtkcylinder->GetOutput() );
153 _cylinderActor = vtkActor::New();
154 _cylinderActor->SetMapper(_cylinderMapper);
155 _cylinderActor->SetOrigin(0, 0, 0);
156 _cylinderActor->SetPosition(0, 0, 0);
157 _cylinderActor->GetProperty()->SetColor(1, 0, 0);
158 _cylinderActor->SetUserTransform( _modelCylinder->GetVtkTransform() );
163 //-------------------------------------------------------------------
164 void wxPanelCuttingImageData::CreateModel()
166 _modelCube = new figureCuttingCubeModel();
167 _modelSphere = new figureCuttingSphereModel();
168 _modelCylinder = new figureCuttingCylinderModel();
170 // _modelCube->SetVtkTransform( _modelCube->GetVtkTransform() );
171 // _modelSphere->SetVtkTransform( _modelSphere->GetVtkTransform() );
172 // _modelCylinder->SetVtkTransform( _modelCylinder->GetVtkTransform() );
175 //-------------------------------------------------------------------
177 void wxPanelCuttingImageData::InitHistogramme()
180 if (_imageData==NULL)
184 _imageData->GetScalarRange(rangeA);
186 //EED 2017-01-01 Migration VTK7
187 #if VTK_MAJOR_VERSION <= 5
188 _xyplot->RemoveAllInputs();
190 _xyplot->RemoveAllDataSetInputConnections();
193 if ( _histogrammeVector!=NULL )
195 _histogrammeVector -> Delete();
198 _histogrammeVector = vtkImageData::New();
199 _histogrammeVector -> SetDimensions ( (int)(rangeA[1]),1,1 );
200 //EED 2017-01-01 Migration VTK7
201 #if VTK_MAJOR_VERSION <= 5
202 _histogrammeVector -> SetScalarTypeToUnsignedShort();
203 _histogrammeVector -> AllocateScalars();
204 _histogrammeVector -> Update();
206 _histogrammeVector -> AllocateScalars(VTK_UNSIGNED_SHORT,1);
209 unsigned short *p_vol = (unsigned short*)_histogrammeVector->GetScalarPointer(0,0,0);
210 int i,size = (int) (rangeA[1]);
211 for (i=0; i < size; i++)
216 _xyplot->SetXRange(0, rangeA[1]);
217 _xyplot->SetYRange(0, 10);
220 //EED 2017-01-01 Migration VTK7
221 #if VTK_MAJOR_VERSION <= 5
222 _xyplot->AddInput( _histogrammeVector );
224 _xyplot->AddDataSetInput( _histogrammeVector );
229 //-------------------------------------------------------------------
230 wxWindow *wxPanelCuttingImageData::CreatePlotHistogrammeInterface()
232 _xyplot = vtkXYPlotActor::New();
234 _xyplot->GetPositionCoordinate()->SetValue(0.00, 0.00, 0);
235 _xyplot->GetPosition2Coordinate()->SetValue(1.0, 1.00, 0); //relative to Position
236 _xyplot->SetXValuesToArcLength();
237 _xyplot->SetNumberOfXLabels(6);
239 _xyplot->SetTitle("Histogramme");
240 _xyplot->SetXTitle("Gray level");
241 _xyplot->SetYTitle("Occurrences ");
242 _xyplot->GetProperty()->SetColor(1, 0, 0);
243 _xyplot->GetProperty()->SetPointSize(2);
244 vtkTextProperty *tprop = _xyplot->GetTitleTextProperty();
245 tprop->SetColor( 1,0,1 );
247 _xyplot->SetAxisTitleTextProperty(tprop);
248 _xyplot->SetAxisLabelTextProperty(tprop);
249 _xyplot->PlotPointsOn();
250 _xyplot->GetProperty()->SetPointSize(3);
252 _wxvtkbaseView = new wxVtkBaseView(this);
253 _wxvtkbaseView->Configure();
255 _renplotter = vtkRenderer::New();
256 vtkRenderWindow *renWin = _wxvtkbaseView->GetRenWin();
257 renWin->AddRenderer( _renplotter );
258 _renplotter->AddActor2D( _xyplot );
260 return _wxvtkbaseView->GetWxVTKRenderWindowInteractor();
263 //-------------------------------------------------------------------
265 void wxPanelCuttingImageData::CreateInterface()
268 wxBoxSizer *topsizer = new wxBoxSizer(wxVERTICAL); // Principal sizer
270 wxBoxSizer *sizerH0 = new wxBoxSizer(wxHORIZONTAL ); // type of segmentation figure
271 wxBoxSizer *sizerH2 = new wxBoxSizer(wxHORIZONTAL ); // scale
272 wxBoxSizer *sizerH3 = new wxBoxSizer(wxHORIZONTAL ); // rotation
273 wxBoxSizer *sizerH4 = new wxBoxSizer(wxHORIZONTAL ); // intern extern
274 wxBoxSizer *sizerH5 = new wxBoxSizer(wxHORIZONTAL ); // Isovalue
275 wxBoxSizer *sizerH6 = new wxBoxSizer(wxHORIZONTAL ); // Buttons
276 wxFlexGridSizer *sizerH7 = new wxFlexGridSizer(2 ); // Volumic information
279 _typeFig = new wxChoice(this,-1);
280 _opacityFig = new wxSlider(this,-1,100,0,100, wxDefaultPosition, wxDefaultSize, wxSL_HORIZONTAL | wxSL_LABELS);
282 _scaleX = new wxSlider(this,-1,6,0,500 , wxDefaultPosition, wxDefaultSize, wxSL_HORIZONTAL | wxSL_LABELS);
283 _scaleY = new wxSlider(this,-1,20,0,500 , wxDefaultPosition, wxDefaultSize, wxSL_HORIZONTAL | wxSL_LABELS);
284 _scaleZ = new wxSlider(this,-1,7,0,500 , wxDefaultPosition, wxDefaultSize, wxSL_HORIZONTAL | wxSL_LABELS);
286 _rotationX = new wxSlider(this,-1,0,-360,360, wxDefaultPosition, wxDefaultSize, wxSL_HORIZONTAL | wxSL_LABELS);
287 _rotationY = new wxSlider(this,-1,0,-360,360, wxDefaultPosition, wxDefaultSize, wxSL_HORIZONTAL | wxSL_LABELS);
288 _rotationZ = new wxSlider(this,-1,0,-360,360, wxDefaultPosition, wxDefaultSize, wxSL_HORIZONTAL | wxSL_LABELS);
290 _volIntern = new wxRadioButton(this,-1, _T("Volume intern " ));
291 _volExtern = new wxRadioButton(this,-1, _T("Volume extern " ));
293 _histogrammeAccumulated = new wxCheckBox(this,-1,_T("Histogramme accumulated"));
295 _isoValue = new wxSlider(this,-1, 200, 0,2000, wxDefaultPosition,wxDefaultSize, wxSL_HORIZONTAL | wxSL_LABELS);
296 _valueBeforeIsoValue = new wxSlider(this,-1,-1,-1,2000, wxDefaultPosition, wxDefaultSize, wxSL_HORIZONTAL | wxSL_LABELS);
297 _valueAfterIsoValue = new wxSlider(this,-1,-1,-1,2000, wxDefaultPosition, wxDefaultSize, wxSL_HORIZONTAL | wxSL_LABELS);
299 wxButton *btnExtract = new wxButton(this, -1,_T("Extract"));
301 _infoToVo = new wxStaticText(this,-1,_T("########################"));
302 _infoSuVoA = new wxStaticText(this,-1,_T("############"));
303 _infoSuVo = new wxStaticText(this,-1,_T("############"));
304 _infoPixLe = new wxStaticText(this,-1,_T("############"));
305 _infoPixHi = new wxStaticText(this,-1,_T("############"));
310 _typeFig->Append(_T("Cylindre"));
311 _typeFig->Append(_T("Cube"));
312 _typeFig->Append(_T("Sphere"));
313 _typeFig->SetSelection(0);
314 _volIntern->SetValue(true);
316 Connect(_typeFig->GetId() , wxEVT_COMMAND_CHOICE_SELECTED , (wxObjectEventFunction) &wxPanelCuttingImageData::OnTypeFig );
318 Connect(_opacityFig->GetId() , wxEVT_COMMAND_SLIDER_UPDATED , (wxObjectEventFunction) &wxPanelCuttingImageData::OnOpacityFig );
319 Connect(_rotationX->GetId() , wxEVT_COMMAND_SLIDER_UPDATED , (wxObjectEventFunction) &wxPanelCuttingImageData::OnTransform );
320 Connect(_rotationY->GetId() , wxEVT_COMMAND_SLIDER_UPDATED , (wxObjectEventFunction) &wxPanelCuttingImageData::OnTransform );
321 Connect(_rotationZ->GetId() , wxEVT_COMMAND_SLIDER_UPDATED , (wxObjectEventFunction) &wxPanelCuttingImageData::OnTransform );
322 Connect(_scaleX->GetId() , wxEVT_COMMAND_SLIDER_UPDATED , (wxObjectEventFunction) &wxPanelCuttingImageData::OnTransform );
323 Connect(_scaleY->GetId() , wxEVT_COMMAND_SLIDER_UPDATED , (wxObjectEventFunction) &wxPanelCuttingImageData::OnTransform );
324 Connect(_scaleZ->GetId() , wxEVT_COMMAND_SLIDER_UPDATED , (wxObjectEventFunction) &wxPanelCuttingImageData::OnTransform );
325 Connect(btnExtract->GetId() , wxEVT_COMMAND_BUTTON_CLICKED , (wxObjectEventFunction) &wxPanelCuttingImageData::OnExtract );
328 // wxStaticText *text=new wxStaticText(this,-1, " ");
330 sizerH0 -> Add( new wxStaticText(this,-1, _T("Fig. Type: "),wxDefaultPosition, wxSize(50,20)) ,1,wxALL ,0);
331 sizerH0 -> Add( _typeFig ,1,wxALL ,0);
332 sizerH0 -> Add( _opacityFig ,1,wxALL|wxEXPAND ,0);
334 sizerH2 -> Add( new wxStaticText(this,-1,_T("Scale : ")) ,1,wxALL ,0);
335 sizerH2 -> Add( _scaleX ,1,wxALL | wxEXPAND ,0 );
336 sizerH2 -> Add( _scaleY ,1,wxALL | wxEXPAND ,0 );
337 sizerH2 -> Add( _scaleZ ,1,wxALL | wxEXPAND ,0 );
339 sizerH3 -> Add( new wxStaticText(this,-1,_T("Rotation : ")) ,1,wxALL ,0);
340 sizerH3 -> Add( _rotationX ,1,wxALL | wxEXPAND ,0 );
341 sizerH3 -> Add( _rotationY ,1,wxALL | wxEXPAND ,0 );
342 sizerH3 -> Add( _rotationZ ,1,wxALL | wxEXPAND ,0 );
345 sizerH4 -> Add( new wxStaticText(this,-1,_T("Intern / Extern : ")) ,1,wxALL ,0);
346 sizerH4 -> Add( _volIntern ,1,wxALL ,0);
347 sizerH4 -> Add( new wxStaticText(this,-1, _T(" ")) ,1,wxALL ,0);
348 sizerH4 -> Add( _volExtern ,1,wxALL ,0);
350 sizerH5 -> Add( new wxStaticText(this,-1,_T("Isovalue ")) ,1,wxALL ,0);
351 sizerH5 -> Add( _isoValue ,1,wxALL | wxEXPAND ,0 );
352 sizerH5 -> Add( _valueBeforeIsoValue ,1,wxALL | wxEXPAND ,0 );
353 sizerH5 -> Add( _valueAfterIsoValue ,1,wxALL | wxEXPAND ,0 );
355 sizerH6 -> Add( new wxStaticText(this,-1, _T(" ")) ,1,wxALL ,0);
356 sizerH6 -> Add( btnExtract ,1,wxALL ,0);
358 sizerH7 -> Add( new wxStaticText(this,-1,_T("Total Volume: "), wxDefaultPosition, wxSize(200,12)) , 1 , wxALL ,0);
359 sizerH7 -> Add( _infoToVo , 1 , wxALL ,0);
360 sizerH7 -> Add( new wxStaticText(this,-1,_T("SubVolume: "), wxDefaultPosition, wxSize(200,12) ) , 1 , wxALL ,0);
361 sizerH7 -> Add( _infoSuVo , 1 , wxALL ,0);
362 sizerH7 -> Add( new wxStaticText(this,-1,_T("SubVolume (ana.): "), wxDefaultPosition, wxSize(200,12)) , 1 , wxALL ,0);
363 sizerH7 -> Add( _infoSuVoA , 1 , wxALL ,0);
364 sizerH7 -> Add( new wxStaticText(this,-1,_T("Pix < isovalue: ") , wxDefaultPosition, wxSize(200,12)) , 1 , wxALL ,0);
365 sizerH7 -> Add( _infoPixLe , 1 , wxALL ,0);
366 sizerH7 -> Add( new wxStaticText(this,-1,_T("Pix > isovalue: "), wxDefaultPosition, wxSize(200,12)) , 1 , wxALL ,0);
367 sizerH7 -> Add( _infoPixHi , 1 , wxALL ,0);
368 // sizerH7 -> SetMinSize(300, 120);
371 topsizer -> Add( sizerH0 ,1,wxALL|wxEXPAND ,0);
374 topsizer -> Add( sizerH2 ,1,wxALL|wxEXPAND ,0);
377 topsizer -> Add( sizerH3 ,1,wxALL|wxEXPAND ,0);
380 topsizer -> Add( sizerH4 ,1,wxALL ,0);
384 topsizer -> Add( sizerH5 ,1,wxALL |wxEXPAND ,0);
387 topsizer -> Add( sizerH6 , 1 , wxALL ,0);
390 topsizer -> Add( _histogrammeAccumulated ,1, wxALL ,0);
392 // Volumic information
393 topsizer -> Add( sizerH7 , 1 , wxALL|wxEXPAND ,0);
397 // wxBoxSizer *sizerHor = new wxBoxSizer(wxHORIZONTAL);
398 wxBoxSizer *sizerHor = new wxBoxSizer(wxVERTICAL);
399 sizerHor -> Add( topsizer , 1 , wxALL | wxEXPAND ,0);
402 wxWindow *panelPlotHistogramme = CreatePlotHistogrammeInterface();
403 sizerHor -> Add( panelPlotHistogramme , 1 , wxGROW ,0);
406 this->SetAutoLayout(true);
407 this->SetSizer( sizerHor );
410 // this->FitInside();
413 //-------------------------------------------------------------------
415 void wxPanelCuttingImageData::OnExtract(wxCommandEvent& event)
422 unsigned short *pOrg;
423 unsigned short *p_histogramme;
426 long int contAfter = 0;
427 long int contBefor = 0;
429 double min=999999999;
430 double max=-999999999;
432 volExt=_volExtern->GetValue();
433 volInt=_volIntern->GetValue();
434 int isoValue = _isoValue->GetValue();
435 int valueBeforeIsoValue = _valueBeforeIsoValue->GetValue();
436 int valueAfterIsoValue = _valueAfterIsoValue ->GetValue();
439 p_histogramme = (unsigned short*)_histogrammeVector->GetScalarPointer(0,0,0);
441 _imageData->GetDimensions(dim);
442 _imageData->GetSpacing(spc);
443 _actualCuttingModel->CalculeInversMatrix();
445 for (xx=0;xx<dim[0]; xx++)
447 for (yy=0;yy<dim[1]; yy++)
449 for (zz=0;zz<dim[2];zz++)
451 inside=_actualCuttingModel->IfPointInside(xx,yy,zz);
452 if ( ((inside==true)&&(volInt==true)) || ((!inside==true)&&(volExt==true)) )
454 pOrg=(unsigned short*)_imageData->GetScalarPointer (xx,yy,zz);
456 if ((*pOrg)<isoValue)
459 if (valueBeforeIsoValue!=-1)
461 *pOrg=valueBeforeIsoValue;
465 if (valueAfterIsoValue!=-1)
467 *pOrg=valueAfterIsoValue;
471 p_histogramme[*pOrg]++;
472 if (*pOrg<min) min=*pOrg;
473 if (*pOrg>max) max=*pOrg;
487 double volumeUnit = spc[0]*spc[1]*spc[2];
488 long int totalSubVolume = contBefor + contAfter;
489 double contBeforPorc = 100*(double)contBefor/(double)totalSubVolume;
490 double contAfterPorc = 100*(double)contAfter/(double)totalSubVolume;
491 infoToVo.Printf(_T("%dx%dx%d = %d"),dim[0],dim[1],dim[2], dim[0]*dim[1]*dim[2] );
492 infoSuVo.Printf(_T("%ld") , totalSubVolume);
493 infoSuVoA.Printf(_T("%.2f"), _actualCuttingModel->GetTheoricVolume() );
494 infoPixLe.Printf(_T("%ld pix. (%.2f %s) - %.2f mm^3"),contBefor, contBeforPorc ,_T("%"),contBefor*volumeUnit);
495 infoPixHi.Printf(_T("%ld pix. (%.2f %s) - %.2f mm^3"),contAfter, contAfterPorc ,_T("%"),contAfter*volumeUnit);
497 _infoToVo->SetLabel(infoToVo);
498 _infoSuVo->SetLabel(infoSuVo);
499 _infoSuVoA->SetLabel(infoSuVoA);
500 _infoPixLe->SetLabel(infoPixLe);
501 _infoPixHi->SetLabel(infoPixHi);
504 if ( _histogrammeAccumulated->GetValue()==true )
507 _histogrammeVector -> GetDimensions ( dimHist );
509 int i,size=dimHist[0];
510 for (i=1; i<=size; i++)
512 p_histogramme[i] = p_histogramme[i] + p_histogramme[i-1];
517 //EED 2017-01-01 Migration VTK7
518 #if VTK_MAJOR_VERSION <= 5
519 _histogrammeVector->Update();
521 _histogrammeVector->Modified();
524 _histogrammeVector->GetScalarRange(range);
525 _xyplot->SetYRange( 0 , range[1] );
526 _xyplot->SetXRange( min , max );
528 _vtkclipping3Ddataviewer->RefreshSurface();
529 _wxvtkbaseView->Refresh();
531 // _wxvtkbaseView->RefreshView();
532 wxCommandEvent newevent1(wxEVT_COMMAND_MENU_SELECTED,12121); // Refresh
533 //EED 2017-09-16 Migration wxWidgets 2.8 to 3.0
534 #if wxMAJOR_VERSION <= 2
535 _wxvtkbaseView->GetWxVTKRenderWindowInteractor()->GetParent()->ProcessEvent(newevent1);
537 _wxvtkbaseView->GetWxVTKRenderWindowInteractor()->GetParent()->ProcessWindowEvent(newevent1);
542 //-------------------------------------------------------------------
543 void wxPanelCuttingImageData::OnTypeFig(wxCommandEvent& event)
545 _wxvtk3Dbaseview->GetRenderer()->RemoveActor( _actualActor );
547 if (_typeFig->GetSelection()==0){
548 _actualCuttingModel=_modelCylinder;
549 _actualActor=_cylinderActor;
551 if (_typeFig->GetSelection()==1){
552 _actualCuttingModel=_modelCube;
553 _actualActor=_cubeActor;
555 if (_typeFig->GetSelection()==2){
556 _actualCuttingModel=_modelSphere;
557 _actualActor=_sphereActor;
559 _wxvtk3Dbaseview->GetRenderer()->AddActor( _actualActor );
564 //-------------------------------------------------------------------
565 void wxPanelCuttingImageData::RefreshOpacity()
567 double op= _opacityFig->GetValue()/100.0;
568 _actualActor->GetProperty()->SetOpacity( op );
571 //-------------------------------------------------------------------
572 void wxPanelCuttingImageData::OnOpacityFig(wxScrollEvent& event)
577 //-------------------------------------------------------------------
578 void wxPanelCuttingImageData::RefreshView()
580 SetParamsOfTransformation( );
583 //-------------------------------------------------------------------
584 void wxPanelCuttingImageData::Refresh()
586 _wxvtk3Dbaseview->Refresh();
589 //-------------------------------------------------------------------
590 void wxPanelCuttingImageData::SetParamsOfTransformation( )
593 vtkImageData *vtkimagedata = _vtkmprbasedata->GetImageData();
594 vtkimagedata->GetSpacing(spc);
595 int px = (int) (_vtkmprbasedata->GetX() );
596 int py = (int) (_vtkmprbasedata->GetY() );
597 int pz = (int) (_vtkmprbasedata->GetZ() );
598 int sx = (int) (_scaleX->GetValue() * spc[0] );
599 int sy = (int) (_scaleY->GetValue() * spc[1] );
600 int sz = (int) (_scaleZ->GetValue() * spc[2] );
601 _actualCuttingModel -> SetScale ( sx , sy , sz );
602 _actualCuttingModel -> SetPosition ( px , py , pz );
603 _actualCuttingModel -> SetRotation ( _rotationX->GetValue() , _rotationY->GetValue() , _rotationZ->GetValue() );
604 _actualCuttingModel -> SetSpacing ( spc[0] , spc[1] , spc[2] );
605 _actualCuttingModel -> CalculeMatrix();
608 //-------------------------------------------------------------------
610 void wxPanelCuttingImageData::OnTransform(wxScrollEvent& event)
615 //-------------------------------------------------------------------
616 void wxPanelCuttingImageData::SetVtkMPRBaseData( vtkMPRBaseData *vtkmprbasedata )
618 _vtkmprbasedata = vtkmprbasedata;
619 _imageData = _vtkmprbasedata->GetImageData();
622 //-------------------------------------------------------------------
624 void wxPanelCuttingImageData::Configure()
626 _actualCuttingModel=_modelCylinder;
627 _actualActor=_cylinderActor;
628 _wxvtk3Dbaseview->GetRenderer()->AddActor( _actualActor );
629 SetParamsOfTransformation();