wxSurfaceMPR.cxx

Go to the documentation of this file.
00001 
00002 #include <vtkPlanes.h>
00003 #include <vtkProperty.h> 
00004 #include <vtkPolyData.h> 
00005 #include <vtkDataSet.h> 
00006 
00007 #include "wxSurfaceMPR.h"
00008 #include <wx/colordlg.h>
00009 
00010 
00011 
00012 //-------------------------------------------------------------------
00013 //-------------------------------------------------------------------
00014 //-------------------------------------------------------------------
00015 
00016 /*
00017 
00018 
00019 void boxVolumeObserver::Execute(vtkObject *wdg, unsigned long eventId, void* calldata) {  // virtual
00020         if (eventId==vtkCommand::StartInteractionEvent){
00021                 _renWin->SetDesiredUpdateRate(10);
00022         }
00023         if (eventId==vtkCommand::InteractionEvent){
00024                 _renWin->SetDesiredUpdateRate(0.001);
00025         }
00026         if (eventId==vtkCommand::EndInteractionEvent){
00027                 vtkPlanes *planes = vtkPlanes::New();
00028                 vtkBoxWidget *boxwidget = reinterpret_cast<vtkBoxWidget*>(wdg);
00029                 boxwidget->GetPlanes(planes);
00030                 _volumeMapper->SetClippingPlanes(planes);
00031                 planes -> Delete();
00032         }
00033 }
00034 //-------------------------------------------------------------------
00035 void boxVolumeObserver::SetRenWin( vtkRenderWindow *renWin ){
00036         _renWin = renWin;
00037 }
00038 //-------------------------------------------------------------------
00039 void boxVolumeObserver::SetVolumeMapper(vtkVolumeRayCastMapper *volumeMapper){
00040         _volumeMapper = volumeMapper;
00041 }
00042 
00043 
00044 //-------------------------------------------------------------------
00045 //-------------------------------------------------------------------
00046 //-------------------------------------------------------------------
00047 
00048 void boxSurfaceObserver::Execute(vtkObject *wdg, unsigned long eventId, void* calldata) {  // virtual
00049         vtkBoxWidget *boxwidget = reinterpret_cast<vtkBoxWidget*>(wdg);
00050         boxwidget->GetPlanes(_planes);
00051         _actor->VisibilityOn();
00052 }
00053 //-------------------------------------------------------------------
00054 void boxSurfaceObserver::SetPlanes(vtkPlanes *planes){
00055         _planes = planes;
00056 }
00057 //-------------------------------------------------------------------
00058 void boxSurfaceObserver::SetActor(vtkActor *actor){
00059         _actor = actor;
00060 }
00061 
00062 */
00063 
00064 //-------------------------------------------------------------------
00065 //-------------------------------------------------------------------
00066 //-------------------------------------------------------------------
00067 
00068 
00069 /*
00070 vtkMPR3DData::vtkMPR3DData()
00071 {
00072         _colour[0]= new wxColour(255,127, 64);
00073         _colour[1]= new wxColour(255,255,250);
00074         _colour[2]= new wxColour(  0,255,000);
00075         _colour[3]= new wxColour(  0,  0,255);
00076         _visiblePosition[0]=true;
00077         _visiblePosition[1]=true;
00078         _visiblePosition[2]=true;
00079 }
00080 //-------------------------------------------------------------------
00081 vtkMPR3DData::~vtkMPR3DData()
00082 {
00083         int i;
00084         for (i=0; i< VTKMPRDATA_MAXTISSUE ; i++){
00085                 _tissueExtractor[i]             ->Delete();
00086                 _tissueNormals[i]               ->Delete();
00087                 _tissueStripper[i]              ->Delete();
00088                 _tissueMapper[i]                ->Delete();
00089                 delete _colour[i];
00090                 _tissuePlanes[i]                ->Delete();
00091                 _tissueClipper[i]               ->Delete();
00092         }
00093         _outlineData            ->Delete();
00094         _mapOutline                     ->Delete();
00095         _outline                        ->Delete();
00096 
00097         // Volume
00098         _tfun                           ->Delete();
00099         _ctfun                          ->Delete();
00100         _compositeFunction      ->Delete();
00101         _volumeMapper           ->Delete();
00102         _volumeProperty         ->Delete();
00103         _newvol                         ->Delete();
00104 }
00105 //-------------------------------------------------------------------
00106 vtkActor* vtkMPR3DData::GetOutlineActor()
00107 {
00108         return _outline;
00109 }
00110 //-------------------------------------------------------------------
00111 vtkPolyDataMapper* vtkMPR3DData::GetTissueMapper(int id)
00112 {
00113         return _tissueMapper[id];
00114 }
00115 //-------------------------------------------------------------------
00116 vtkPlanes* vtkMPR3DData::GetTissuePlanes(int id)
00117 {
00118         return _tissuePlanes[id];
00119 }
00120 //-------------------------------------------------------------------
00121 vtkStripper* vtkMPR3DData::GetTissueStripper(int id)
00122 {
00123         return _tissueStripper[id];
00124 }
00125 //-------------------------------------------------------------------
00126 vtkImageActor* vtkMPR3DData::GetImageActor(int id)
00127 {
00128         vtkImageActor *tmpVtkActor=NULL;
00129         if (id==0){
00130                 tmpVtkActor = GetvtkActor_saggital();
00131         }
00132         if (id==1){
00133                 tmpVtkActor = GetvtkActor_coronal();
00134         }
00135         if (id==2){
00136                 tmpVtkActor = GetvtkActor_axial();
00137         }
00138         return tmpVtkActor;
00139 }
00140 //-------------------------------------------------------------------
00141 void vtkMPR3DData::Configure()
00142 {
00143         int i;
00144 
00145         for (i=0; i< VTKMPRDATA_MAXTISSUE ; i++){
00146 
00147                 _tissueExtractor[i] = vtkContourFilter::New();
00148                 _tissueExtractor[i]->SetInput((vtkDataSet *) GetImageData() );
00149                 _tissueExtractor[i]->SetValue(0, 0);
00150             _tissueNormals[i] = vtkPolyDataNormals::New();
00151                 _tissueNormals[i]->SetInput(_tissueExtractor[i]->GetOutput());
00152                 _tissueNormals[i]->SetFeatureAngle(60.0);
00153                 _tissueStripper[i] = vtkStripper::New();
00154                 _tissueStripper[i]->SetInput(_tissueNormals[i]->GetOutput());
00155 
00156                 if (i==0){
00157                         _tissuePlanes[i]  = vtkPlanes::New();
00158                         _tissueClipper[i] = vtkClipPolyData::New();
00159                         _tissueClipper[i]->SetInput( _tissueStripper[i]->GetOutput() );
00160                         _tissueClipper[i]->SetClipFunction( _tissuePlanes[i] );
00161                         _tissueClipper[i]->InsideOutOn( );
00162 
00163                         _tissueMapper[i] = vtkPolyDataMapper::New();
00164                         _tissueMapper[i]->SetInput( _tissueClipper[i]->GetOutput() );
00165                 } else {
00166                         _tissueMapper[i] = vtkPolyDataMapper::New();
00167                         _tissueMapper[i]->SetInput(_tissueStripper[i]->GetOutput());
00168 //                      _tissueMapper[i]->ScalarVisibilityOff();
00169 
00170                 }
00171 
00172         }
00173 
00174 
00175 
00176   // An outline provides context around the data.
00177   //
00178         _outlineData = vtkOutlineFilter::New();
00179     _outlineData->SetInput((vtkDataSet *) GetImageData() );
00180         _mapOutline = vtkPolyDataMapper::New();
00181     _mapOutline->SetInput(_outlineData->GetOutput());
00182         _outline = vtkActor::New();
00183     _outline->SetMapper(_mapOutline);
00184     _outline->GetProperty()->SetColor(0,0,0);
00185 
00186   // Now we are creating three orthogonal planes passing through the
00187   // volume. Each plane uses a different texture map and therefore has
00188   // diferent coloration.
00189 
00190 
00191   // Volume
00192   _tfun = vtkPiecewiseFunction::New();
00193 
00194 //      _tfun->AddPoint(70.0, 0.0);
00195 //      _tfun->AddPoint(599.0, 0);
00196 //      _tfun->AddPoint(600.0, 0);
00197 //      _tfun->AddPoint(1195.0, 0);
00198 //      _tfun->AddPoint(1200, .2);
00199 //      _tfun->AddPoint(1300, .3);
00200 //      _tfun->AddPoint(2000, .3);
00201 //      _tfun->AddPoint(4095.0, 1.0);
00202 
00203         _tfun->AddPoint(70      , 0.0);
00204         _tfun->AddPoint(599     , 0.0);
00205         _tfun->AddPoint(600     , 0.0);
00206         _tfun->AddPoint(1110, 0.0);
00207         _tfun->AddPoint(1111, 1.0);
00208         _tfun->AddPoint(1300, 1.0);
00209         _tfun->AddPoint(2000, 1.0);
00210         _tfun->AddPoint(4095, 1.0);
00211 
00212   _ctfun = vtkColorTransferFunction::New();
00213 
00214 //    _ctfun->AddRGBPoint(0.0, 0.5, 0.0, 0.0);
00215 //      _ctfun->AddRGBPoint(600.0, 1.0, 0.5, 0.5);
00216 //      _ctfun->AddRGBPoint(1280.0, 0.9, 0.2, 0.3);
00217 //      _ctfun->AddRGBPoint(1960.0, 0.81, 0.27, 0.1);
00218 //      _ctfun->AddRGBPoint(4095.0, 0.5, 0.5, 0.5);
00219 
00220         _ctfun->AddRGBPoint(0.0         , 0.5   , 0.0   , 0.0 );
00221         _ctfun->AddRGBPoint(600.0       , 1.0   , 0.5   , 0.5 );
00222         _ctfun->AddRGBPoint(1130.0      , 0.9   , 0.2   , 0.3 );
00223         _ctfun->AddRGBPoint(1131.0      , 0.3   , 0.9   , 0.9 );
00224         _ctfun->AddRGBPoint(1135.0      , 0.3   , 0.8   , 0.8 );
00225         _ctfun->AddRGBPoint(1960.0      , 0.1   , 0.27  , 0.71);
00226         _ctfun->AddRGBPoint(4095.0      , 0.5   , 0.5   , 0.5 );
00227 
00228   _compositeFunction = vtkVolumeRayCastCompositeFunction::New();
00229   
00230   _volumeMapper = vtkVolumeRayCastMapper::New();
00231         _volumeMapper->SetInput( GetImageData() );
00232         _volumeMapper->SetVolumeRayCastFunction(_compositeFunction);
00233 
00234   _volumeProperty = vtkVolumeProperty::New();
00235         _volumeProperty->SetColor(_ctfun);
00236         _volumeProperty->SetScalarOpacity(_tfun);
00237         _volumeProperty->SetInterpolationTypeToLinear();
00238         _volumeProperty->ShadeOn();
00239 
00240   _newvol = vtkVolume::New();
00241         _newvol->SetMapper(_volumeMapper);
00242         _newvol->SetProperty(_volumeProperty);
00243 
00244         vtkMPRBaseData::Configure();
00245 
00246 }
00247 
00248 
00249 //-------------------------------------------------------------------
00250 void vtkMPR3DData::SetIsovalue(int idTissue, int isoValue)
00251 {
00252         _tissueExtractor[idTissue]->SetValue(0, isoValue);
00253 }
00254 
00255 //-------------------------------------------------------------------
00256 wxColour* vtkMPR3DData::GetColour(int idColour)
00257 {
00258         return _colour[idColour];
00259 }
00260 //-------------------------------------------------------------------
00261 void vtkMPR3DData::SetVisiblePosition(int idPosition, bool visible)
00262 {
00263         _visiblePosition[idPosition]=visible;
00264 }
00265 //-------------------------------------------------------------------
00266 bool vtkMPR3DData::GetVisiblePosition(int idPosition)
00267 {
00268         return _visiblePosition[idPosition];
00269 }
00270 //-------------------------------------------------------------------
00271 vtkVolume* vtkMPR3DData::GetVolumeActor()
00272 {
00273    return _newvol;
00274 }
00275 //-------------------------------------------------------------------
00276 vtkVolumeRayCastMapper* vtkMPR3DData::GetVolumeMapper(){
00277         return _volumeMapper;
00278 }
00279 
00280 */
00281 
00282 //-------------------------------------------------------------------
00283 //-------------------------------------------------------------------
00284 //-------------------------------------------------------------------
00285 
00286 /*
00287 
00288 wxVtkMPR3DView::wxVtkMPR3DView(wxWindow *parent)
00289 :wxVtk3DBaseView( parent )
00290 {
00291         int i;
00292         for (i=0; i<VTKMPRDATA_MAXTISSUE; i++){
00293                 _visibleTissue[i]=true;
00294         }
00295         _visibleVolume=true;
00296 
00297 }
00298 
00299 //-------------------------------------------------------------------
00300 wxVtkMPR3DView::~wxVtkMPR3DView(){
00301         int i;
00302         for (i=0; i< VTKMPRDATA_MAXTISSUE ; i++){
00303                 _tissue[i]->Delete();
00304         }
00305 
00306         _boxWidget              -> Delete();
00307         _observerV              -> Delete();
00308         _boxWidgetS1    -> Delete();
00309         _observerS1             -> Delete();
00310 
00311 }
00312 //-------------------------------------------------------------------
00313 void wxVtkMPR3DView::SetVisibleTissue(int idTissue, bool visible){
00314         _visibleTissue[idTissue]=visible;
00315 }
00316 //-------------------------------------------------------------------
00317 bool wxVtkMPR3DView::GetVisibleTissue(int idTissue){
00318         return _visibleTissue[idTissue];
00319 }
00320 //-------------------------------------------------------------------
00321 vtkActor* wxVtkMPR3DView::GetTissueActor(int id){
00322         return _tissue[id];
00323 }
00324 //-------------------------------------------------------------------
00325 void wxVtkMPR3DView::Configure(){
00326         vtkMPR3DData *vtkmpr3Ddata = (vtkMPR3DData*)GetVtkmprbasedata();
00327         wxVtk3DBaseView::Configure();
00328         // vtkActor tissue
00329         int i;
00330         for (i=0; i< VTKMPRDATA_MAXTISSUE ; i++){
00331                 // tissue
00332                 _tissue[i] = vtkActor::New();
00333                 _tissue[i]->SetMapper(vtkmpr3Ddata->GetTissueMapper(i));
00334 
00335 //              wxColour* cc=_vtkmprdata->GetColour(i); 
00336 //              float cr=cc->Red(),cg=cc->Green(),cb=cc->Blue();
00337 //              _tissue[i]->GetProperty()->SetDiffuseColor(cr/255, cg/255   , cb/255   );
00338 //              _tissue[i]->GetProperty()->SetSpecular(.3);
00339 //              _tissue[i]->GetProperty()->SetSpecularPower(20);
00340 
00341                 if (i==0) _tissue[i]->GetProperty()->SetColor(1, 0   , 0   );
00342                 if (i==2) _tissue[i]->GetProperty()->SetColor(0.85, 0.85   , 0.85   );
00343                 if (i==3) _tissue[i]->GetProperty()->SetColor(0, 1   ,  0  );
00344                 if (i==4) _tissue[i]->GetProperty()->SetColor(0, 0   , 1   );
00345 
00346                 if (i==0){
00347                   _tissue[i]->VisibilityOff();
00348                   _tissue[i]->SetScale(1.01, 1.01, 1.01);
00349                 }
00350         }
00351 
00352   // Volume (RayCast)
00353         GetRenderer()->AddVolume( vtkmpr3Ddata->GetVolumeActor()  );    // RayCast
00354         GetRenderer()->SetBackground(0.5, 0.5, 0.5);
00355 
00356   // Actors are added to the renderer. 
00357   GetRenderer()->AddActor( vtkmpr3Ddata->GetOutlineActor() );                   
00358   GetRenderer()->AddActor( vtkmpr3Ddata->GetImageActor(0)  );   // _saggital
00359   GetRenderer()->AddActor( vtkmpr3Ddata->GetImageActor(1)  );   // _axial
00360   GetRenderer()->AddActor( vtkmpr3Ddata->GetImageActor(2)  );   // _coronal
00361 
00362 
00363 
00364         // Box Volume
00365         
00366   // The SetInteractor method is how 3D widgets are associated with the
00367   // render window interactor. Internally, SetInteractor sets up a bunch
00368   // of callbacks using the Command/Observer mechanism (AddObserver()).
00369   _boxWidget = vtkBoxWidget::New();
00370         _boxWidget->SetInteractor( GetWxVTKRenderWindowInteractor() );
00371         _boxWidget->SetPlaceFactor(1.0);
00372 
00373   // Place the interactor initially. The output of the reader is used to
00374   // place the box widget.
00375 
00376         _observerV = boxVolumeObserver::New();
00377         _observerV->SetRenWin( GetRenWin() );
00378         _observerV->SetVolumeMapper( vtkmpr3Ddata->GetVolumeMapper() );
00379 
00380         _boxWidget->SetInput( vtkmpr3Ddata->GetImageData() );
00381         _boxWidget->PlaceWidget();
00382         _boxWidget->InsideOutOn();
00383         _boxWidget->AddObserver( vtkCommand::StartInteractionEvent      , _observerV );
00384         _boxWidget->AddObserver( vtkCommand::InteractionEvent           , _observerV );
00385         _boxWidget->AddObserver( vtkCommand::EndInteractionEvent        , _observerV );
00386         _boxWidget->On();
00387 
00388         vtkProperty *outlineProperty = _boxWidget->GetOutlineProperty();
00389         outlineProperty->SetRepresentationToWireframe();
00390         outlineProperty->SetAmbient(1.0);
00391         outlineProperty->SetAmbientColor(1, 1, 1);
00392         outlineProperty->SetLineWidth(3);
00393 
00394         vtkProperty *selectedOutlineProperty = _boxWidget->GetSelectedOutlineProperty();
00395         selectedOutlineProperty->SetRepresentationToWireframe();
00396         selectedOutlineProperty->SetAmbient(1.0);
00397         selectedOutlineProperty->SetAmbientColor(1, 0, 0);
00398         selectedOutlineProperty->SetLineWidth(3);
00399 
00400 //--
00401         // Box Surface
00402 
00403   // Place the interactor initially. The output of the reader is used to
00404   // place the box widget.
00405 
00406 //      _observerV = boxVolumeObserver::New();
00407 //      _observerV->SetRenWin( _renWin );
00408 //      _observerV->SetVolumeMapper( _vtkmprdata->GetVolumeMapper() );
00409 
00410         _observerS1 = boxSurfaceObserver::New();
00411         _observerS1->SetPlanes( vtkmpr3Ddata->GetTissuePlanes(0) );
00412         _observerS1->SetActor( _tissue[0] );
00413 
00414   _boxWidgetS1 = vtkBoxWidget::New();
00415         _boxWidgetS1->SetInteractor( GetWxVTKRenderWindowInteractor() );
00416         _boxWidgetS1->SetPlaceFactor(1.25);
00417 
00418 
00419         _boxWidgetS1->SetInput( vtkmpr3Ddata->GetTissueStripper(0)->GetOutput() );
00420 //      _boxWidgetS1->SetInput( vtkmpr3Ddata->GetGlyph(0)->GetOutput() );
00421         _boxWidgetS1->PlaceWidget();
00422         _boxWidgetS1->InsideOutOff();
00423 //      _boxWidgetS1->AddObserver( vtkCommand::StartInteractionEvent , _observerV );
00424 //      _boxWidgetS1->AddObserver( vtkCommand::InteractionEvent          , _observerV );
00425 //      _boxWidgetS1->AddObserver( vtkCommand::EndInteractionEvent       , _observerV );
00426 //      _boxWidgetS1->AddObserver( vtkCommand::EndInteractionEvent       , _observerS1 );
00427         _boxWidgetS1->AddObserver( vtkCommand::InteractionEvent          , _observerS1 );
00428 
00429 //      vtkProperty *outlinePropertyS1 = _boxWidgetS1->GetOutlineProperty();
00430 //      outlinePropertyS1->SetRepresentationToWireframe();
00431 //      outlinePropertyS1->SetAmbient(1.0);
00432 //      outlinePropertyS1->SetAmbientColor(0, 0, 1);
00433 //      outlinePropertyS1->SetLineWidth(3);
00434 
00435 //      vtkProperty *selectedOutlinePropertyS1 = _boxWidgetS1->GetSelectedOutlineProperty();
00436 //      selectedOutlinePropertyS1->SetRepresentationToWireframe();
00437 //      selectedOutlinePropertyS1->SetAmbient(1.0);
00438 //      selectedOutlinePropertyS1->SetAmbientColor(1, 0, 0);
00439 //      selectedOutlinePropertyS1->SetLineWidth(3);
00440 
00441 
00442         // vtkActor tissue
00443         for (i=0; i< VTKMPRDATA_MAXTISSUE ; i++){
00444                 GetRenderer()->AddActor( _tissue[i] );                  
00445         }
00446 
00447         _boxWidgetS1->On();
00448 
00449 //--
00450 
00451   // Turn off bone for this example.
00452 //  _bone->VisibilityOff();
00453 
00454 
00455   // An initial camera view is created.  The Dolly() method moves 
00456   // the camera towards the FocalPoint, thereby enlarging the image.
00457   GetRenderer()->SetActiveCamera(GetCamera());
00458   GetRenderer()->ResetCamera ();
00459   GetCamera()->Dolly(1.5);
00460 
00461   // Set a background color for the renderer and set the size of the
00462   // render window (expressed in pixels).
00463   GetRenderer()->SetBackground(1,1,1);
00464   GetRenWin()->SetSize(400, 400);
00465 
00466   // Note that when camera movement occurs (as it does in the Dolly()
00467   // method), the clipping planes often need adjusting. Clipping planes
00468   // consist of two planes: near and far along the view direction. The 
00469   // near plane clips out objects in front of the plane; the far plane
00470   // clips out objects behind the plane. This way only what is drawn
00471   // between the planes is actually rendered.
00472   GetRenderer()->ResetCameraClippingRange();
00473 
00474 }
00475 
00476 
00477 //-------------------------------------------------------------------
00478 void wxVtkMPR3DView::VisibleActor(int idTissue, bool visTissue, bool visGuide){
00479         if (visTissue!=GetVisibleTissue(idTissue)){
00480                 if (visTissue==false){
00481                         GetRenderer()->RemoveActor( GetTissueActor(idTissue)  );        
00482                 } else {
00483                         GetRenderer()->AddActor( GetTissueActor(idTissue)  );   
00484                 }
00485                 SetVisibleTissue(idTissue,visTissue);
00486         }
00487 
00488         if (visGuide==true){
00489                 _boxWidgetS1->On();
00490         } else {
00491                 _boxWidgetS1->Off();
00492         }
00493 
00494 }
00495 //-------------------------------------------------------------------
00496 void wxVtkMPR3DView::VisibleImageActor(int idPosition, bool visible){
00497         vtkMPR3DData *vtkmpr3Ddata = (vtkMPR3DData*)GetVtkmprbasedata();
00498         if (visible!=vtkmpr3Ddata->GetVisiblePosition(idPosition)){
00499                 if (visible==false){
00500                         GetRenderer()->RemoveActor( vtkmpr3Ddata->GetImageActor(idPosition)  ); 
00501                 } else {
00502                         GetRenderer()->AddActor( vtkmpr3Ddata->GetImageActor(idPosition)  );    
00503                 }
00504                 vtkmpr3Ddata->SetVisiblePosition(idPosition,visible);
00505         }
00506 }
00507 
00508 //-------------------------------------------------------------------
00509 
00510 void wxVtkMPR3DView::VisibleVolumeActor( bool visVolume,bool visGuide){
00511         vtkMPR3DData *vtkmpr3Ddata = (vtkMPR3DData*)GetVtkmprbasedata();
00512         if (visVolume!=_visibleVolume){
00513                 if (visVolume==false){
00514                         GetRenderer()->RemoveActor( vtkmpr3Ddata->GetVolumeActor()  );  
00515                 } else {
00516                         GetRenderer()->AddActor( vtkmpr3Ddata->GetVolumeActor() );      
00517                 }
00518                 _visibleVolume=visVolume;
00519         }
00520         if (visGuide==true){
00521                 _boxWidget->On();
00522         } else {
00523                 _boxWidget->Off();
00524         }
00525 }
00526 
00527 */
00528 
00529 //-------------------------------------------------------------------
00530 //-------------------------------------------------------------------
00531 //-------------------------------------------------------------------
00532 
00533 
00534 /*
00535 wxSurfaceMPR::wxSurfaceMPR(wxWindow *parent,  vtkImageData *imagedata, const wxString& title)
00536                                 : wxFrame( parent, -1, title) {
00537 
00538         _vtkmpr3Ddata = new vtkMPR3DData(); 
00539         _vtkmpr3Ddata->SetImageData(imagedata);
00540 
00541         wxPanel *MPRPanel               = CreateMPRPanel(this,_vtkmpr3Ddata);
00542         wxPanel *controlPanel   = CreateControlPanel(this);
00543 
00544     wxFlexGridSizer *sizer  = new wxFlexGridSizer(2);
00545         sizer->Add(MPRPanel );
00546         sizer->Add(controlPanel );
00547         this->SetSizer(sizer);
00548         this->SetAutoLayout(true);
00549         this->SetSize(800,900);
00550 }
00551 
00552 //-------------------------------------------------------------------
00553 wxPanel* wxSurfaceMPR::CreateMPRPanel(wxWindow *parent, vtkMPR3DData *vtkmpr3Ddata){
00554         wxPanel *panel=new wxPanel(parent,-1);
00555 
00556         _vtkmprview[1] = new wxVtkMPR3DView(panel);
00557         _vtkmprview[1]->SetVtkmprbasedata(vtkmpr3Ddata);
00558         wxVTKRenderWindowInteractor *iren1 = _vtkmprview[1]->GetWxVTKRenderWindowInteractor();  
00559 
00560         _vtkmprview[2] = new wxVtkMPR3DView(panel);
00561         _vtkmprview[2]->SetVtkmprbasedata(vtkmpr3Ddata);
00562         wxVTKRenderWindowInteractor *iren2 = _vtkmprview[2]->GetWxVTKRenderWindowInteractor();  
00563 
00564         _vtkmprview[3] = new wxVtkMPR3DView(panel);
00565         _vtkmprview[3]->SetVtkmprbasedata(vtkmpr3Ddata);
00566         wxVTKRenderWindowInteractor *iren3 = _vtkmprview[3]->GetWxVTKRenderWindowInteractor();  
00567 
00568         _vtkmprview[0] = new wxVtkMPR3DView(panel);
00569         _vtkmprview[0]->SetVtkmprbasedata(vtkmpr3Ddata);
00570         wxVTKRenderWindowInteractor *iren0 = _vtkmprview[0]->GetWxVTKRenderWindowInteractor();  
00571 
00572     wxBoxSizer *sizerV = new wxBoxSizer(wxVERTICAL);
00573     wxBoxSizer *sizerH1= new wxBoxSizer(wxHORIZONTAL);
00574     wxBoxSizer *sizerH2= new wxBoxSizer(wxHORIZONTAL);
00575         sizerH1->Add(iren0 , 1, wxEXPAND, 0);
00576 
00577         sizerH1->Add(iren1 , 1, wxEXPAND, 0);
00578         sizerH2->Add(iren2 , 1, wxEXPAND, 0);
00579         sizerH2->Add(iren3 , 1, wxEXPAND, 0);
00580 
00581         sizerV->Add(sizerH1, 1, wxEXPAND, 0);
00582         sizerV->Add(sizerH2, 1, wxEXPAND, 0);
00583 
00584         panel->SetAutoLayout(true);
00585         panel->SetSizer(sizerV);
00586         panel->SetSize(900,900);
00587         panel->Layout();
00588 
00589 
00590         return panel;
00591 }
00592 
00593 //-------------------------------------------------------------------
00594 
00595 wxPanel* wxSurfaceMPR::CreateControlPanel(wxWindow *parent){
00596         wxPanel *panel=new wxPanel(parent,-1);
00597 
00598 // position 
00599         wxPanel *panel1 =new wxPanel(panel,-1);
00600         wxStaticText *text_space1 = new wxStaticText(panel1,-1,"    ");
00601         wxStaticText *text1_box1  = new wxStaticText(panel1,-1,"x  ");
00602         wxStaticText *text2_box1  = new wxStaticText(panel1,-1,"y  ");
00603         wxStaticText *text3_box1  = new wxStaticText(panel1,-1,"z  ");
00604         _sl1_box1 = new wxSlider( panel1, -1, 0, 0, _vtkmpr3Ddata->GetMaxPositionX(), wxDefaultPosition, wxDefaultSize, wxSL_HORIZONTAL | wxSL_LABELS );
00605         _sl2_box1 = new wxSlider( panel1, -1, 0, 0, _vtkmpr3Ddata->GetMaxPositionY(), wxDefaultPosition, wxDefaultSize, wxSL_HORIZONTAL | wxSL_LABELS );
00606         _sl3_box1 = new wxSlider( panel1, -1, 0, 0, _vtkmpr3Ddata->GetMaxPositionZ(), wxDefaultPosition, wxDefaultSize, wxSL_HORIZONTAL | wxSL_LABELS );
00607 
00608         _sl1_box1->SetSize(250,20);
00609         _sl2_box1->SetSize(250,20);
00610         _sl3_box1->SetSize(250,20);
00611 
00612     wxFlexGridSizer *sizerBox1 = new wxFlexGridSizer(3);
00613         // line 1
00614         sizerBox1->Add(text_space1);
00615         sizerBox1->Add(text1_box1);
00616         sizerBox1->Add( _sl1_box1);
00617         // line 2
00618         sizerBox1->Add(text_space1);
00619         sizerBox1->Add(text2_box1);
00620         sizerBox1->Add( _sl2_box1);
00621         // line 3
00622         sizerBox1->Add(text_space1);
00623         sizerBox1->Add(text3_box1);
00624         sizerBox1->Add( _sl3_box1);
00625         panel1->SetSizer(sizerBox1);
00626         panel1->SetAutoLayout(true);
00627         panel1->SetSize(250,80);
00628 
00629 
00630 // Layers
00631         wxPanel *panel2 =new wxPanel(panel,-1);
00632         wxStaticText *text_space2 = new wxStaticText(panel2,-1,"   ");
00633         wxStaticText *text_             = new wxStaticText(panel2,-1,"  ");
00634                                   _btnA         = new wxButton(panel2,-1,"A");
00635                                   _btnB         = new wxButton(panel2,-1,"B");
00636                                   _btnC         = new wxButton(panel2,-1,"C");
00637                                   _btnD         = new wxButton(panel2,-1,"D");
00638                       _text_A   = new wxStaticText(panel2,-1,"000000");
00639                       _text_B   = new wxStaticText(panel2,-1,"000000");
00640                       _text_C   = new wxStaticText(panel2,-1,"000000");
00641                       _text_D   = new wxStaticText(panel2,-1,"000000");
00642         wxStaticText *text_A    = new wxStaticText(panel2,-1,"A ");
00643         wxStaticText *text_B    = new wxStaticText(panel2,-1,"B ");
00644         wxStaticText *text_C    = new wxStaticText(panel2,-1,"C ");
00645         wxStaticText *text_D    = new wxStaticText(panel2,-1,"D ");
00646         _slA1_box2 = new wxSlider( panel2, -1, 0, 0, 100, wxDefaultPosition, wxDefaultSize, wxSL_HORIZONTAL | wxSL_LABELS );
00647         _slA2_box2 = new wxSlider( panel2, -1, 0, 0,  60, wxDefaultPosition, wxDefaultSize, wxSL_HORIZONTAL  );
00648         _slA3_box2 = new wxSlider( panel2, -1, 0, 0,  50, wxDefaultPosition, wxDefaultSize, wxSL_HORIZONTAL  );
00649         _slB1_box2 = new wxSlider( panel2, -1, 0, 0, 100, wxDefaultPosition, wxDefaultSize, wxSL_HORIZONTAL | wxSL_LABELS );
00650         _slB2_box2 = new wxSlider( panel2, -1, 0, 0,  60, wxDefaultPosition, wxDefaultSize, wxSL_HORIZONTAL  );
00651         _slB3_box2 = new wxSlider( panel2, -1, 0, 0,  50, wxDefaultPosition, wxDefaultSize, wxSL_HORIZONTAL  );
00652         _slC1_box2 = new wxSlider( panel2, -1, 0, 0, 100, wxDefaultPosition, wxDefaultSize, wxSL_HORIZONTAL | wxSL_LABELS );
00653         _slC2_box2 = new wxSlider( panel2, -1, 0, 0,  60, wxDefaultPosition, wxDefaultSize, wxSL_HORIZONTAL  );
00654         _slC3_box2 = new wxSlider( panel2, -1, 0, 0,  50, wxDefaultPosition, wxDefaultSize, wxSL_HORIZONTAL  );
00655         _slD1_box2 = new wxSlider( panel2, -1, 0, 0, 100, wxDefaultPosition, wxDefaultSize, wxSL_HORIZONTAL | wxSL_LABELS );
00656         _slD2_box2 = new wxSlider( panel2, -1, 0, 0,  60, wxDefaultPosition, wxDefaultSize, wxSL_HORIZONTAL  );
00657         _slD3_box2 = new wxSlider( panel2, -1, 0, 0,  50, wxDefaultPosition, wxDefaultSize, wxSL_HORIZONTAL  );
00658 
00659         _chk1_box1 = new wxCheckBox(panel2, -1, "Visible X");
00660         _chk2_box1 = new wxCheckBox(panel2, -1, "Visible Y");
00661         _chk3_box1 = new wxCheckBox(panel2, -1, "Visible Z");
00662 
00663         _chkA_box2              = new wxCheckBox(panel2, -1, "Vis.");
00664         _chkB_box2              = new wxCheckBox(panel2, -1, "Vis.");
00665         _chkC_box2              = new wxCheckBox(panel2, -1, "Vis.");
00666         _chkD_box2              = new wxCheckBox(panel2, -1, "Vis.");
00667         _chkAA_box2             = new wxCheckBox(panel2, -1, ".");
00668         _chkBB_box2             = new wxCheckBox(panel2, -1, ".");
00669         _chkCC_box2             = new wxCheckBox(panel2, -1, ".");
00670         _chkDD_box2             = new wxCheckBox(panel2, -1, ".");
00671         _chkViewA_box2  = new wxCheckBox(panel2, -1, "A");
00672         _chkViewB_box2  = new wxCheckBox(panel2, -1, "B");
00673         _chkViewC_box2  = new wxCheckBox(panel2, -1, "C");
00674         _chkViewD_box2  = new wxCheckBox(panel2, -1, "D");
00675 
00676         _chk1_box1->SetValue(true);
00677         _chk2_box1->SetValue(true);
00678         _chk3_box1->SetValue(true);
00679         _chkA_box2->SetValue(true);
00680         _chkB_box2->SetValue(true);
00681         _chkC_box2->SetValue(true);
00682         _chkD_box2->SetValue(true);
00683         _chkAA_box2->SetValue(true);
00684         _chkBB_box2->SetValue(true);
00685         _chkCC_box2->SetValue(true);
00686         _chkDD_box2->SetValue(true);
00687         _chkViewA_box2->SetValue(true);
00688         _chkViewB_box2->SetValue(true);
00689         _chkViewC_box2->SetValue(true);
00690         _chkViewD_box2->SetValue(true);
00691 
00692         _slA1_box2->SetSize(250,20);
00693         _slA2_box2->SetSize(150,20);
00694         _slA3_box2->SetSize(150,20);
00695         _slB1_box2->SetSize(250,20);
00696         _slB2_box2->SetSize(150,20);
00697         _slB3_box2->SetSize(150,20);
00698         _slC1_box2->SetSize(250,20);
00699         _slC2_box2->SetSize(150,20);
00700         _slC3_box2->SetSize(150,20);
00701         _slD1_box2->SetSize(250,20);
00702         _slD2_box2->SetSize(150,20);
00703         _slD3_box2->SetSize(150,20);
00704         _btnA->SetSize(20,20);
00705         _btnB->SetSize(20,20);
00706         _btnC->SetSize(20,20);
00707         _btnD->SetSize(20,20);
00708 
00709         _btnA->SetBackgroundColour( *(_vtkmpr3Ddata->GetColour(0))  );
00710         _btnB->SetBackgroundColour( *(_vtkmpr3Ddata->GetColour(1))  );
00711         _btnC->SetBackgroundColour( *(_vtkmpr3Ddata->GetColour(2))  );
00712         _btnD->SetBackgroundColour( *(_vtkmpr3Ddata->GetColour(3))  );
00713 
00714 
00715     wxFlexGridSizer *sizerPanel2A = new wxFlexGridSizer(5);
00716     // line A2
00717         sizerPanel2A->Add(text_space2);
00718         sizerPanel2A->Add(text_A);
00719         sizerPanel2A->Add(_slA2_box2);
00720         sizerPanel2A->Add(_slA3_box2);
00721         sizerPanel2A->Add(_text_A);
00722     // line B2
00723         sizerPanel2A->Add(text_space2);
00724         sizerPanel2A->Add(text_B);
00725         sizerPanel2A->Add(_slB2_box2);
00726         sizerPanel2A->Add(_slB3_box2);
00727         sizerPanel2A->Add(_text_B);
00728     // line C2
00729         sizerPanel2A->Add(text_space2);
00730         sizerPanel2A->Add(text_C);
00731         sizerPanel2A->Add(_slC2_box2);
00732         sizerPanel2A->Add(_slC3_box2);
00733         sizerPanel2A->Add(_text_C);
00734     // line D2
00735         sizerPanel2A->Add(text_space2);
00736         sizerPanel2A->Add(text_D);
00737         sizerPanel2A->Add(_slD2_box2);
00738         sizerPanel2A->Add(_slD3_box2);
00739         sizerPanel2A->Add(_text_D);
00740 
00741 
00742     wxFlexGridSizer *sizerPanel2B = new wxFlexGridSizer(5);
00743     // line A1
00744         sizerPanel2B->Add(text_space2);
00745         sizerPanel2B->Add(_btnA);
00746         sizerPanel2B->Add(_slA1_box2);
00747         sizerPanel2B->Add(_chkA_box2);
00748         sizerPanel2B->Add(_chkAA_box2);
00749     // line B1
00750         sizerPanel2B->Add(text_space2);
00751         sizerPanel2B->Add(_btnB);
00752         sizerPanel2B->Add(_slB1_box2);
00753         sizerPanel2B->Add(_chkB_box2);
00754         sizerPanel2B->Add(_chkBB_box2);
00755     // line C1
00756         sizerPanel2B->Add(text_space2);
00757         sizerPanel2B->Add(_btnC);
00758         sizerPanel2B->Add(_slC1_box2);
00759         sizerPanel2B->Add(_chkC_box2);
00760         sizerPanel2B->Add(_chkCC_box2);
00761     // line D1
00762         sizerPanel2B->Add(text_space2);
00763         sizerPanel2B->Add(_btnD);
00764         sizerPanel2B->Add(_slD1_box2);
00765         sizerPanel2B->Add(_chkD_box2);
00766         sizerPanel2B->Add(_chkDD_box2);
00767 
00768     wxFlexGridSizer *sizerPanel2C = new wxFlexGridSizer(4);
00769         sizerPanel2C->Add(_chkViewA_box2);
00770         sizerPanel2C->Add(_chkViewB_box2);
00771         sizerPanel2C->Add(_chkViewC_box2);
00772         sizerPanel2C->Add(_chkViewD_box2);
00773 
00774     wxFlexGridSizer *sizerPanel2D = new wxFlexGridSizer(2);
00775         sizerPanel2D->Add(text_space2);
00776         sizerPanel2D->Add(_chk1_box1);
00777         sizerPanel2D->Add(text_space2);
00778         sizerPanel2D->Add(_chk2_box1);
00779         sizerPanel2D->Add(text_space2);
00780         sizerPanel2D->Add(_chk3_box1);
00781 
00782     wxFlexGridSizer *sizerPanel2 = new wxFlexGridSizer(1);
00783         sizerPanel2->Add(sizerPanel2A);
00784         sizerPanel2->Add(text_space2);
00785         sizerPanel2->Add(sizerPanel2C);
00786         sizerPanel2->Add(text_space2);
00787         sizerPanel2->Add(sizerPanel2D);
00788         sizerPanel2->Add(text_space2);
00789         sizerPanel2->Add(sizerPanel2B);
00790 
00791         panel2->SetSizer(sizerPanel2);
00792         panel2->SetAutoLayout(true);
00793         panel2->SetSize(350,320);
00794 
00795 // cut1
00796         wxPanel *panel3 = new wxPanel(panel,-1);
00797         wxStaticText *text_space3 = new wxStaticText(panel3,-1,"    ");
00798         _chk_box3 = new wxCheckBox(panel3, -1, "Vis.");
00799         _chk_box33 = new wxCheckBox(panel3, -1, "Vis.");
00800         _chk_box3->SetValue(true);
00801         _chk_box33->SetValue(true);
00802     wxFlexGridSizer *sizerPanel3 = new wxFlexGridSizer(3);
00803         // line 1
00804         sizerPanel3->Add(text_space3);
00805         sizerPanel3->Add(_chk_box3);
00806         sizerPanel3->Add(_chk_box33);
00807         panel3->SetSizer(sizerPanel3);
00808         panel3->SetAutoLayout(true);
00809         panel3->SetSize(250,100);
00810 
00811 //      _sl1_box3 = new wxSlider( panel3, -1, 0, 0, 100, wxDefaultPosition, wxDefaultSize, wxSL_HORIZONTAL | wxSL_LABELS );
00812 //      _sl2_box3 = new wxSlider( panel3, -1, 0, 0, 100, wxDefaultPosition, wxDefaultSize, wxSL_HORIZONTAL | wxSL_LABELS );
00813 //      _sl3_box3 = new wxSlider( panel3, -1, 0, 0, 100, wxDefaultPosition, wxDefaultSize, wxSL_HORIZONTAL | wxSL_LABELS );
00814 //      wxStaticText *text1_box3 = new wxStaticText(panel3,-1,"A");
00815 //      wxStaticText *text2_box3 = new wxStaticText(panel3,-1,"B");
00816 //      wxStaticText *text3_box3 = new wxStaticText(panel3,-1,"Dist");
00817 //  wxFlexGridSizer *sizerPanel3 = new wxFlexGridSizer(3);
00818 //      // line 1
00819 //      sizerPanel3->Add(text_space3);
00820 //      sizerPanel3->Add(_chk_box3);
00821 //      sizerPanel3->Add(text_space3);
00822 //      // line 2
00823 //      sizerPanel3->Add(text_space3);
00824 //      sizerPanel3->Add(text1_box3);
00825 //      sizerPanel3->Add(_sl1_box3);
00826 //      // line 3
00827 //      sizerPanel3->Add(text_space3);
00828 //      sizerPanel3->Add(text2_box3);
00829 //      sizerPanel3->Add(_sl2_box3);
00830 //      // line 4
00831 //      sizerPanel3->Add(text_space3);
00832 //      sizerPanel3->Add(text3_box3);
00833 //      sizerPanel3->Add(_sl3_box3);
00834 //      panel3->SetSizer(sizerPanel3);
00835 //      panel3->SetAutoLayout(true);
00836 //      panel3->SetSize(250,100);
00837 //  // cut2
00838 //
00839 //      wxPanel *panel4 = new wxPanel(panel,-1);
00840 //      _chk_box4 = new wxCheckBox(panel4, -1, "Vis.");
00841 //      _slA_box4 = new wxSlider( panel4, -1, 0, 0, 100, wxDefaultPosition, wxDefaultSize, wxSL_HORIZONTAL | wxSL_LABELS );
00842 //      _slB_box4 = new wxSlider( panel4, -1, 0, 0, 100, wxDefaultPosition, wxDefaultSize, wxSL_HORIZONTAL | wxSL_LABELS );
00843 //      _sl1_box4 = new wxSlider( panel4, -1, 0, 0, 100, wxDefaultPosition, wxDefaultSize, wxSL_HORIZONTAL | wxSL_LABELS );
00844 //      _sl2_box4 = new wxSlider( panel4, -1, 0, 0, 100, wxDefaultPosition, wxDefaultSize, wxSL_HORIZONTAL | wxSL_LABELS );
00845 //      _sl3_box4 = new wxSlider( panel4, -1, 0, 0, 100, wxDefaultPosition, wxDefaultSize, wxSL_HORIZONTAL | wxSL_LABELS );
00846 //      _sl4_box4 = new wxSlider( panel4, -1, 0, 0, 100, wxDefaultPosition, wxDefaultSize, wxSL_HORIZONTAL | wxSL_LABELS );
00847 //      _sl5_box4 = new wxSlider( panel4, -1, 0, 0, 100, wxDefaultPosition, wxDefaultSize, wxSL_HORIZONTAL | wxSL_LABELS );
00848 //      _sl6_box4 = new wxSlider( panel4, -1, 0, 0, 100, wxDefaultPosition, wxDefaultSize, wxSL_HORIZONTAL | wxSL_LABELS );
00849 //      wxStaticText *text_space4 = new wxStaticText(panel3,-1,"    ");
00850 //      wxStaticText *textA_box4 = new wxStaticText(panel4,-1,"A");
00851 //      wxStaticText *textB_box4 = new wxStaticText(panel4,-1,"B");
00852 //      wxStaticText *text1_box4 = new wxStaticText(panel4,-1,"D1");
00853 //      wxStaticText *text2_box4 = new wxStaticText(panel4,-1,"D2");
00854 //      wxStaticText *text3_box4 = new wxStaticText(panel4,-1,"D3");
00855 //      wxStaticText *text4_box4 = new wxStaticText(panel4,-1,"D4");
00856 //      wxStaticText *text5_box4 = new wxStaticText(panel4,-1,"D5");
00857 //      wxStaticText *text6_box4 = new wxStaticText(panel4,-1,"D6");
00858 //  wxFlexGridSizer *sizerPanel4 = new wxFlexGridSizer(3);
00859 //      // line 1
00860 //      sizerPanel4->Add(text_space4);
00861 //      sizerPanel4->Add(_chk_box4);
00862 //      sizerPanel4->Add(text_space4);
00863 //      // line 2
00864 //      sizerPanel4->Add(text_space4);
00865 //      sizerPanel4->Add(textA_box4);
00866 //      sizerPanel4->Add(_slA_box4);
00867 //      // line 3
00868 //      sizerPanel4->Add(text_space4);
00869 //      sizerPanel4->Add(textB_box4);
00870 //      sizerPanel4->Add(_slB_box4);
00871 //      // line 4
00872 //      sizerPanel4->Add(text_space4);
00873 //      sizerPanel4->Add(text1_box4);
00874 //      sizerPanel4->Add(_sl1_box4);
00875 //      // line 5
00876 //      sizerPanel4->Add(text_space4);
00877 //      sizerPanel4->Add(text2_box4);
00878 //      sizerPanel4->Add(_sl2_box4);
00879 //      // line 6
00880 //      sizerPanel4->Add(text_space4);
00881 //      sizerPanel4->Add(text3_box4);
00882 //      sizerPanel4->Add(_sl3_box4);
00883 //      // line 7
00884 //      sizerPanel4->Add(text_space4);
00885 //      sizerPanel4->Add(text4_box4);
00886 //      sizerPanel4->Add(_sl4_box4);
00887 //      // line 8
00888 //      sizerPanel4->Add(text_space4);
00889 //      sizerPanel4->Add(text5_box4);
00890 //      sizerPanel4->Add(_sl5_box4);
00891 //      // line 9
00892 //      sizerPanel4->Add(text_space4);
00893 //      sizerPanel4->Add(text6_box4);
00894 //      sizerPanel4->Add(_sl6_box4);
00895 //      //
00896 //      panel4->SetSizer(sizerPanel4);
00897 //      panel4->SetAutoLayout(true);
00898 //      panel4->SetSize(250,300);
00899 
00900 
00901 
00902 // All
00903     wxFlexGridSizer *sizer = new wxFlexGridSizer(1);
00904 
00905         sizer->Add(new wxStaticText(panel,-1,"Position") );
00906         sizer->Add(panel1);
00907         sizer->Add(new wxStaticText(panel,-1,"Layer") );
00908         sizer->Add(panel2);
00909         sizer->Add(new wxStaticText(panel,-1,"Cut 1") );
00910         sizer->Add(panel3);
00911 //      sizer->Add(new wxStaticText(panel,-1,"Cut 2") );
00912 //      sizer->Add(panel4);
00913 
00914         panel->SetSizer(sizer);
00915         panel->SetAutoLayout(true);
00916         panel->SetSize(350,750);
00917 
00918 
00919         // Position 
00920         Connect(_sl1_box1->GetId()  , wxEVT_COMMAND_SLIDER_UPDATED  , (wxObjectEventFunction) &wxSurfaceMPR::OnPositionX );
00921         Connect(_sl2_box1->GetId()  , wxEVT_COMMAND_SLIDER_UPDATED  , (wxObjectEventFunction) &wxSurfaceMPR::OnPositionY );
00922         Connect(_sl3_box1->GetId()  , wxEVT_COMMAND_SLIDER_UPDATED  , (wxObjectEventFunction) &wxSurfaceMPR::OnPositionZ );
00923         Connect(_chk1_box1->GetId() , wxEVT_COMMAND_CHECKBOX_CLICKED, (wxObjectEventFunction) &wxSurfaceMPR::OnVisibleX );
00924         Connect(_chk2_box1->GetId() , wxEVT_COMMAND_CHECKBOX_CLICKED, (wxObjectEventFunction) &wxSurfaceMPR::OnVisibleY );
00925         Connect(_chk3_box1->GetId() , wxEVT_COMMAND_CHECKBOX_CLICKED, (wxObjectEventFunction) &wxSurfaceMPR::OnVisibleZ );
00926  
00927 
00928         // Opacity
00929         Connect(_slA1_box2->GetId()  , wxEVT_SCROLL_THUMBRELEASE   , (wxObjectEventFunction) &wxSurfaceMPR::OnOpacity0 );
00930         Connect(_slB1_box2->GetId()  , wxEVT_SCROLL_THUMBRELEASE   , (wxObjectEventFunction) &wxSurfaceMPR::OnOpacity1 );
00931         Connect(_slC1_box2->GetId()  , wxEVT_SCROLL_THUMBRELEASE   , (wxObjectEventFunction) &wxSurfaceMPR::OnOpacity2 );
00932         Connect(_slD1_box2->GetId()  , wxEVT_SCROLL_THUMBRELEASE   , (wxObjectEventFunction) &wxSurfaceMPR::OnOpacity3 );
00933         Connect(_btnA->GetId()       , wxEVT_COMMAND_BUTTON_CLICKED , (wxObjectEventFunction) &wxSurfaceMPR::OnBtnColourA );
00934         Connect(_btnB->GetId()       , wxEVT_COMMAND_BUTTON_CLICKED , (wxObjectEventFunction) &wxSurfaceMPR::OnBtnColourB );
00935         Connect(_btnC->GetId()       , wxEVT_COMMAND_BUTTON_CLICKED , (wxObjectEventFunction) &wxSurfaceMPR::OnBtnColourC );
00936         Connect(_btnD->GetId()       , wxEVT_COMMAND_BUTTON_CLICKED , (wxObjectEventFunction) &wxSurfaceMPR::OnBtnColourD );
00937 
00938 
00939 
00940         // Isovalue
00941         Connect(_slA2_box2->GetId()  , wxEVT_SCROLL_THUMBRELEASE  , (wxObjectEventFunction) &wxSurfaceMPR::OnIsoValue0 );
00942         Connect(_slA3_box2->GetId()  , wxEVT_SCROLL_THUMBRELEASE  , (wxObjectEventFunction) &wxSurfaceMPR::OnIsoValue0 );
00943         Connect(_slB2_box2->GetId()  , wxEVT_SCROLL_THUMBRELEASE  , (wxObjectEventFunction) &wxSurfaceMPR::OnIsoValue1 );
00944         Connect(_slB3_box2->GetId()  , wxEVT_SCROLL_THUMBRELEASE  , (wxObjectEventFunction) &wxSurfaceMPR::OnIsoValue1 );
00945         Connect(_slC2_box2->GetId()  , wxEVT_SCROLL_THUMBRELEASE  , (wxObjectEventFunction) &wxSurfaceMPR::OnIsoValue2 );
00946         Connect(_slC3_box2->GetId()  , wxEVT_SCROLL_THUMBRELEASE  , (wxObjectEventFunction) &wxSurfaceMPR::OnIsoValue2 );
00947         Connect(_slD2_box2->GetId()  , wxEVT_SCROLL_THUMBRELEASE  , (wxObjectEventFunction) &wxSurfaceMPR::OnIsoValue3 );
00948         Connect(_slD3_box2->GetId()  , wxEVT_SCROLL_THUMBRELEASE  , (wxObjectEventFunction) &wxSurfaceMPR::OnIsoValue3 );
00949         Connect(_slA2_box2->GetId()  , wxEVT_COMMAND_SLIDER_UPDATED  , (wxObjectEventFunction) &wxSurfaceMPR::OnIsoValue_0 );
00950         Connect(_slA3_box2->GetId()  , wxEVT_COMMAND_SLIDER_UPDATED  , (wxObjectEventFunction) &wxSurfaceMPR::OnIsoValue_0 );
00951         Connect(_slB2_box2->GetId()  , wxEVT_COMMAND_SLIDER_UPDATED  , (wxObjectEventFunction) &wxSurfaceMPR::OnIsoValue_1 );
00952         Connect(_slB3_box2->GetId()  , wxEVT_COMMAND_SLIDER_UPDATED  , (wxObjectEventFunction) &wxSurfaceMPR::OnIsoValue_1 );
00953         Connect(_slC2_box2->GetId()  , wxEVT_COMMAND_SLIDER_UPDATED  , (wxObjectEventFunction) &wxSurfaceMPR::OnIsoValue_2 );
00954         Connect(_slC3_box2->GetId()  , wxEVT_COMMAND_SLIDER_UPDATED  , (wxObjectEventFunction) &wxSurfaceMPR::OnIsoValue_2 );
00955         Connect(_slD2_box2->GetId()  , wxEVT_COMMAND_SLIDER_UPDATED  , (wxObjectEventFunction) &wxSurfaceMPR::OnIsoValue_3 );
00956         Connect(_slD3_box2->GetId()  , wxEVT_COMMAND_SLIDER_UPDATED  , (wxObjectEventFunction) &wxSurfaceMPR::OnIsoValue_3 );
00957 
00958         Connect(_chkA_box2->GetId() , wxEVT_COMMAND_CHECKBOX_CLICKED, (wxObjectEventFunction) &wxSurfaceMPR::OnVisibleTissueA );
00959         Connect(_chkB_box2->GetId() , wxEVT_COMMAND_CHECKBOX_CLICKED, (wxObjectEventFunction) &wxSurfaceMPR::OnVisibleTissueB );
00960         Connect(_chkC_box2->GetId() , wxEVT_COMMAND_CHECKBOX_CLICKED, (wxObjectEventFunction) &wxSurfaceMPR::OnVisibleTissueC );
00961         Connect(_chkD_box2->GetId() , wxEVT_COMMAND_CHECKBOX_CLICKED, (wxObjectEventFunction) &wxSurfaceMPR::OnVisibleTissueD );
00962         Connect(_chkAA_box2->GetId() , wxEVT_COMMAND_CHECKBOX_CLICKED, (wxObjectEventFunction) &wxSurfaceMPR::OnVisibleTissueA );
00963         Connect(_chkBB_box2->GetId() , wxEVT_COMMAND_CHECKBOX_CLICKED, (wxObjectEventFunction) &wxSurfaceMPR::OnVisibleTissueB );
00964         Connect(_chkCC_box2->GetId() , wxEVT_COMMAND_CHECKBOX_CLICKED, (wxObjectEventFunction) &wxSurfaceMPR::OnVisibleTissueC );
00965         Connect(_chkDD_box2->GetId() , wxEVT_COMMAND_CHECKBOX_CLICKED, (wxObjectEventFunction) &wxSurfaceMPR::OnVisibleTissueD );
00966 
00967         Connect(_chk_box3->GetId() , wxEVT_COMMAND_CHECKBOX_CLICKED, (wxObjectEventFunction) &wxSurfaceMPR::OnVisibleVolume );
00968         Connect(_chk_box33->GetId() , wxEVT_COMMAND_CHECKBOX_CLICKED, (wxObjectEventFunction) &wxSurfaceMPR::OnVisibleVolume );
00969 
00970         return panel;
00971 }
00972 
00973 
00974 */
00975 
00976 
00977 /*
00978 
00979 //------------------------------------------------------------------------
00980 
00981 void wxSurfaceMPR::Refresh(){
00982         _vtkmprview[0]->Refresh();
00983         _vtkmprview[1]->Refresh();
00984         _vtkmprview[2]->Refresh();
00985         _vtkmprview[3]->Refresh();
00986 }
00987 
00988 
00989 //------------------------------------------------------------------------
00990 void wxSurfaceMPR::OnPositionX(wxScrollEvent& event){
00991         _vtkmpr3Ddata->SetPositionX( _sl1_box1->GetValue() );
00992     Refresh();
00993 }
00994 //------------------------------------------------------------------------
00995 void wxSurfaceMPR::OnPositionY(wxScrollEvent& event){
00996         _vtkmpr3Ddata->SetPositionY( _sl2_box1->GetValue() );
00997     Refresh();
00998 }
00999 //------------------------------------------------------------------------
01000 void wxSurfaceMPR::OnPositionZ(wxScrollEvent& event){
01001         _vtkmpr3Ddata->SetPositionZ( _sl3_box1->GetValue() );
01002     Refresh();
01003 }
01004 //------------------------------------------------------------------------
01005 void wxSurfaceMPR::OpacityTissue(int idView, int idTissue, int opacity){
01006         vtkActor *tmpActor;
01007         tmpActor = _vtkmprview[ idView ]->GetTissueActor(idTissue);
01008         tmpActor->GetProperty()->SetOpacity((float) opacity/100 );
01009         _vtkmprview[idView]->Refresh();
01010 }
01011 //------------------------------------------------------------------------
01012 void wxSurfaceMPR::OnOpacity0(wxScrollEvent& event){
01013         int opacity = _slA1_box2->GetValue();
01014         if (_chkViewA_box2->GetValue()==true){OpacityTissue(0,0, opacity ); }
01015         if (_chkViewB_box2->GetValue()==true){OpacityTissue(1,0, opacity ); }
01016         if (_chkViewC_box2->GetValue()==true){OpacityTissue(2,0, opacity ); }
01017         if (_chkViewD_box2->GetValue()==true){OpacityTissue(3,0, opacity ); }
01018 }
01019 //------------------------------------------------------------------------
01020 void wxSurfaceMPR::OnOpacity1(wxScrollEvent& event){
01021         int opacity = _slB1_box2->GetValue();
01022         if (_chkViewA_box2->GetValue()==true){OpacityTissue(0,1, opacity ); }
01023         if (_chkViewB_box2->GetValue()==true){OpacityTissue(1,1, opacity ); }
01024         if (_chkViewC_box2->GetValue()==true){OpacityTissue(2,1, opacity ); }
01025         if (_chkViewD_box2->GetValue()==true){OpacityTissue(3,1, opacity ); }
01026 }
01027 //------------------------------------------------------------------------
01028 void wxSurfaceMPR::OnOpacity2(wxScrollEvent& event){
01029         int opacity = _slC1_box2->GetValue();
01030         if (_chkViewA_box2->GetValue()==true){OpacityTissue(0,2, opacity ); }
01031         if (_chkViewB_box2->GetValue()==true){OpacityTissue(1,2, opacity ); }
01032         if (_chkViewC_box2->GetValue()==true){OpacityTissue(2,2, opacity ); }
01033         if (_chkViewD_box2->GetValue()==true){OpacityTissue(3,2, opacity ); }
01034 }
01035 //------------------------------------------------------------------------
01036 void wxSurfaceMPR::OnOpacity3(wxScrollEvent& event){
01037         int opacity = _slD1_box2->GetValue();
01038         if (_chkViewA_box2->GetValue()==true){OpacityTissue(0,3, opacity ); }
01039         if (_chkViewB_box2->GetValue()==true){OpacityTissue(1,3, opacity ); }
01040         if (_chkViewC_box2->GetValue()==true){OpacityTissue(2,3, opacity ); }
01041         if (_chkViewD_box2->GetValue()==true){OpacityTissue(3,3, opacity ); }
01042 }
01043 //------------------------------------------------------------------------
01044 void wxSurfaceMPR::OnIsoValue0(wxScrollEvent& event){
01045         int isoValue=_slA2_box2->GetValue() * 50 + _slA3_box2->GetValue();
01046         _vtkmpr3Ddata->SetIsovalue(0,isoValue);
01047         wxString tmpStr;
01048         tmpStr.Printf("%d",isoValue);
01049         _text_A->SetLabel(tmpStr);
01050     Refresh();
01051 }
01052 //------------------------------------------------------------------------
01053 void wxSurfaceMPR::OnIsoValue1(wxScrollEvent& event){
01054         int isoValue=_slB2_box2->GetValue() * 50 + _slB3_box2->GetValue();
01055         _vtkmpr3Ddata->SetIsovalue(1,isoValue);
01056         wxString tmpStr;
01057         tmpStr.Printf("%d",isoValue);
01058         _text_B->SetLabel(tmpStr);
01059     Refresh();
01060 }
01061 //------------------------------------------------------------------------
01062 void wxSurfaceMPR::OnIsoValue2(wxScrollEvent& event){
01063         int isoValue=_slC2_box2->GetValue() * 50 + _slC3_box2->GetValue();
01064         _vtkmpr3Ddata->SetIsovalue(2,isoValue);
01065         wxString tmpStr;
01066         tmpStr.Printf("%d",isoValue);
01067         _text_C->SetLabel(tmpStr);
01068     Refresh();
01069 }
01070 //------------------------------------------------------------------------
01071 void wxSurfaceMPR::OnIsoValue3(wxScrollEvent& event){
01072         int isoValue=_slD2_box2->GetValue() * 50 + _slD3_box2->GetValue();
01073         _vtkmpr3Ddata->SetIsovalue(3,isoValue);
01074         wxString tmpStr;
01075         tmpStr.Printf("%d",isoValue);
01076         _text_D->SetLabel(tmpStr);
01077     Refresh();
01078 }
01079 
01080 
01081 
01082 //------------------------------------------------------------------------
01083 void wxSurfaceMPR::OnIsoValue_0(wxScrollEvent& event){
01084         int isoValue=_slA2_box2->GetValue() * 50 + _slA3_box2->GetValue();
01085         wxString tmpStr;
01086         tmpStr.Printf("%d",isoValue);
01087         _text_A->SetLabel(tmpStr);
01088 }
01089 //------------------------------------------------------------------------
01090 void wxSurfaceMPR::OnIsoValue_1(wxScrollEvent& event){
01091         int isoValue=_slB2_box2->GetValue() * 50 + _slB3_box2->GetValue();
01092         wxString tmpStr;
01093         tmpStr.Printf("%d",isoValue);
01094         _text_B->SetLabel(tmpStr);
01095 }
01096 //------------------------------------------------------------------------
01097 void wxSurfaceMPR::OnIsoValue_2(wxScrollEvent& event){
01098         int isoValue=_slC2_box2->GetValue() * 50 + _slC3_box2->GetValue();
01099         wxString tmpStr;
01100         tmpStr.Printf("%d",isoValue);
01101         _text_C->SetLabel(tmpStr);
01102 }
01103 //------------------------------------------------------------------------
01104 void wxSurfaceMPR::OnIsoValue_3(wxScrollEvent& event){
01105         int isoValue=_slD2_box2->GetValue() * 50 + _slD3_box2->GetValue();
01106         wxString tmpStr;
01107         tmpStr.Printf("%d",isoValue);
01108         _text_D->SetLabel(tmpStr);
01109 }
01110 
01111 
01112 //------------------------------------------------------------------------
01113 void wxSurfaceMPR::OnBtnColourA(wxCommandEvent& event){
01114   wxColourDialog dlgColour(this);
01115   dlgColour.ShowModal();
01116 }
01117 //------------------------------------------------------------------------
01118 void wxSurfaceMPR::OnBtnColourB(wxCommandEvent& event){
01119   wxColourDialog dlgColour(this);
01120   dlgColour.ShowModal();
01121 }
01122 //------------------------------------------------------------------------
01123 void wxSurfaceMPR::OnBtnColourC(wxCommandEvent& event){
01124   wxColourDialog dlgColour(this);
01125   dlgColour.ShowModal();
01126 }
01127 //------------------------------------------------------------------------
01128 void wxSurfaceMPR::OnBtnColourD(wxCommandEvent& event){
01129   wxColourDialog dlgColour(this);
01130   dlgColour.ShowModal();
01131 }
01132 //------------------------------------------------------------------------
01133 void wxSurfaceMPR::VisibleActor(int idView, int idTissue, bool visTissue, bool visGuide){
01134         _vtkmprview[idView]->VisibleActor(idTissue, visTissue, visGuide);
01135         _vtkmprview[idView]->Refresh();
01136 }
01137 //------------------------------------------------------------------------
01138 void wxSurfaceMPR::VisibleImageActor(int idView, int idTissue, bool visible){
01139         _vtkmprview[idView]->VisibleImageActor(idTissue, visible);
01140         _vtkmprview[idView]->Refresh();
01141 }
01142 //------------------------------------------------------------------------
01143 void wxSurfaceMPR::OnVisibleX(wxCommandEvent& event){
01144         bool visible = _chk1_box1->GetValue();
01145         if (_chkViewA_box2->GetValue()==true){VisibleImageActor(0,0, visible ); }
01146         if (_chkViewB_box2->GetValue()==true){VisibleImageActor(1,0, visible ); }
01147         if (_chkViewC_box2->GetValue()==true){VisibleImageActor(2,0, visible ); }
01148         if (_chkViewD_box2->GetValue()==true){VisibleImageActor(3,0, visible ); }
01149 }
01150 //------------------------------------------------------------------------
01151 void wxSurfaceMPR::OnVisibleY(wxCommandEvent& event){
01152         bool visible = _chk2_box1->GetValue();
01153         if (_chkViewA_box2->GetValue()==true){VisibleImageActor(0,1, visible ); }
01154         if (_chkViewB_box2->GetValue()==true){VisibleImageActor(1,1, visible ); }
01155         if (_chkViewC_box2->GetValue()==true){VisibleImageActor(2,1, visible ); }
01156         if (_chkViewD_box2->GetValue()==true){VisibleImageActor(3,1, visible ); }
01157 }
01158 //------------------------------------------------------------------------
01159 void wxSurfaceMPR::OnVisibleZ(wxCommandEvent& event){
01160         bool visible = _chk3_box1->GetValue();
01161         if (_chkViewA_box2->GetValue()==true){VisibleImageActor(0,2, visible ); }
01162         if (_chkViewB_box2->GetValue()==true){VisibleImageActor(1,2, visible ); }
01163         if (_chkViewC_box2->GetValue()==true){VisibleImageActor(2,2, visible ); }
01164         if (_chkViewD_box2->GetValue()==true){VisibleImageActor(3,2, visible ); }
01165 }
01166 //------------------------------------------------------------------------
01167 void wxSurfaceMPR::OnVisibleTissueA(wxCommandEvent& event){
01168         bool visiTissue = _chkA_box2->GetValue();
01169         bool visGuide = _chkAA_box2->GetValue();
01170         if (_chkViewA_box2->GetValue()==true){VisibleActor(0,0, visiTissue, visGuide ); }
01171         if (_chkViewB_box2->GetValue()==true){VisibleActor(1,0, visiTissue, visGuide ); }
01172         if (_chkViewC_box2->GetValue()==true){VisibleActor(2,0, visiTissue, visGuide ); }
01173         if (_chkViewD_box2->GetValue()==true){VisibleActor(3,0, visiTissue, visGuide ); }
01174 }
01175 //------------------------------------------------------------------------
01176 void wxSurfaceMPR::OnVisibleTissueB(wxCommandEvent& event){
01177         bool visiTissue = _chkA_box2->GetValue();
01178         bool visGuide = _chkAA_box2->GetValue();
01179         if (_chkViewA_box2->GetValue()==true){VisibleActor(0,1, visiTissue, visGuide ); }
01180         if (_chkViewB_box2->GetValue()==true){VisibleActor(1,1, visiTissue, visGuide ); }
01181         if (_chkViewC_box2->GetValue()==true){VisibleActor(2,1, visiTissue, visGuide ); }
01182         if (_chkViewD_box2->GetValue()==true){VisibleActor(3,1, visiTissue, visGuide ); }
01183 }
01184 //------------------------------------------------------------------------
01185 void wxSurfaceMPR::OnVisibleTissueC(wxCommandEvent& event){
01186         bool visiTissue = _chkA_box2->GetValue();
01187         bool visGuide = _chkAA_box2->GetValue();
01188         if (_chkViewA_box2->GetValue()==true){VisibleActor(0,2, visiTissue, visGuide ); }
01189         if (_chkViewB_box2->GetValue()==true){VisibleActor(1,2, visiTissue, visGuide ); }
01190         if (_chkViewC_box2->GetValue()==true){VisibleActor(2,2, visiTissue, visGuide ); }
01191         if (_chkViewD_box2->GetValue()==true){VisibleActor(3,2, visiTissue, visGuide ); }
01192 }
01193 //------------------------------------------------------------------------
01194 void wxSurfaceMPR::OnVisibleTissueD(wxCommandEvent& event){
01195         bool visiTissue = _chkA_box2->GetValue();
01196         bool visGuide = _chkAA_box2->GetValue();
01197         if (_chkViewA_box2->GetValue()==true){VisibleActor(0,3, visiTissue, visGuide ); }
01198         if (_chkViewB_box2->GetValue()==true){VisibleActor(1,3, visiTissue, visGuide ); }
01199         if (_chkViewC_box2->GetValue()==true){VisibleActor(2,3, visiTissue, visGuide ); }
01200         if (_chkViewD_box2->GetValue()==true){VisibleActor(3,3, visiTissue, visGuide ); }
01201 }
01202 //------------------------------------------------------------------------
01203 void wxSurfaceMPR::VisibleVolumeActor(int idView, bool visVolume, bool visGuide){
01204         _vtkmprview[idView]->VisibleVolumeActor( visVolume,visGuide);
01205         _vtkmprview[idView]->Refresh();
01206 }
01207 //------------------------------------------------------------------------
01208 void wxSurfaceMPR::OnVisibleVolume(wxCommandEvent& event){
01209         bool visVolume = _chk_box3->GetValue();
01210         bool visGuide = _chk_box33->GetValue();
01211         if (_chkViewA_box2->GetValue()==true){VisibleVolumeActor(0, visVolume, visGuide); }
01212         if (_chkViewB_box2->GetValue()==true){VisibleVolumeActor(1, visVolume, visGuide); }
01213         if (_chkViewC_box2->GetValue()==true){VisibleVolumeActor(2, visVolume, visGuide); }
01214         if (_chkViewD_box2->GetValue()==true){VisibleVolumeActor(3, visVolume, visGuide); }
01215 }
01216 
01217 //------------------------------------------------------------------------
01218 void wxSurfaceMPR::ConfigureVTK(){
01219         _vtkmprview[0]->Configure();
01220         _vtkmprview[1]->Configure();
01221         _vtkmprview[2]->Configure();
01222         _vtkmprview[3]->Configure();
01223 }
01224 
01225 
01226 */

Generated on 18 Mar 2010 for creaMaracasVisu_lib by  doxygen 1.6.1