3 #include <vtkProperty.h>
4 #include <vtkPolyData.h>
5 #include <vtkDataSet.h>
7 #include "wxSurfaceMPR.h"
8 #include <wx/colordlg.h>
12 //-------------------------------------------------------------------
13 //-------------------------------------------------------------------
14 //-------------------------------------------------------------------
19 void boxVolumeObserver::Execute(vtkObject *wdg, unsigned long eventId, void* calldata) { // virtual
20 if (eventId==vtkCommand::StartInteractionEvent){
21 _renWin->SetDesiredUpdateRate(10);
23 if (eventId==vtkCommand::InteractionEvent){
24 _renWin->SetDesiredUpdateRate(0.001);
26 if (eventId==vtkCommand::EndInteractionEvent){
27 vtkPlanes *planes = vtkPlanes::New();
28 vtkBoxWidget *boxwidget = reinterpret_cast<vtkBoxWidget*>(wdg);
29 boxwidget->GetPlanes(planes);
30 _volumeMapper->SetClippingPlanes(planes);
34 //-------------------------------------------------------------------
35 void boxVolumeObserver::SetRenWin( vtkRenderWindow *renWin ){
38 //-------------------------------------------------------------------
39 void boxVolumeObserver::SetVolumeMapper(vtkVolumeRayCastMapper *volumeMapper){
40 _volumeMapper = volumeMapper;
44 //-------------------------------------------------------------------
45 //-------------------------------------------------------------------
46 //-------------------------------------------------------------------
48 void boxSurfaceObserver::Execute(vtkObject *wdg, unsigned long eventId, void* calldata) { // virtual
49 vtkBoxWidget *boxwidget = reinterpret_cast<vtkBoxWidget*>(wdg);
50 boxwidget->GetPlanes(_planes);
51 _actor->VisibilityOn();
53 //-------------------------------------------------------------------
54 void boxSurfaceObserver::SetPlanes(vtkPlanes *planes){
57 //-------------------------------------------------------------------
58 void boxSurfaceObserver::SetActor(vtkActor *actor){
64 //-------------------------------------------------------------------
65 //-------------------------------------------------------------------
66 //-------------------------------------------------------------------
70 vtkMPR3DData::vtkMPR3DData()
72 _colour[0]= new wxColour(255,127, 64);
73 _colour[1]= new wxColour(255,255,250);
74 _colour[2]= new wxColour( 0,255,000);
75 _colour[3]= new wxColour( 0, 0,255);
76 _visiblePosition[0]=true;
77 _visiblePosition[1]=true;
78 _visiblePosition[2]=true;
80 //-------------------------------------------------------------------
81 vtkMPR3DData::~vtkMPR3DData()
84 for (i=0; i< VTKMPRDATA_MAXTISSUE ; i++){
85 _tissueExtractor[i] ->Delete();
86 _tissueNormals[i] ->Delete();
87 _tissueStripper[i] ->Delete();
88 _tissueMapper[i] ->Delete();
90 _tissuePlanes[i] ->Delete();
91 _tissueClipper[i] ->Delete();
93 _outlineData ->Delete();
94 _mapOutline ->Delete();
100 _compositeFunction ->Delete();
101 _volumeMapper ->Delete();
102 _volumeProperty ->Delete();
105 //-------------------------------------------------------------------
106 vtkActor* vtkMPR3DData::GetOutlineActor()
110 //-------------------------------------------------------------------
111 vtkPolyDataMapper* vtkMPR3DData::GetTissueMapper(int id)
113 return _tissueMapper[id];
115 //-------------------------------------------------------------------
116 vtkPlanes* vtkMPR3DData::GetTissuePlanes(int id)
118 return _tissuePlanes[id];
120 //-------------------------------------------------------------------
121 vtkStripper* vtkMPR3DData::GetTissueStripper(int id)
123 return _tissueStripper[id];
125 //-------------------------------------------------------------------
126 vtkImageActor* vtkMPR3DData::GetImageActor(int id)
128 vtkImageActor *tmpVtkActor=NULL;
130 tmpVtkActor = GetvtkActor_saggital();
133 tmpVtkActor = GetvtkActor_coronal();
136 tmpVtkActor = GetvtkActor_axial();
140 //-------------------------------------------------------------------
141 void vtkMPR3DData::Configure()
145 for (i=0; i< VTKMPRDATA_MAXTISSUE ; i++){
147 _tissueExtractor[i] = vtkContourFilter::New();
148 _tissueExtractor[i]->SetInput((vtkDataSet *) GetImageData() );
149 _tissueExtractor[i]->SetValue(0, 0);
150 _tissueNormals[i] = vtkPolyDataNormals::New();
151 _tissueNormals[i]->SetInput(_tissueExtractor[i]->GetOutput());
152 _tissueNormals[i]->SetFeatureAngle(60.0);
153 _tissueStripper[i] = vtkStripper::New();
154 _tissueStripper[i]->SetInput(_tissueNormals[i]->GetOutput());
157 _tissuePlanes[i] = vtkPlanes::New();
158 _tissueClipper[i] = vtkClipPolyData::New();
159 _tissueClipper[i]->SetInput( _tissueStripper[i]->GetOutput() );
160 _tissueClipper[i]->SetClipFunction( _tissuePlanes[i] );
161 _tissueClipper[i]->InsideOutOn( );
163 _tissueMapper[i] = vtkPolyDataMapper::New();
164 _tissueMapper[i]->SetInput( _tissueClipper[i]->GetOutput() );
166 _tissueMapper[i] = vtkPolyDataMapper::New();
167 _tissueMapper[i]->SetInput(_tissueStripper[i]->GetOutput());
168 // _tissueMapper[i]->ScalarVisibilityOff();
176 // An outline provides context around the data.
178 _outlineData = vtkOutlineFilter::New();
179 _outlineData->SetInput((vtkDataSet *) GetImageData() );
180 _mapOutline = vtkPolyDataMapper::New();
181 _mapOutline->SetInput(_outlineData->GetOutput());
182 _outline = vtkActor::New();
183 _outline->SetMapper(_mapOutline);
184 _outline->GetProperty()->SetColor(0,0,0);
186 // Now we are creating three orthogonal planes passing through the
187 // volume. Each plane uses a different texture map and therefore has
188 // diferent coloration.
192 _tfun = vtkPiecewiseFunction::New();
194 // _tfun->AddPoint(70.0, 0.0);
195 // _tfun->AddPoint(599.0, 0);
196 // _tfun->AddPoint(600.0, 0);
197 // _tfun->AddPoint(1195.0, 0);
198 // _tfun->AddPoint(1200, .2);
199 // _tfun->AddPoint(1300, .3);
200 // _tfun->AddPoint(2000, .3);
201 // _tfun->AddPoint(4095.0, 1.0);
203 _tfun->AddPoint(70 , 0.0);
204 _tfun->AddPoint(599 , 0.0);
205 _tfun->AddPoint(600 , 0.0);
206 _tfun->AddPoint(1110, 0.0);
207 _tfun->AddPoint(1111, 1.0);
208 _tfun->AddPoint(1300, 1.0);
209 _tfun->AddPoint(2000, 1.0);
210 _tfun->AddPoint(4095, 1.0);
212 _ctfun = vtkColorTransferFunction::New();
214 // _ctfun->AddRGBPoint(0.0, 0.5, 0.0, 0.0);
215 // _ctfun->AddRGBPoint(600.0, 1.0, 0.5, 0.5);
216 // _ctfun->AddRGBPoint(1280.0, 0.9, 0.2, 0.3);
217 // _ctfun->AddRGBPoint(1960.0, 0.81, 0.27, 0.1);
218 // _ctfun->AddRGBPoint(4095.0, 0.5, 0.5, 0.5);
220 _ctfun->AddRGBPoint(0.0 , 0.5 , 0.0 , 0.0 );
221 _ctfun->AddRGBPoint(600.0 , 1.0 , 0.5 , 0.5 );
222 _ctfun->AddRGBPoint(1130.0 , 0.9 , 0.2 , 0.3 );
223 _ctfun->AddRGBPoint(1131.0 , 0.3 , 0.9 , 0.9 );
224 _ctfun->AddRGBPoint(1135.0 , 0.3 , 0.8 , 0.8 );
225 _ctfun->AddRGBPoint(1960.0 , 0.1 , 0.27 , 0.71);
226 _ctfun->AddRGBPoint(4095.0 , 0.5 , 0.5 , 0.5 );
228 _compositeFunction = vtkVolumeRayCastCompositeFunction::New();
230 _volumeMapper = vtkVolumeRayCastMapper::New();
231 _volumeMapper->SetInput( GetImageData() );
232 _volumeMapper->SetVolumeRayCastFunction(_compositeFunction);
234 _volumeProperty = vtkVolumeProperty::New();
235 _volumeProperty->SetColor(_ctfun);
236 _volumeProperty->SetScalarOpacity(_tfun);
237 _volumeProperty->SetInterpolationTypeToLinear();
238 _volumeProperty->ShadeOn();
240 _newvol = vtkVolume::New();
241 _newvol->SetMapper(_volumeMapper);
242 _newvol->SetProperty(_volumeProperty);
244 vtkMPRBaseData::Configure();
249 //-------------------------------------------------------------------
250 void vtkMPR3DData::SetIsovalue(int idTissue, int isoValue)
252 _tissueExtractor[idTissue]->SetValue(0, isoValue);
255 //-------------------------------------------------------------------
256 wxColour* vtkMPR3DData::GetColour(int idColour)
258 return _colour[idColour];
260 //-------------------------------------------------------------------
261 void vtkMPR3DData::SetVisiblePosition(int idPosition, bool visible)
263 _visiblePosition[idPosition]=visible;
265 //-------------------------------------------------------------------
266 bool vtkMPR3DData::GetVisiblePosition(int idPosition)
268 return _visiblePosition[idPosition];
270 //-------------------------------------------------------------------
271 vtkVolume* vtkMPR3DData::GetVolumeActor()
275 //-------------------------------------------------------------------
276 vtkVolumeRayCastMapper* vtkMPR3DData::GetVolumeMapper(){
277 return _volumeMapper;
282 //-------------------------------------------------------------------
283 //-------------------------------------------------------------------
284 //-------------------------------------------------------------------
288 wxVtkMPR3DView::wxVtkMPR3DView(wxWindow *parent)
289 :wxVtk3DBaseView( parent )
292 for (i=0; i<VTKMPRDATA_MAXTISSUE; i++){
293 _visibleTissue[i]=true;
299 //-------------------------------------------------------------------
300 wxVtkMPR3DView::~wxVtkMPR3DView(){
302 for (i=0; i< VTKMPRDATA_MAXTISSUE ; i++){
303 _tissue[i]->Delete();
306 _boxWidget -> Delete();
307 _observerV -> Delete();
308 _boxWidgetS1 -> Delete();
309 _observerS1 -> Delete();
312 //-------------------------------------------------------------------
313 void wxVtkMPR3DView::SetVisibleTissue(int idTissue, bool visible){
314 _visibleTissue[idTissue]=visible;
316 //-------------------------------------------------------------------
317 bool wxVtkMPR3DView::GetVisibleTissue(int idTissue){
318 return _visibleTissue[idTissue];
320 //-------------------------------------------------------------------
321 vtkActor* wxVtkMPR3DView::GetTissueActor(int id){
324 //-------------------------------------------------------------------
325 void wxVtkMPR3DView::Configure(){
326 vtkMPR3DData *vtkmpr3Ddata = (vtkMPR3DData*)GetVtkmprbasedata();
327 wxVtk3DBaseView::Configure();
330 for (i=0; i< VTKMPRDATA_MAXTISSUE ; i++){
332 _tissue[i] = vtkActor::New();
333 _tissue[i]->SetMapper(vtkmpr3Ddata->GetTissueMapper(i));
335 // wxColour* cc=_vtkmprdata->GetColour(i);
336 // float cr=cc->Red(),cg=cc->Green(),cb=cc->Blue();
337 // _tissue[i]->GetProperty()->SetDiffuseColor(cr/255, cg/255 , cb/255 );
338 // _tissue[i]->GetProperty()->SetSpecular(.3);
339 // _tissue[i]->GetProperty()->SetSpecularPower(20);
341 if (i==0) _tissue[i]->GetProperty()->SetColor(1, 0 , 0 );
342 if (i==2) _tissue[i]->GetProperty()->SetColor(0.85, 0.85 , 0.85 );
343 if (i==3) _tissue[i]->GetProperty()->SetColor(0, 1 , 0 );
344 if (i==4) _tissue[i]->GetProperty()->SetColor(0, 0 , 1 );
347 _tissue[i]->VisibilityOff();
348 _tissue[i]->SetScale(1.01, 1.01, 1.01);
353 GetRenderer()->AddVolume( vtkmpr3Ddata->GetVolumeActor() ); // RayCast
354 GetRenderer()->SetBackground(0.5, 0.5, 0.5);
356 // Actors are added to the renderer.
357 GetRenderer()->AddActor( vtkmpr3Ddata->GetOutlineActor() );
358 GetRenderer()->AddActor( vtkmpr3Ddata->GetImageActor(0) ); // _saggital
359 GetRenderer()->AddActor( vtkmpr3Ddata->GetImageActor(1) ); // _axial
360 GetRenderer()->AddActor( vtkmpr3Ddata->GetImageActor(2) ); // _coronal
366 // The SetInteractor method is how 3D widgets are associated with the
367 // render window interactor. Internally, SetInteractor sets up a bunch
368 // of callbacks using the Command/Observer mechanism (AddObserver()).
369 _boxWidget = vtkBoxWidget::New();
370 _boxWidget->SetInteractor( GetWxVTKRenderWindowInteractor() );
371 _boxWidget->SetPlaceFactor(1.0);
373 // Place the interactor initially. The output of the reader is used to
374 // place the box widget.
376 _observerV = boxVolumeObserver::New();
377 _observerV->SetRenWin( GetRenWin() );
378 _observerV->SetVolumeMapper( vtkmpr3Ddata->GetVolumeMapper() );
380 _boxWidget->SetInput( vtkmpr3Ddata->GetImageData() );
381 _boxWidget->PlaceWidget();
382 _boxWidget->InsideOutOn();
383 _boxWidget->AddObserver( vtkCommand::StartInteractionEvent , _observerV );
384 _boxWidget->AddObserver( vtkCommand::InteractionEvent , _observerV );
385 _boxWidget->AddObserver( vtkCommand::EndInteractionEvent , _observerV );
388 vtkProperty *outlineProperty = _boxWidget->GetOutlineProperty();
389 outlineProperty->SetRepresentationToWireframe();
390 outlineProperty->SetAmbient(1.0);
391 outlineProperty->SetAmbientColor(1, 1, 1);
392 outlineProperty->SetLineWidth(3);
394 vtkProperty *selectedOutlineProperty = _boxWidget->GetSelectedOutlineProperty();
395 selectedOutlineProperty->SetRepresentationToWireframe();
396 selectedOutlineProperty->SetAmbient(1.0);
397 selectedOutlineProperty->SetAmbientColor(1, 0, 0);
398 selectedOutlineProperty->SetLineWidth(3);
403 // Place the interactor initially. The output of the reader is used to
404 // place the box widget.
406 // _observerV = boxVolumeObserver::New();
407 // _observerV->SetRenWin( _renWin );
408 // _observerV->SetVolumeMapper( _vtkmprdata->GetVolumeMapper() );
410 _observerS1 = boxSurfaceObserver::New();
411 _observerS1->SetPlanes( vtkmpr3Ddata->GetTissuePlanes(0) );
412 _observerS1->SetActor( _tissue[0] );
414 _boxWidgetS1 = vtkBoxWidget::New();
415 _boxWidgetS1->SetInteractor( GetWxVTKRenderWindowInteractor() );
416 _boxWidgetS1->SetPlaceFactor(1.25);
419 _boxWidgetS1->SetInput( vtkmpr3Ddata->GetTissueStripper(0)->GetOutput() );
420 // _boxWidgetS1->SetInput( vtkmpr3Ddata->GetGlyph(0)->GetOutput() );
421 _boxWidgetS1->PlaceWidget();
422 _boxWidgetS1->InsideOutOff();
423 // _boxWidgetS1->AddObserver( vtkCommand::StartInteractionEvent , _observerV );
424 // _boxWidgetS1->AddObserver( vtkCommand::InteractionEvent , _observerV );
425 // _boxWidgetS1->AddObserver( vtkCommand::EndInteractionEvent , _observerV );
426 // _boxWidgetS1->AddObserver( vtkCommand::EndInteractionEvent , _observerS1 );
427 _boxWidgetS1->AddObserver( vtkCommand::InteractionEvent , _observerS1 );
429 // vtkProperty *outlinePropertyS1 = _boxWidgetS1->GetOutlineProperty();
430 // outlinePropertyS1->SetRepresentationToWireframe();
431 // outlinePropertyS1->SetAmbient(1.0);
432 // outlinePropertyS1->SetAmbientColor(0, 0, 1);
433 // outlinePropertyS1->SetLineWidth(3);
435 // vtkProperty *selectedOutlinePropertyS1 = _boxWidgetS1->GetSelectedOutlineProperty();
436 // selectedOutlinePropertyS1->SetRepresentationToWireframe();
437 // selectedOutlinePropertyS1->SetAmbient(1.0);
438 // selectedOutlinePropertyS1->SetAmbientColor(1, 0, 0);
439 // selectedOutlinePropertyS1->SetLineWidth(3);
443 for (i=0; i< VTKMPRDATA_MAXTISSUE ; i++){
444 GetRenderer()->AddActor( _tissue[i] );
451 // Turn off bone for this example.
452 // _bone->VisibilityOff();
455 // An initial camera view is created. The Dolly() method moves
456 // the camera towards the FocalPoint, thereby enlarging the image.
457 GetRenderer()->SetActiveCamera(GetCamera());
458 GetRenderer()->ResetCamera ();
459 GetCamera()->Dolly(1.5);
461 // Set a background color for the renderer and set the size of the
462 // render window (expressed in pixels).
463 GetRenderer()->SetBackground(1,1,1);
464 GetRenWin()->SetSize(400, 400);
466 // Note that when camera movement occurs (as it does in the Dolly()
467 // method), the clipping planes often need adjusting. Clipping planes
468 // consist of two planes: near and far along the view direction. The
469 // near plane clips out objects in front of the plane; the far plane
470 // clips out objects behind the plane. This way only what is drawn
471 // between the planes is actually rendered.
472 GetRenderer()->ResetCameraClippingRange();
477 //-------------------------------------------------------------------
478 void wxVtkMPR3DView::VisibleActor(int idTissue, bool visTissue, bool visGuide){
479 if (visTissue!=GetVisibleTissue(idTissue)){
480 if (visTissue==false){
481 GetRenderer()->RemoveActor( GetTissueActor(idTissue) );
483 GetRenderer()->AddActor( GetTissueActor(idTissue) );
485 SetVisibleTissue(idTissue,visTissue);
495 //-------------------------------------------------------------------
496 void wxVtkMPR3DView::VisibleImageActor(int idPosition, bool visible){
497 vtkMPR3DData *vtkmpr3Ddata = (vtkMPR3DData*)GetVtkmprbasedata();
498 if (visible!=vtkmpr3Ddata->GetVisiblePosition(idPosition)){
500 GetRenderer()->RemoveActor( vtkmpr3Ddata->GetImageActor(idPosition) );
502 GetRenderer()->AddActor( vtkmpr3Ddata->GetImageActor(idPosition) );
504 vtkmpr3Ddata->SetVisiblePosition(idPosition,visible);
508 //-------------------------------------------------------------------
510 void wxVtkMPR3DView::VisibleVolumeActor( bool visVolume,bool visGuide){
511 vtkMPR3DData *vtkmpr3Ddata = (vtkMPR3DData*)GetVtkmprbasedata();
512 if (visVolume!=_visibleVolume){
513 if (visVolume==false){
514 GetRenderer()->RemoveActor( vtkmpr3Ddata->GetVolumeActor() );
516 GetRenderer()->AddActor( vtkmpr3Ddata->GetVolumeActor() );
518 _visibleVolume=visVolume;
529 //-------------------------------------------------------------------
530 //-------------------------------------------------------------------
531 //-------------------------------------------------------------------
535 wxSurfaceMPR::wxSurfaceMPR(wxWindow *parent, vtkImageData *imagedata, const wxString& title)
536 : wxFrame( parent, -1, title) {
538 _vtkmpr3Ddata = new vtkMPR3DData();
539 _vtkmpr3Ddata->SetImageData(imagedata);
541 wxPanel *MPRPanel = CreateMPRPanel(this,_vtkmpr3Ddata);
542 wxPanel *controlPanel = CreateControlPanel(this);
544 wxFlexGridSizer *sizer = new wxFlexGridSizer(2);
545 sizer->Add(MPRPanel );
546 sizer->Add(controlPanel );
547 this->SetSizer(sizer);
548 this->SetAutoLayout(true);
549 this->SetSize(800,900);
552 //-------------------------------------------------------------------
553 wxPanel* wxSurfaceMPR::CreateMPRPanel(wxWindow *parent, vtkMPR3DData *vtkmpr3Ddata){
554 wxPanel *panel=new wxPanel(parent,-1);
556 _vtkmprview[1] = new wxVtkMPR3DView(panel);
557 _vtkmprview[1]->SetVtkmprbasedata(vtkmpr3Ddata);
558 wxVTKRenderWindowInteractor *iren1 = _vtkmprview[1]->GetWxVTKRenderWindowInteractor();
560 _vtkmprview[2] = new wxVtkMPR3DView(panel);
561 _vtkmprview[2]->SetVtkmprbasedata(vtkmpr3Ddata);
562 wxVTKRenderWindowInteractor *iren2 = _vtkmprview[2]->GetWxVTKRenderWindowInteractor();
564 _vtkmprview[3] = new wxVtkMPR3DView(panel);
565 _vtkmprview[3]->SetVtkmprbasedata(vtkmpr3Ddata);
566 wxVTKRenderWindowInteractor *iren3 = _vtkmprview[3]->GetWxVTKRenderWindowInteractor();
568 _vtkmprview[0] = new wxVtkMPR3DView(panel);
569 _vtkmprview[0]->SetVtkmprbasedata(vtkmpr3Ddata);
570 wxVTKRenderWindowInteractor *iren0 = _vtkmprview[0]->GetWxVTKRenderWindowInteractor();
572 wxBoxSizer *sizerV = new wxBoxSizer(wxVERTICAL);
573 wxBoxSizer *sizerH1= new wxBoxSizer(wxHORIZONTAL);
574 wxBoxSizer *sizerH2= new wxBoxSizer(wxHORIZONTAL);
575 sizerH1->Add(iren0 , 1, wxEXPAND, 0);
577 sizerH1->Add(iren1 , 1, wxEXPAND, 0);
578 sizerH2->Add(iren2 , 1, wxEXPAND, 0);
579 sizerH2->Add(iren3 , 1, wxEXPAND, 0);
581 sizerV->Add(sizerH1, 1, wxEXPAND, 0);
582 sizerV->Add(sizerH2, 1, wxEXPAND, 0);
584 panel->SetAutoLayout(true);
585 panel->SetSizer(sizerV);
586 panel->SetSize(900,900);
593 //-------------------------------------------------------------------
595 wxPanel* wxSurfaceMPR::CreateControlPanel(wxWindow *parent){
596 wxPanel *panel=new wxPanel(parent,-1);
599 wxPanel *panel1 =new wxPanel(panel,-1);
600 wxStaticText *text_space1 = new wxStaticText(panel1,-1," ");
601 wxStaticText *text1_box1 = new wxStaticText(panel1,-1,"x ");
602 wxStaticText *text2_box1 = new wxStaticText(panel1,-1,"y ");
603 wxStaticText *text3_box1 = new wxStaticText(panel1,-1,"z ");
604 _sl1_box1 = new wxSlider( panel1, -1, 0, 0, _vtkmpr3Ddata->GetMaxPositionX(), wxDefaultPosition, wxDefaultSize, wxSL_HORIZONTAL | wxSL_LABELS );
605 _sl2_box1 = new wxSlider( panel1, -1, 0, 0, _vtkmpr3Ddata->GetMaxPositionY(), wxDefaultPosition, wxDefaultSize, wxSL_HORIZONTAL | wxSL_LABELS );
606 _sl3_box1 = new wxSlider( panel1, -1, 0, 0, _vtkmpr3Ddata->GetMaxPositionZ(), wxDefaultPosition, wxDefaultSize, wxSL_HORIZONTAL | wxSL_LABELS );
608 _sl1_box1->SetSize(250,20);
609 _sl2_box1->SetSize(250,20);
610 _sl3_box1->SetSize(250,20);
612 wxFlexGridSizer *sizerBox1 = new wxFlexGridSizer(3);
614 sizerBox1->Add(text_space1);
615 sizerBox1->Add(text1_box1);
616 sizerBox1->Add( _sl1_box1);
618 sizerBox1->Add(text_space1);
619 sizerBox1->Add(text2_box1);
620 sizerBox1->Add( _sl2_box1);
622 sizerBox1->Add(text_space1);
623 sizerBox1->Add(text3_box1);
624 sizerBox1->Add( _sl3_box1);
625 panel1->SetSizer(sizerBox1);
626 panel1->SetAutoLayout(true);
627 panel1->SetSize(250,80);
631 wxPanel *panel2 =new wxPanel(panel,-1);
632 wxStaticText *text_space2 = new wxStaticText(panel2,-1," ");
633 wxStaticText *text_ = new wxStaticText(panel2,-1," ");
634 _btnA = new wxButton(panel2,-1,"A");
635 _btnB = new wxButton(panel2,-1,"B");
636 _btnC = new wxButton(panel2,-1,"C");
637 _btnD = new wxButton(panel2,-1,"D");
638 _text_A = new wxStaticText(panel2,-1,"000000");
639 _text_B = new wxStaticText(panel2,-1,"000000");
640 _text_C = new wxStaticText(panel2,-1,"000000");
641 _text_D = new wxStaticText(panel2,-1,"000000");
642 wxStaticText *text_A = new wxStaticText(panel2,-1,"A ");
643 wxStaticText *text_B = new wxStaticText(panel2,-1,"B ");
644 wxStaticText *text_C = new wxStaticText(panel2,-1,"C ");
645 wxStaticText *text_D = new wxStaticText(panel2,-1,"D ");
646 _slA1_box2 = new wxSlider( panel2, -1, 0, 0, 100, wxDefaultPosition, wxDefaultSize, wxSL_HORIZONTAL | wxSL_LABELS );
647 _slA2_box2 = new wxSlider( panel2, -1, 0, 0, 60, wxDefaultPosition, wxDefaultSize, wxSL_HORIZONTAL );
648 _slA3_box2 = new wxSlider( panel2, -1, 0, 0, 50, wxDefaultPosition, wxDefaultSize, wxSL_HORIZONTAL );
649 _slB1_box2 = new wxSlider( panel2, -1, 0, 0, 100, wxDefaultPosition, wxDefaultSize, wxSL_HORIZONTAL | wxSL_LABELS );
650 _slB2_box2 = new wxSlider( panel2, -1, 0, 0, 60, wxDefaultPosition, wxDefaultSize, wxSL_HORIZONTAL );
651 _slB3_box2 = new wxSlider( panel2, -1, 0, 0, 50, wxDefaultPosition, wxDefaultSize, wxSL_HORIZONTAL );
652 _slC1_box2 = new wxSlider( panel2, -1, 0, 0, 100, wxDefaultPosition, wxDefaultSize, wxSL_HORIZONTAL | wxSL_LABELS );
653 _slC2_box2 = new wxSlider( panel2, -1, 0, 0, 60, wxDefaultPosition, wxDefaultSize, wxSL_HORIZONTAL );
654 _slC3_box2 = new wxSlider( panel2, -1, 0, 0, 50, wxDefaultPosition, wxDefaultSize, wxSL_HORIZONTAL );
655 _slD1_box2 = new wxSlider( panel2, -1, 0, 0, 100, wxDefaultPosition, wxDefaultSize, wxSL_HORIZONTAL | wxSL_LABELS );
656 _slD2_box2 = new wxSlider( panel2, -1, 0, 0, 60, wxDefaultPosition, wxDefaultSize, wxSL_HORIZONTAL );
657 _slD3_box2 = new wxSlider( panel2, -1, 0, 0, 50, wxDefaultPosition, wxDefaultSize, wxSL_HORIZONTAL );
659 _chk1_box1 = new wxCheckBox(panel2, -1, "Visible X");
660 _chk2_box1 = new wxCheckBox(panel2, -1, "Visible Y");
661 _chk3_box1 = new wxCheckBox(panel2, -1, "Visible Z");
663 _chkA_box2 = new wxCheckBox(panel2, -1, "Vis.");
664 _chkB_box2 = new wxCheckBox(panel2, -1, "Vis.");
665 _chkC_box2 = new wxCheckBox(panel2, -1, "Vis.");
666 _chkD_box2 = new wxCheckBox(panel2, -1, "Vis.");
667 _chkAA_box2 = new wxCheckBox(panel2, -1, ".");
668 _chkBB_box2 = new wxCheckBox(panel2, -1, ".");
669 _chkCC_box2 = new wxCheckBox(panel2, -1, ".");
670 _chkDD_box2 = new wxCheckBox(panel2, -1, ".");
671 _chkViewA_box2 = new wxCheckBox(panel2, -1, "A");
672 _chkViewB_box2 = new wxCheckBox(panel2, -1, "B");
673 _chkViewC_box2 = new wxCheckBox(panel2, -1, "C");
674 _chkViewD_box2 = new wxCheckBox(panel2, -1, "D");
676 _chk1_box1->SetValue(true);
677 _chk2_box1->SetValue(true);
678 _chk3_box1->SetValue(true);
679 _chkA_box2->SetValue(true);
680 _chkB_box2->SetValue(true);
681 _chkC_box2->SetValue(true);
682 _chkD_box2->SetValue(true);
683 _chkAA_box2->SetValue(true);
684 _chkBB_box2->SetValue(true);
685 _chkCC_box2->SetValue(true);
686 _chkDD_box2->SetValue(true);
687 _chkViewA_box2->SetValue(true);
688 _chkViewB_box2->SetValue(true);
689 _chkViewC_box2->SetValue(true);
690 _chkViewD_box2->SetValue(true);
692 _slA1_box2->SetSize(250,20);
693 _slA2_box2->SetSize(150,20);
694 _slA3_box2->SetSize(150,20);
695 _slB1_box2->SetSize(250,20);
696 _slB2_box2->SetSize(150,20);
697 _slB3_box2->SetSize(150,20);
698 _slC1_box2->SetSize(250,20);
699 _slC2_box2->SetSize(150,20);
700 _slC3_box2->SetSize(150,20);
701 _slD1_box2->SetSize(250,20);
702 _slD2_box2->SetSize(150,20);
703 _slD3_box2->SetSize(150,20);
704 _btnA->SetSize(20,20);
705 _btnB->SetSize(20,20);
706 _btnC->SetSize(20,20);
707 _btnD->SetSize(20,20);
709 _btnA->SetBackgroundColour( *(_vtkmpr3Ddata->GetColour(0)) );
710 _btnB->SetBackgroundColour( *(_vtkmpr3Ddata->GetColour(1)) );
711 _btnC->SetBackgroundColour( *(_vtkmpr3Ddata->GetColour(2)) );
712 _btnD->SetBackgroundColour( *(_vtkmpr3Ddata->GetColour(3)) );
715 wxFlexGridSizer *sizerPanel2A = new wxFlexGridSizer(5);
717 sizerPanel2A->Add(text_space2);
718 sizerPanel2A->Add(text_A);
719 sizerPanel2A->Add(_slA2_box2);
720 sizerPanel2A->Add(_slA3_box2);
721 sizerPanel2A->Add(_text_A);
723 sizerPanel2A->Add(text_space2);
724 sizerPanel2A->Add(text_B);
725 sizerPanel2A->Add(_slB2_box2);
726 sizerPanel2A->Add(_slB3_box2);
727 sizerPanel2A->Add(_text_B);
729 sizerPanel2A->Add(text_space2);
730 sizerPanel2A->Add(text_C);
731 sizerPanel2A->Add(_slC2_box2);
732 sizerPanel2A->Add(_slC3_box2);
733 sizerPanel2A->Add(_text_C);
735 sizerPanel2A->Add(text_space2);
736 sizerPanel2A->Add(text_D);
737 sizerPanel2A->Add(_slD2_box2);
738 sizerPanel2A->Add(_slD3_box2);
739 sizerPanel2A->Add(_text_D);
742 wxFlexGridSizer *sizerPanel2B = new wxFlexGridSizer(5);
744 sizerPanel2B->Add(text_space2);
745 sizerPanel2B->Add(_btnA);
746 sizerPanel2B->Add(_slA1_box2);
747 sizerPanel2B->Add(_chkA_box2);
748 sizerPanel2B->Add(_chkAA_box2);
750 sizerPanel2B->Add(text_space2);
751 sizerPanel2B->Add(_btnB);
752 sizerPanel2B->Add(_slB1_box2);
753 sizerPanel2B->Add(_chkB_box2);
754 sizerPanel2B->Add(_chkBB_box2);
756 sizerPanel2B->Add(text_space2);
757 sizerPanel2B->Add(_btnC);
758 sizerPanel2B->Add(_slC1_box2);
759 sizerPanel2B->Add(_chkC_box2);
760 sizerPanel2B->Add(_chkCC_box2);
762 sizerPanel2B->Add(text_space2);
763 sizerPanel2B->Add(_btnD);
764 sizerPanel2B->Add(_slD1_box2);
765 sizerPanel2B->Add(_chkD_box2);
766 sizerPanel2B->Add(_chkDD_box2);
768 wxFlexGridSizer *sizerPanel2C = new wxFlexGridSizer(4);
769 sizerPanel2C->Add(_chkViewA_box2);
770 sizerPanel2C->Add(_chkViewB_box2);
771 sizerPanel2C->Add(_chkViewC_box2);
772 sizerPanel2C->Add(_chkViewD_box2);
774 wxFlexGridSizer *sizerPanel2D = new wxFlexGridSizer(2);
775 sizerPanel2D->Add(text_space2);
776 sizerPanel2D->Add(_chk1_box1);
777 sizerPanel2D->Add(text_space2);
778 sizerPanel2D->Add(_chk2_box1);
779 sizerPanel2D->Add(text_space2);
780 sizerPanel2D->Add(_chk3_box1);
782 wxFlexGridSizer *sizerPanel2 = new wxFlexGridSizer(1);
783 sizerPanel2->Add(sizerPanel2A);
784 sizerPanel2->Add(text_space2);
785 sizerPanel2->Add(sizerPanel2C);
786 sizerPanel2->Add(text_space2);
787 sizerPanel2->Add(sizerPanel2D);
788 sizerPanel2->Add(text_space2);
789 sizerPanel2->Add(sizerPanel2B);
791 panel2->SetSizer(sizerPanel2);
792 panel2->SetAutoLayout(true);
793 panel2->SetSize(350,320);
796 wxPanel *panel3 = new wxPanel(panel,-1);
797 wxStaticText *text_space3 = new wxStaticText(panel3,-1," ");
798 _chk_box3 = new wxCheckBox(panel3, -1, "Vis.");
799 _chk_box33 = new wxCheckBox(panel3, -1, "Vis.");
800 _chk_box3->SetValue(true);
801 _chk_box33->SetValue(true);
802 wxFlexGridSizer *sizerPanel3 = new wxFlexGridSizer(3);
804 sizerPanel3->Add(text_space3);
805 sizerPanel3->Add(_chk_box3);
806 sizerPanel3->Add(_chk_box33);
807 panel3->SetSizer(sizerPanel3);
808 panel3->SetAutoLayout(true);
809 panel3->SetSize(250,100);
811 // _sl1_box3 = new wxSlider( panel3, -1, 0, 0, 100, wxDefaultPosition, wxDefaultSize, wxSL_HORIZONTAL | wxSL_LABELS );
812 // _sl2_box3 = new wxSlider( panel3, -1, 0, 0, 100, wxDefaultPosition, wxDefaultSize, wxSL_HORIZONTAL | wxSL_LABELS );
813 // _sl3_box3 = new wxSlider( panel3, -1, 0, 0, 100, wxDefaultPosition, wxDefaultSize, wxSL_HORIZONTAL | wxSL_LABELS );
814 // wxStaticText *text1_box3 = new wxStaticText(panel3,-1,"A");
815 // wxStaticText *text2_box3 = new wxStaticText(panel3,-1,"B");
816 // wxStaticText *text3_box3 = new wxStaticText(panel3,-1,"Dist");
817 // wxFlexGridSizer *sizerPanel3 = new wxFlexGridSizer(3);
819 // sizerPanel3->Add(text_space3);
820 // sizerPanel3->Add(_chk_box3);
821 // sizerPanel3->Add(text_space3);
823 // sizerPanel3->Add(text_space3);
824 // sizerPanel3->Add(text1_box3);
825 // sizerPanel3->Add(_sl1_box3);
827 // sizerPanel3->Add(text_space3);
828 // sizerPanel3->Add(text2_box3);
829 // sizerPanel3->Add(_sl2_box3);
831 // sizerPanel3->Add(text_space3);
832 // sizerPanel3->Add(text3_box3);
833 // sizerPanel3->Add(_sl3_box3);
834 // panel3->SetSizer(sizerPanel3);
835 // panel3->SetAutoLayout(true);
836 // panel3->SetSize(250,100);
839 // wxPanel *panel4 = new wxPanel(panel,-1);
840 // _chk_box4 = new wxCheckBox(panel4, -1, "Vis.");
841 // _slA_box4 = new wxSlider( panel4, -1, 0, 0, 100, wxDefaultPosition, wxDefaultSize, wxSL_HORIZONTAL | wxSL_LABELS );
842 // _slB_box4 = new wxSlider( panel4, -1, 0, 0, 100, wxDefaultPosition, wxDefaultSize, wxSL_HORIZONTAL | wxSL_LABELS );
843 // _sl1_box4 = new wxSlider( panel4, -1, 0, 0, 100, wxDefaultPosition, wxDefaultSize, wxSL_HORIZONTAL | wxSL_LABELS );
844 // _sl2_box4 = new wxSlider( panel4, -1, 0, 0, 100, wxDefaultPosition, wxDefaultSize, wxSL_HORIZONTAL | wxSL_LABELS );
845 // _sl3_box4 = new wxSlider( panel4, -1, 0, 0, 100, wxDefaultPosition, wxDefaultSize, wxSL_HORIZONTAL | wxSL_LABELS );
846 // _sl4_box4 = new wxSlider( panel4, -1, 0, 0, 100, wxDefaultPosition, wxDefaultSize, wxSL_HORIZONTAL | wxSL_LABELS );
847 // _sl5_box4 = new wxSlider( panel4, -1, 0, 0, 100, wxDefaultPosition, wxDefaultSize, wxSL_HORIZONTAL | wxSL_LABELS );
848 // _sl6_box4 = new wxSlider( panel4, -1, 0, 0, 100, wxDefaultPosition, wxDefaultSize, wxSL_HORIZONTAL | wxSL_LABELS );
849 // wxStaticText *text_space4 = new wxStaticText(panel3,-1," ");
850 // wxStaticText *textA_box4 = new wxStaticText(panel4,-1,"A");
851 // wxStaticText *textB_box4 = new wxStaticText(panel4,-1,"B");
852 // wxStaticText *text1_box4 = new wxStaticText(panel4,-1,"D1");
853 // wxStaticText *text2_box4 = new wxStaticText(panel4,-1,"D2");
854 // wxStaticText *text3_box4 = new wxStaticText(panel4,-1,"D3");
855 // wxStaticText *text4_box4 = new wxStaticText(panel4,-1,"D4");
856 // wxStaticText *text5_box4 = new wxStaticText(panel4,-1,"D5");
857 // wxStaticText *text6_box4 = new wxStaticText(panel4,-1,"D6");
858 // wxFlexGridSizer *sizerPanel4 = new wxFlexGridSizer(3);
860 // sizerPanel4->Add(text_space4);
861 // sizerPanel4->Add(_chk_box4);
862 // sizerPanel4->Add(text_space4);
864 // sizerPanel4->Add(text_space4);
865 // sizerPanel4->Add(textA_box4);
866 // sizerPanel4->Add(_slA_box4);
868 // sizerPanel4->Add(text_space4);
869 // sizerPanel4->Add(textB_box4);
870 // sizerPanel4->Add(_slB_box4);
872 // sizerPanel4->Add(text_space4);
873 // sizerPanel4->Add(text1_box4);
874 // sizerPanel4->Add(_sl1_box4);
876 // sizerPanel4->Add(text_space4);
877 // sizerPanel4->Add(text2_box4);
878 // sizerPanel4->Add(_sl2_box4);
880 // sizerPanel4->Add(text_space4);
881 // sizerPanel4->Add(text3_box4);
882 // sizerPanel4->Add(_sl3_box4);
884 // sizerPanel4->Add(text_space4);
885 // sizerPanel4->Add(text4_box4);
886 // sizerPanel4->Add(_sl4_box4);
888 // sizerPanel4->Add(text_space4);
889 // sizerPanel4->Add(text5_box4);
890 // sizerPanel4->Add(_sl5_box4);
892 // sizerPanel4->Add(text_space4);
893 // sizerPanel4->Add(text6_box4);
894 // sizerPanel4->Add(_sl6_box4);
896 // panel4->SetSizer(sizerPanel4);
897 // panel4->SetAutoLayout(true);
898 // panel4->SetSize(250,300);
903 wxFlexGridSizer *sizer = new wxFlexGridSizer(1);
905 sizer->Add(new wxStaticText(panel,-1,"Position") );
907 sizer->Add(new wxStaticText(panel,-1,"Layer") );
909 sizer->Add(new wxStaticText(panel,-1,"Cut 1") );
911 // sizer->Add(new wxStaticText(panel,-1,"Cut 2") );
912 // sizer->Add(panel4);
914 panel->SetSizer(sizer);
915 panel->SetAutoLayout(true);
916 panel->SetSize(350,750);
920 Connect(_sl1_box1->GetId() , wxEVT_COMMAND_SLIDER_UPDATED , (wxObjectEventFunction) &wxSurfaceMPR::OnPositionX );
921 Connect(_sl2_box1->GetId() , wxEVT_COMMAND_SLIDER_UPDATED , (wxObjectEventFunction) &wxSurfaceMPR::OnPositionY );
922 Connect(_sl3_box1->GetId() , wxEVT_COMMAND_SLIDER_UPDATED , (wxObjectEventFunction) &wxSurfaceMPR::OnPositionZ );
923 Connect(_chk1_box1->GetId() , wxEVT_COMMAND_CHECKBOX_CLICKED, (wxObjectEventFunction) &wxSurfaceMPR::OnVisibleX );
924 Connect(_chk2_box1->GetId() , wxEVT_COMMAND_CHECKBOX_CLICKED, (wxObjectEventFunction) &wxSurfaceMPR::OnVisibleY );
925 Connect(_chk3_box1->GetId() , wxEVT_COMMAND_CHECKBOX_CLICKED, (wxObjectEventFunction) &wxSurfaceMPR::OnVisibleZ );
929 Connect(_slA1_box2->GetId() , wxEVT_SCROLL_THUMBRELEASE , (wxObjectEventFunction) &wxSurfaceMPR::OnOpacity0 );
930 Connect(_slB1_box2->GetId() , wxEVT_SCROLL_THUMBRELEASE , (wxObjectEventFunction) &wxSurfaceMPR::OnOpacity1 );
931 Connect(_slC1_box2->GetId() , wxEVT_SCROLL_THUMBRELEASE , (wxObjectEventFunction) &wxSurfaceMPR::OnOpacity2 );
932 Connect(_slD1_box2->GetId() , wxEVT_SCROLL_THUMBRELEASE , (wxObjectEventFunction) &wxSurfaceMPR::OnOpacity3 );
933 Connect(_btnA->GetId() , wxEVT_COMMAND_BUTTON_CLICKED , (wxObjectEventFunction) &wxSurfaceMPR::OnBtnColourA );
934 Connect(_btnB->GetId() , wxEVT_COMMAND_BUTTON_CLICKED , (wxObjectEventFunction) &wxSurfaceMPR::OnBtnColourB );
935 Connect(_btnC->GetId() , wxEVT_COMMAND_BUTTON_CLICKED , (wxObjectEventFunction) &wxSurfaceMPR::OnBtnColourC );
936 Connect(_btnD->GetId() , wxEVT_COMMAND_BUTTON_CLICKED , (wxObjectEventFunction) &wxSurfaceMPR::OnBtnColourD );
941 Connect(_slA2_box2->GetId() , wxEVT_SCROLL_THUMBRELEASE , (wxObjectEventFunction) &wxSurfaceMPR::OnIsoValue0 );
942 Connect(_slA3_box2->GetId() , wxEVT_SCROLL_THUMBRELEASE , (wxObjectEventFunction) &wxSurfaceMPR::OnIsoValue0 );
943 Connect(_slB2_box2->GetId() , wxEVT_SCROLL_THUMBRELEASE , (wxObjectEventFunction) &wxSurfaceMPR::OnIsoValue1 );
944 Connect(_slB3_box2->GetId() , wxEVT_SCROLL_THUMBRELEASE , (wxObjectEventFunction) &wxSurfaceMPR::OnIsoValue1 );
945 Connect(_slC2_box2->GetId() , wxEVT_SCROLL_THUMBRELEASE , (wxObjectEventFunction) &wxSurfaceMPR::OnIsoValue2 );
946 Connect(_slC3_box2->GetId() , wxEVT_SCROLL_THUMBRELEASE , (wxObjectEventFunction) &wxSurfaceMPR::OnIsoValue2 );
947 Connect(_slD2_box2->GetId() , wxEVT_SCROLL_THUMBRELEASE , (wxObjectEventFunction) &wxSurfaceMPR::OnIsoValue3 );
948 Connect(_slD3_box2->GetId() , wxEVT_SCROLL_THUMBRELEASE , (wxObjectEventFunction) &wxSurfaceMPR::OnIsoValue3 );
949 Connect(_slA2_box2->GetId() , wxEVT_COMMAND_SLIDER_UPDATED , (wxObjectEventFunction) &wxSurfaceMPR::OnIsoValue_0 );
950 Connect(_slA3_box2->GetId() , wxEVT_COMMAND_SLIDER_UPDATED , (wxObjectEventFunction) &wxSurfaceMPR::OnIsoValue_0 );
951 Connect(_slB2_box2->GetId() , wxEVT_COMMAND_SLIDER_UPDATED , (wxObjectEventFunction) &wxSurfaceMPR::OnIsoValue_1 );
952 Connect(_slB3_box2->GetId() , wxEVT_COMMAND_SLIDER_UPDATED , (wxObjectEventFunction) &wxSurfaceMPR::OnIsoValue_1 );
953 Connect(_slC2_box2->GetId() , wxEVT_COMMAND_SLIDER_UPDATED , (wxObjectEventFunction) &wxSurfaceMPR::OnIsoValue_2 );
954 Connect(_slC3_box2->GetId() , wxEVT_COMMAND_SLIDER_UPDATED , (wxObjectEventFunction) &wxSurfaceMPR::OnIsoValue_2 );
955 Connect(_slD2_box2->GetId() , wxEVT_COMMAND_SLIDER_UPDATED , (wxObjectEventFunction) &wxSurfaceMPR::OnIsoValue_3 );
956 Connect(_slD3_box2->GetId() , wxEVT_COMMAND_SLIDER_UPDATED , (wxObjectEventFunction) &wxSurfaceMPR::OnIsoValue_3 );
958 Connect(_chkA_box2->GetId() , wxEVT_COMMAND_CHECKBOX_CLICKED, (wxObjectEventFunction) &wxSurfaceMPR::OnVisibleTissueA );
959 Connect(_chkB_box2->GetId() , wxEVT_COMMAND_CHECKBOX_CLICKED, (wxObjectEventFunction) &wxSurfaceMPR::OnVisibleTissueB );
960 Connect(_chkC_box2->GetId() , wxEVT_COMMAND_CHECKBOX_CLICKED, (wxObjectEventFunction) &wxSurfaceMPR::OnVisibleTissueC );
961 Connect(_chkD_box2->GetId() , wxEVT_COMMAND_CHECKBOX_CLICKED, (wxObjectEventFunction) &wxSurfaceMPR::OnVisibleTissueD );
962 Connect(_chkAA_box2->GetId() , wxEVT_COMMAND_CHECKBOX_CLICKED, (wxObjectEventFunction) &wxSurfaceMPR::OnVisibleTissueA );
963 Connect(_chkBB_box2->GetId() , wxEVT_COMMAND_CHECKBOX_CLICKED, (wxObjectEventFunction) &wxSurfaceMPR::OnVisibleTissueB );
964 Connect(_chkCC_box2->GetId() , wxEVT_COMMAND_CHECKBOX_CLICKED, (wxObjectEventFunction) &wxSurfaceMPR::OnVisibleTissueC );
965 Connect(_chkDD_box2->GetId() , wxEVT_COMMAND_CHECKBOX_CLICKED, (wxObjectEventFunction) &wxSurfaceMPR::OnVisibleTissueD );
967 Connect(_chk_box3->GetId() , wxEVT_COMMAND_CHECKBOX_CLICKED, (wxObjectEventFunction) &wxSurfaceMPR::OnVisibleVolume );
968 Connect(_chk_box33->GetId() , wxEVT_COMMAND_CHECKBOX_CLICKED, (wxObjectEventFunction) &wxSurfaceMPR::OnVisibleVolume );
979 //------------------------------------------------------------------------
981 void wxSurfaceMPR::Refresh(){
982 _vtkmprview[0]->Refresh();
983 _vtkmprview[1]->Refresh();
984 _vtkmprview[2]->Refresh();
985 _vtkmprview[3]->Refresh();
989 //------------------------------------------------------------------------
990 void wxSurfaceMPR::OnPositionX(wxScrollEvent& event){
991 _vtkmpr3Ddata->SetPositionX( _sl1_box1->GetValue() );
994 //------------------------------------------------------------------------
995 void wxSurfaceMPR::OnPositionY(wxScrollEvent& event){
996 _vtkmpr3Ddata->SetPositionY( _sl2_box1->GetValue() );
999 //------------------------------------------------------------------------
1000 void wxSurfaceMPR::OnPositionZ(wxScrollEvent& event){
1001 _vtkmpr3Ddata->SetPositionZ( _sl3_box1->GetValue() );
1004 //------------------------------------------------------------------------
1005 void wxSurfaceMPR::OpacityTissue(int idView, int idTissue, int opacity){
1007 tmpActor = _vtkmprview[ idView ]->GetTissueActor(idTissue);
1008 tmpActor->GetProperty()->SetOpacity((float) opacity/100 );
1009 _vtkmprview[idView]->Refresh();
1011 //------------------------------------------------------------------------
1012 void wxSurfaceMPR::OnOpacity0(wxScrollEvent& event){
1013 int opacity = _slA1_box2->GetValue();
1014 if (_chkViewA_box2->GetValue()==true){OpacityTissue(0,0, opacity ); }
1015 if (_chkViewB_box2->GetValue()==true){OpacityTissue(1,0, opacity ); }
1016 if (_chkViewC_box2->GetValue()==true){OpacityTissue(2,0, opacity ); }
1017 if (_chkViewD_box2->GetValue()==true){OpacityTissue(3,0, opacity ); }
1019 //------------------------------------------------------------------------
1020 void wxSurfaceMPR::OnOpacity1(wxScrollEvent& event){
1021 int opacity = _slB1_box2->GetValue();
1022 if (_chkViewA_box2->GetValue()==true){OpacityTissue(0,1, opacity ); }
1023 if (_chkViewB_box2->GetValue()==true){OpacityTissue(1,1, opacity ); }
1024 if (_chkViewC_box2->GetValue()==true){OpacityTissue(2,1, opacity ); }
1025 if (_chkViewD_box2->GetValue()==true){OpacityTissue(3,1, opacity ); }
1027 //------------------------------------------------------------------------
1028 void wxSurfaceMPR::OnOpacity2(wxScrollEvent& event){
1029 int opacity = _slC1_box2->GetValue();
1030 if (_chkViewA_box2->GetValue()==true){OpacityTissue(0,2, opacity ); }
1031 if (_chkViewB_box2->GetValue()==true){OpacityTissue(1,2, opacity ); }
1032 if (_chkViewC_box2->GetValue()==true){OpacityTissue(2,2, opacity ); }
1033 if (_chkViewD_box2->GetValue()==true){OpacityTissue(3,2, opacity ); }
1035 //------------------------------------------------------------------------
1036 void wxSurfaceMPR::OnOpacity3(wxScrollEvent& event){
1037 int opacity = _slD1_box2->GetValue();
1038 if (_chkViewA_box2->GetValue()==true){OpacityTissue(0,3, opacity ); }
1039 if (_chkViewB_box2->GetValue()==true){OpacityTissue(1,3, opacity ); }
1040 if (_chkViewC_box2->GetValue()==true){OpacityTissue(2,3, opacity ); }
1041 if (_chkViewD_box2->GetValue()==true){OpacityTissue(3,3, opacity ); }
1043 //------------------------------------------------------------------------
1044 void wxSurfaceMPR::OnIsoValue0(wxScrollEvent& event){
1045 int isoValue=_slA2_box2->GetValue() * 50 + _slA3_box2->GetValue();
1046 _vtkmpr3Ddata->SetIsovalue(0,isoValue);
1048 tmpStr.Printf("%d",isoValue);
1049 _text_A->SetLabel(tmpStr);
1052 //------------------------------------------------------------------------
1053 void wxSurfaceMPR::OnIsoValue1(wxScrollEvent& event){
1054 int isoValue=_slB2_box2->GetValue() * 50 + _slB3_box2->GetValue();
1055 _vtkmpr3Ddata->SetIsovalue(1,isoValue);
1057 tmpStr.Printf("%d",isoValue);
1058 _text_B->SetLabel(tmpStr);
1061 //------------------------------------------------------------------------
1062 void wxSurfaceMPR::OnIsoValue2(wxScrollEvent& event){
1063 int isoValue=_slC2_box2->GetValue() * 50 + _slC3_box2->GetValue();
1064 _vtkmpr3Ddata->SetIsovalue(2,isoValue);
1066 tmpStr.Printf("%d",isoValue);
1067 _text_C->SetLabel(tmpStr);
1070 //------------------------------------------------------------------------
1071 void wxSurfaceMPR::OnIsoValue3(wxScrollEvent& event){
1072 int isoValue=_slD2_box2->GetValue() * 50 + _slD3_box2->GetValue();
1073 _vtkmpr3Ddata->SetIsovalue(3,isoValue);
1075 tmpStr.Printf("%d",isoValue);
1076 _text_D->SetLabel(tmpStr);
1082 //------------------------------------------------------------------------
1083 void wxSurfaceMPR::OnIsoValue_0(wxScrollEvent& event){
1084 int isoValue=_slA2_box2->GetValue() * 50 + _slA3_box2->GetValue();
1086 tmpStr.Printf("%d",isoValue);
1087 _text_A->SetLabel(tmpStr);
1089 //------------------------------------------------------------------------
1090 void wxSurfaceMPR::OnIsoValue_1(wxScrollEvent& event){
1091 int isoValue=_slB2_box2->GetValue() * 50 + _slB3_box2->GetValue();
1093 tmpStr.Printf("%d",isoValue);
1094 _text_B->SetLabel(tmpStr);
1096 //------------------------------------------------------------------------
1097 void wxSurfaceMPR::OnIsoValue_2(wxScrollEvent& event){
1098 int isoValue=_slC2_box2->GetValue() * 50 + _slC3_box2->GetValue();
1100 tmpStr.Printf("%d",isoValue);
1101 _text_C->SetLabel(tmpStr);
1103 //------------------------------------------------------------------------
1104 void wxSurfaceMPR::OnIsoValue_3(wxScrollEvent& event){
1105 int isoValue=_slD2_box2->GetValue() * 50 + _slD3_box2->GetValue();
1107 tmpStr.Printf("%d",isoValue);
1108 _text_D->SetLabel(tmpStr);
1112 //------------------------------------------------------------------------
1113 void wxSurfaceMPR::OnBtnColourA(wxCommandEvent& event){
1114 wxColourDialog dlgColour(this);
1115 dlgColour.ShowModal();
1117 //------------------------------------------------------------------------
1118 void wxSurfaceMPR::OnBtnColourB(wxCommandEvent& event){
1119 wxColourDialog dlgColour(this);
1120 dlgColour.ShowModal();
1122 //------------------------------------------------------------------------
1123 void wxSurfaceMPR::OnBtnColourC(wxCommandEvent& event){
1124 wxColourDialog dlgColour(this);
1125 dlgColour.ShowModal();
1127 //------------------------------------------------------------------------
1128 void wxSurfaceMPR::OnBtnColourD(wxCommandEvent& event){
1129 wxColourDialog dlgColour(this);
1130 dlgColour.ShowModal();
1132 //------------------------------------------------------------------------
1133 void wxSurfaceMPR::VisibleActor(int idView, int idTissue, bool visTissue, bool visGuide){
1134 _vtkmprview[idView]->VisibleActor(idTissue, visTissue, visGuide);
1135 _vtkmprview[idView]->Refresh();
1137 //------------------------------------------------------------------------
1138 void wxSurfaceMPR::VisibleImageActor(int idView, int idTissue, bool visible){
1139 _vtkmprview[idView]->VisibleImageActor(idTissue, visible);
1140 _vtkmprview[idView]->Refresh();
1142 //------------------------------------------------------------------------
1143 void wxSurfaceMPR::OnVisibleX(wxCommandEvent& event){
1144 bool visible = _chk1_box1->GetValue();
1145 if (_chkViewA_box2->GetValue()==true){VisibleImageActor(0,0, visible ); }
1146 if (_chkViewB_box2->GetValue()==true){VisibleImageActor(1,0, visible ); }
1147 if (_chkViewC_box2->GetValue()==true){VisibleImageActor(2,0, visible ); }
1148 if (_chkViewD_box2->GetValue()==true){VisibleImageActor(3,0, visible ); }
1150 //------------------------------------------------------------------------
1151 void wxSurfaceMPR::OnVisibleY(wxCommandEvent& event){
1152 bool visible = _chk2_box1->GetValue();
1153 if (_chkViewA_box2->GetValue()==true){VisibleImageActor(0,1, visible ); }
1154 if (_chkViewB_box2->GetValue()==true){VisibleImageActor(1,1, visible ); }
1155 if (_chkViewC_box2->GetValue()==true){VisibleImageActor(2,1, visible ); }
1156 if (_chkViewD_box2->GetValue()==true){VisibleImageActor(3,1, visible ); }
1158 //------------------------------------------------------------------------
1159 void wxSurfaceMPR::OnVisibleZ(wxCommandEvent& event){
1160 bool visible = _chk3_box1->GetValue();
1161 if (_chkViewA_box2->GetValue()==true){VisibleImageActor(0,2, visible ); }
1162 if (_chkViewB_box2->GetValue()==true){VisibleImageActor(1,2, visible ); }
1163 if (_chkViewC_box2->GetValue()==true){VisibleImageActor(2,2, visible ); }
1164 if (_chkViewD_box2->GetValue()==true){VisibleImageActor(3,2, visible ); }
1166 //------------------------------------------------------------------------
1167 void wxSurfaceMPR::OnVisibleTissueA(wxCommandEvent& event){
1168 bool visiTissue = _chkA_box2->GetValue();
1169 bool visGuide = _chkAA_box2->GetValue();
1170 if (_chkViewA_box2->GetValue()==true){VisibleActor(0,0, visiTissue, visGuide ); }
1171 if (_chkViewB_box2->GetValue()==true){VisibleActor(1,0, visiTissue, visGuide ); }
1172 if (_chkViewC_box2->GetValue()==true){VisibleActor(2,0, visiTissue, visGuide ); }
1173 if (_chkViewD_box2->GetValue()==true){VisibleActor(3,0, visiTissue, visGuide ); }
1175 //------------------------------------------------------------------------
1176 void wxSurfaceMPR::OnVisibleTissueB(wxCommandEvent& event){
1177 bool visiTissue = _chkA_box2->GetValue();
1178 bool visGuide = _chkAA_box2->GetValue();
1179 if (_chkViewA_box2->GetValue()==true){VisibleActor(0,1, visiTissue, visGuide ); }
1180 if (_chkViewB_box2->GetValue()==true){VisibleActor(1,1, visiTissue, visGuide ); }
1181 if (_chkViewC_box2->GetValue()==true){VisibleActor(2,1, visiTissue, visGuide ); }
1182 if (_chkViewD_box2->GetValue()==true){VisibleActor(3,1, visiTissue, visGuide ); }
1184 //------------------------------------------------------------------------
1185 void wxSurfaceMPR::OnVisibleTissueC(wxCommandEvent& event){
1186 bool visiTissue = _chkA_box2->GetValue();
1187 bool visGuide = _chkAA_box2->GetValue();
1188 if (_chkViewA_box2->GetValue()==true){VisibleActor(0,2, visiTissue, visGuide ); }
1189 if (_chkViewB_box2->GetValue()==true){VisibleActor(1,2, visiTissue, visGuide ); }
1190 if (_chkViewC_box2->GetValue()==true){VisibleActor(2,2, visiTissue, visGuide ); }
1191 if (_chkViewD_box2->GetValue()==true){VisibleActor(3,2, visiTissue, visGuide ); }
1193 //------------------------------------------------------------------------
1194 void wxSurfaceMPR::OnVisibleTissueD(wxCommandEvent& event){
1195 bool visiTissue = _chkA_box2->GetValue();
1196 bool visGuide = _chkAA_box2->GetValue();
1197 if (_chkViewA_box2->GetValue()==true){VisibleActor(0,3, visiTissue, visGuide ); }
1198 if (_chkViewB_box2->GetValue()==true){VisibleActor(1,3, visiTissue, visGuide ); }
1199 if (_chkViewC_box2->GetValue()==true){VisibleActor(2,3, visiTissue, visGuide ); }
1200 if (_chkViewD_box2->GetValue()==true){VisibleActor(3,3, visiTissue, visGuide ); }
1202 //------------------------------------------------------------------------
1203 void wxSurfaceMPR::VisibleVolumeActor(int idView, bool visVolume, bool visGuide){
1204 _vtkmprview[idView]->VisibleVolumeActor( visVolume,visGuide);
1205 _vtkmprview[idView]->Refresh();
1207 //------------------------------------------------------------------------
1208 void wxSurfaceMPR::OnVisibleVolume(wxCommandEvent& event){
1209 bool visVolume = _chk_box3->GetValue();
1210 bool visGuide = _chk_box33->GetValue();
1211 if (_chkViewA_box2->GetValue()==true){VisibleVolumeActor(0, visVolume, visGuide); }
1212 if (_chkViewB_box2->GetValue()==true){VisibleVolumeActor(1, visVolume, visGuide); }
1213 if (_chkViewC_box2->GetValue()==true){VisibleVolumeActor(2, visVolume, visGuide); }
1214 if (_chkViewD_box2->GetValue()==true){VisibleVolumeActor(3, visVolume, visGuide); }
1217 //------------------------------------------------------------------------
1218 void wxSurfaceMPR::ConfigureVTK(){
1219 _vtkmprview[0]->Configure();
1220 _vtkmprview[1]->Configure();
1221 _vtkmprview[2]->Configure();
1222 _vtkmprview[3]->Configure();