]> Creatis software - creaMaracasVisu.git/commitdiff
changes in viewers
authorJuan Prieto <Juan.Prieto@creatis.insa-lyon.fr>
Wed, 25 Aug 2010 17:51:12 +0000 (17:51 +0000)
committerJuan Prieto <Juan.Prieto@creatis.insa-lyon.fr>
Wed, 25 Aug 2010 17:51:12 +0000 (17:51 +0000)
13 files changed:
lib/maracasVisuLib/src/interface/wxWindows/widgets/vtkImageViewer2_XYZ.cxx
lib/maracasVisuLib/src/interface/wxWindows/widgets/vtkImageViewer2_XYZ.h
lib/maracasVisuLib/src/interface/wxWindows/widgets/vtkInteractorStyleBaseView.cxx
lib/maracasVisuLib/src/interface/wxWindows/widgets/vtkMPR3DDataViewer.cxx
lib/maracasVisuLib/src/interface/wxWindows/widgets/wxMaracas_N_ViewersWidget.cxx
lib/maracasVisuLib/src/interface/wxWindows/widgets/wxMaracas_ViewerWidget.cxx
lib/maracasVisuLib/src/interface/wxWindows/widgets/wxVTKRenderWindowInteractor.cxx
lib/maracasVisuLib/src/interface/wxWindows/widgets/wxVtk2DBaseView.cxx
lib/maracasVisuLib/src/interface/wxWindows/widgets/wxVtk2DBaseView.h
lib/maracasVisuLib/src/interface/wxWindows/widgets/wxVtkMPR2DView.cxx
lib/maracasVisuLib/src/interface/wxWindows/widgets/wxVtkMPR3DView.cxx
lib/maracasVisuLib/src/interface/wxWindows/widgets/wxVtkMPR3DViewCntrlPanel.cxx
lib/maracasVisuLib/src/kernel/PlanesOperations.cxx

index faea7924aff0177fcc2f715596311a0c47e05faf..50252cb60338da67918490af5c4abf96a0d21362 100644 (file)
@@ -1,6 +1,7 @@
 #include "vtkImageViewer2_XYZ.h"
 #include "vtkRenderer.h"
 #include "vtkImageActor.h"
+#include "vtkImageData.h"
 //-------------------------------------------------------------------
 //-------------------------------------------------------------------
 //-------------------------------------------------------------------
@@ -9,7 +10,7 @@ vtkImageViewer2_XYZ::vtkImageViewer2_XYZ()
        _vtkimageviewer2=  vtkImageViewer2::New();
        _vtkimageviewer2->GetRenderer()->GradientBackgroundOn();
        _vtkimageviewer2->GetRenderer()->SetBackground( 0.33 , 0.33 , 0.33 );
-       _vtkimageviewer2->GetRenderer()->SetBackground2( 0.66 , 0.66 , 0.66 );  
+       _vtkimageviewer2->GetRenderer()->SetBackground2( 0.66 , 0.66 , 0.66 );
        _colortable = NULL;
 }
 //-------------------------------------------------------------------
@@ -88,6 +89,7 @@ vtkImageViewer2 *vtkImageViewer2_XYZ::GetVtkImageViewer2()
 
 void vtkImageViewer2_XYZ::setColorTransferFunction(vtkColorTransferFunction* colortable){
 
+       
        vtkImageMapToWindowLevelColors* imagemaptowindowlevel = _vtkimageviewer2->GetWindowLevel();
 
        if(colortable!=NULL&&colortable->GetSize()>0 && _colortable != colortable){
index 24cb363903fdf6a5e4aea8598902e1f26fae09fb..7d231a60374b642bdafd4d184f153b3f7b41cbf6 100644 (file)
@@ -22,15 +22,19 @@ public:
        int                             GetXSlice();
        int                             GetYSlice();
        int                             GetZSlice();
-       vtkImageViewer2 *GetVtkImageViewer2();
+       
 
        void setColorTransferFunction(vtkColorTransferFunction* colortable);
 
+       vtkImageViewer2 *GetVtkImageViewer2();
 private:
        int     _x1,_x2,_y1,_y2,_z1,_z2;
        vtkImageViewer2 *_vtkimageviewer2;
        vtkColorTransferFunction* _colortable;
+       
+       
 protected:     
+       
 };
 
 
index 2e973842d0bee3858cfe2f2cfd09ba8907de918e..6ed188aeb752215aca6d00cb5569d0548f1b4a87 100644 (file)
@@ -236,25 +236,27 @@ void  vtkInteractorStyleBaseView::OnChar()  // virtual
 //---------------------------------------------------------------------------
 void vtkInteractorStyleBaseView::TransformCoordinate(double &X, double &Y, double &Z)
 {
-    vtkImageViewer2 *imageViewer = ((wxVtk2DBaseView*)GetWxVtk2DBaseView())->_imageViewer2XYZ->GetVtkImageViewer2();
+       if(((wxVtk2DBaseView*)GetWxVtk2DBaseView())->_imageViewer2XYZ){
+               vtkImageViewer2 *imageViewer = ((wxVtk2DBaseView*)GetWxVtk2DBaseView())->_imageViewer2XYZ->GetVtkImageViewer2();
 
-       imageViewer->GetRenderer()->SetDisplayPoint((int)X, (int)Y, (int)Z);
-       imageViewer->GetRenderer()->DisplayToWorld();
-       double fP[4];
-       imageViewer->GetRenderer()->GetWorldPoint( fP );
+               imageViewer->GetRenderer()->SetDisplayPoint((int)X, (int)Y, (int)Z);
+               imageViewer->GetRenderer()->DisplayToWorld();
+               double fP[4];
+               imageViewer->GetRenderer()->GetWorldPoint( fP );
 
-       if ( fP[3] ){
-               fP[0] /= fP[3];
-               fP[1] /= fP[3];
-               fP[2] /= fP[3];
-       }
+               if ( fP[3] ){
+                       fP[0] /= fP[3];
+                       fP[1] /= fP[3];
+                       fP[2] /= fP[3];
+               }
 
-// EEDx5
-       ((wxVtk2DBaseView*)GetWxVtk2DBaseView())->TransformCoordinate_spacing_ViewToModel(fP[0],fP[1],fP[2]);
+       // EEDx5
+               ((wxVtk2DBaseView*)GetWxVtk2DBaseView())->TransformCoordinate_spacing_ViewToModel(fP[0],fP[1],fP[2]);
 
-       X=fP[0];
-       Y=fP[1];
-       Z=fP[2];
+               X=fP[0];
+               Y=fP[1];
+               Z=fP[2];
+       }
 }
 //---------------------------------------------------------------------------
 void vtkInteractorStyleBaseView::SetwxVtkBaseView(wxVtkBaseView *wxvtkbaseview)
index 07c0ec1d1274530fcc15cc1ecedf00f33c688859..25f66eddeb88da0fa22d32ecd32bef63ebafed70 100644 (file)
@@ -145,155 +145,149 @@ void vtkMPR3DDataViewer::Configure()
        if(_vtkmprbasedata->GetImageData()){
                _vtkmprbasedata->GetImageData()->GetScalarRange(range);
                max = range[1];
-       }else{
-               max = 1;
-       }
-       
-       
-       
-
-       _ctFunVectorPoint.clear();
-       _ctFunVectorPoint.push_back(max*0/4);
-       _ctFunVectorPoint.push_back(max*1/4);
-       _ctFunVectorPoint.push_back(max*2/4);
-       _ctFunVectorPoint.push_back(max*3/4);
-       _ctFunVectorPoint.push_back(max*4/4);
-
-       _ctFunVectorRed.clear();
-       _ctFunVectorRed.push_back(0.0);
-       _ctFunVectorRed.push_back(1.0);
-       _ctFunVectorRed.push_back(0.0);
-       _ctFunVectorRed.push_back(0.0);
-       _ctFunVectorRed.push_back(0.0);
-
-       _ctFunVectorGreen.clear();
-       _ctFunVectorGreen.push_back(0.0);
-       _ctFunVectorGreen.push_back(0.0);
-       _ctFunVectorGreen.push_back(0.0);
-       _ctFunVectorGreen.push_back(1.0);
-       _ctFunVectorGreen.push_back(0.2);
-
-       _ctFunVectorBlue.clear();
-       _ctFunVectorBlue.push_back(0.0);
-       _ctFunVectorBlue.push_back(0.0);
-       _ctFunVectorBlue.push_back(1.0);
-       _ctFunVectorBlue.push_back(0.0);
-       _ctFunVectorBlue.push_back(0.0);
-
-
-       if(_ctfun==NULL){
-               _ctfun = vtkColorTransferFunction::New();
-       }
-       _ctfun->RemoveAllPoints();
-
-       int i,size=_ctFunVectorPoint.size();
-       for (i=0;i<size;i++)
-       {
-               _ctfun->AddRGBPoint( _ctFunVectorPoint[i] , _ctFunVectorRed[i],_ctFunVectorGreen[i],_ctFunVectorBlue[i]);
                
-       }
-/*
-       _ctfun->AddRGBPoint( 100 ,0 ,0,0);
-       _ctfun->AddRGBPoint( 200 ,1 ,0,0);
-       _ctfun->AddRGBPoint( 300 ,0 ,1,0);
-       _ctfun->AddRGBPoint( 400 ,0 ,0,1);
-*/
-//     void *p=this; // JPRx
-
-  // Create the first of the three planes. The filter vtkImageMapToColors
-  // maps the data through the corresponding lookup table created above.  The
-  // vtkImageActor is a type of vtkProp and conveniently displays an image on
-  // a single quadrilateral plane. It does this using texture mapping and as
-  // a result is quite fast. (Note: the input image has to be unsigned char
-  // values, which the vtkImageMapToColors produces.) Note also that by
-  // specifying the DisplayExtent, the pipeline requests data of this extent
-  // and the vtkImageMapToColors only processes a slice of data.
-       
-       if(_saggitalColors==NULL){
-               _saggitalColors = vtkImageMapToColors::New();
-       }
-       _saggitalColors->RemoveAllInputs();
-       
-       if(_vtkmprbasedata->GetImageData()){
+               
+               _ctFunVectorPoint.clear();
+               _ctFunVectorPoint.push_back(max*0/4);
+               _ctFunVectorPoint.push_back(max*1/4);
+               _ctFunVectorPoint.push_back(max*2/4);
+               _ctFunVectorPoint.push_back(max*3/4);
+               _ctFunVectorPoint.push_back(max*4/4);
+
+               _ctFunVectorRed.clear();
+               _ctFunVectorRed.push_back(0.0);
+               _ctFunVectorRed.push_back(1.0);
+               _ctFunVectorRed.push_back(0.0);
+               _ctFunVectorRed.push_back(0.0);
+               _ctFunVectorRed.push_back(0.0);
+
+               _ctFunVectorGreen.clear();
+               _ctFunVectorGreen.push_back(0.0);
+               _ctFunVectorGreen.push_back(0.0);
+               _ctFunVectorGreen.push_back(0.0);
+               _ctFunVectorGreen.push_back(1.0);
+               _ctFunVectorGreen.push_back(0.2);
+
+               _ctFunVectorBlue.clear();
+               _ctFunVectorBlue.push_back(0.0);
+               _ctFunVectorBlue.push_back(0.0);
+               _ctFunVectorBlue.push_back(1.0);
+               _ctFunVectorBlue.push_back(0.0);
+               _ctFunVectorBlue.push_back(0.0);
+
+
+               if(_ctfun==NULL){
+                       _ctfun = vtkColorTransferFunction::New();
+               }
+               _ctfun->RemoveAllPoints();
+
+               int i,size=_ctFunVectorPoint.size();
+               for (i=0;i<size;i++)
+               {
+                       _ctfun->AddRGBPoint( _ctFunVectorPoint[i] , _ctFunVectorRed[i],_ctFunVectorGreen[i],_ctFunVectorBlue[i]);
+                       
+               }
+       /*
+               _ctfun->AddRGBPoint( 100 ,0 ,0,0);
+               _ctfun->AddRGBPoint( 200 ,1 ,0,0);
+               _ctfun->AddRGBPoint( 300 ,0 ,1,0);
+               _ctfun->AddRGBPoint( 400 ,0 ,0,1);
+       */
+       //      void *p=this; // JPRx
+
+       // Create the first of the three planes. The filter vtkImageMapToColors
+       // maps the data through the corresponding lookup table created above.  The
+       // vtkImageActor is a type of vtkProp and conveniently displays an image on
+       // a single quadrilateral plane. It does this using texture mapping and as
+       // a result is quite fast. (Note: the input image has to be unsigned char
+       // values, which the vtkImageMapToColors produces.) Note also that by
+       // specifying the DisplayExtent, the pipeline requests data of this extent
+       // and the vtkImageMapToColors only processes a slice of data.
+               
+               if(_saggitalColors==NULL){
+                       _saggitalColors = vtkImageMapToColors::New();
+               }
+               _saggitalColors->RemoveAllInputs();
                _saggitalColors->SetInput( _vtkmprbasedata->GetImageData() );
-       }
-//    _saggitalColors->SetLookupTable(_bwLut);
-       
-    _saggitalColors->SetLookupTable(_ctfun);
-       
+               
+       //    _saggitalColors->SetLookupTable(_bwLut);
+               
+               _saggitalColors->SetLookupTable(_ctfun);
+               
 
-       if(_saggital==NULL){
-               _saggital = vtkImageActor::New();
-               _saggital->SetInput(_saggitalColors->GetOutput());
-       }       
-       //_saggitalColors->Update();
-    
+               if(_saggital==NULL){
+                       _saggital = vtkImageActor::New();
+                       _saggital->SetInput(_saggitalColors->GetOutput());
+               }       
+               //_saggitalColors->Update();
+       
 
 
-  // Create the second (axial) plane of the three planes. We use the
-  // same approach as before except that the extent differs.
+       // Create the second (axial) plane of the three planes. We use the
+       // same approach as before except that the extent differs.
 
-       
-       if(_axialColors==NULL){
-               _axialColors = vtkImageMapToColors::New();
-       }
+               
+               if(_axialColors==NULL){
+                       _axialColors = vtkImageMapToColors::New();
+               }
 
-       _axialColors->RemoveAllInputs();
-       if(_vtkmprbasedata->GetImageData()){
+               _axialColors->RemoveAllInputs();
                _axialColors->SetInput( _vtkmprbasedata->GetImageData() );
-       }
-//    _axialColors->SetLookupTable(_hueLut);
-    _axialColors->SetLookupTable(_ctfun);
+       //    _axialColors->SetLookupTable(_hueLut);
+               _axialColors->SetLookupTable(_ctfun);
 
-       if(_axial==NULL){
-               _axial = vtkImageActor::New();
-               _axial->SetInput(_axialColors->GetOutput());
-       }
+               if(_axial==NULL){
+                       _axial = vtkImageActor::New();
+                       _axial->SetInput(_axialColors->GetOutput());
+               }
+               
+               //_axialColors->Update();
        
-       //_axialColors->Update();
-    
 
-       // Create the third (coronal) plane of the three planes. We use 
-  // the same approach as before except that the extent differs.
-       if(_coronalColors==NULL){
-               _coronalColors = vtkImageMapToColors::New();
-       }
-       _coronalColors->RemoveAllInputs();
-       if(_vtkmprbasedata->GetImageData()){
+               // Create the third (coronal) plane of the three planes. We use 
+       // the same approach as before except that the extent differs.
+               if(_coronalColors==NULL){
+                       _coronalColors = vtkImageMapToColors::New();
+               }
+               _coronalColors->RemoveAllInputs();
                _coronalColors->SetInput( _vtkmprbasedata->GetImageData() );
-       }
-//    _coronalColors->SetLookupTable(_satLut);
-    _coronalColors->SetLookupTable(_ctfun);
+       //    _coronalColors->SetLookupTable(_satLut);
+               _coronalColors->SetLookupTable(_ctfun);
 
-       if(_coronal==NULL){
-               _coronal = vtkImageActor::New();
-               _coronal->SetInput(_coronalColors->GetOutput());
-       }
+               if(_coronal==NULL){
+                       _coronal = vtkImageActor::New();
+                       _coronal->SetInput(_coronalColors->GetOutput());
+               }
+               
        
-    
 
-  // An outline provides context around the data.
-  //
-       if(_outlineData==NULL){
-               _outlineData = vtkOutlineFilter::New();
-       }
-       _outlineData->RemoveAllInputs();
-       if(_vtkmprbasedata->GetImageData()){
-               _outlineData->SetInput((vtkDataSet *) _vtkmprbasedata->GetImageData() );
+       // An outline provides context around the data.
+       //
+               if(_outlineData==NULL){
+                       _outlineData = vtkOutlineFilter::New();
+               }
+               _outlineData->RemoveAllInputs();
+               if(_vtkmprbasedata->GetImageData()){
+                       _outlineData->SetInput((vtkDataSet *) _vtkmprbasedata->GetImageData() );
+               }
+
+               if(_mapOutline==NULL){
+                       _mapOutline = vtkPolyDataMapper::New();
+                       _mapOutline->SetInput(_outlineData->GetOutput());
+               }
+               _mapOutline->Update();    
+               //_mapOutline->RemoveAllInputs();
+       
+               if(_outline==NULL){
+                       _outline = vtkActor::New();
+                       _outline->SetMapper(_mapOutline);
+                       _outline->GetProperty()->SetColor(0,0,0);
+               }
        }
+       
+       
 
-       if(_mapOutline==NULL){
-               _mapOutline = vtkPolyDataMapper::New();
-               _mapOutline->SetInput(_outlineData->GetOutput());
-       }
-       _mapOutline->Update();    
-       //_mapOutline->RemoveAllInputs();
-    
-       if(_outline==NULL){
-               _outline = vtkActor::New();
-               _outline->SetMapper(_mapOutline);
-               _outline->GetProperty()->SetColor(0,0,0);
-       }
+       
        
     
 
@@ -325,19 +319,25 @@ vtkImageActor * vtkMPR3DDataViewer::GetvtkActor_axial()
 void vtkMPR3DDataViewer::SetPositionX(int pos){
        int x1,x2,y1,y2,z1,z2;
        _vtkmprbasedata->GetDimensionExtention(&x1,&x2,&y1,&y2,&z1,&z2);
-       _saggital->SetDisplayExtent( pos , pos , y1 ,y2 , z1 , z2 );
+       if(_saggital){
+               _saggital->SetDisplayExtent( pos , pos , y1 ,y2 , z1 , z2 );
+       }
 }
 //------------------------------------------------------------------------
 void vtkMPR3DDataViewer::SetPositionY(int pos){
        int x1,x2,y1,y2,z1,z2;
        _vtkmprbasedata->GetDimensionExtention(&x1,&x2,&y1,&y2,&z1,&z2);
-       _coronal->SetDisplayExtent(x1,x2, pos,pos, z1,z2);
+       if(_coronal){
+               _coronal->SetDisplayExtent(x1,x2, pos,pos, z1,z2);
+       }
 }
 //------------------------------------------------------------------------
 void vtkMPR3DDataViewer::SetPositionZ(int pos){
        int x1,x2,y1,y2,z1,z2;
        _vtkmprbasedata->GetDimensionExtention(&x1,&x2,&y1,&y2,&z1,&z2);
-       _axial->SetDisplayExtent(x1,x2, y1,y2, pos,pos);
+       if(_axial){
+               _axial->SetDisplayExtent(x1,x2, y1,y2, pos,pos);
+       }
 }
 //-------------------------------------------------------------------
 void vtkMPR3DDataViewer::SetVisiblePosition(int idPosition, bool visible)
@@ -351,8 +351,10 @@ bool vtkMPR3DDataViewer::GetVisiblePosition(int idPosition)
 }
 
 void vtkMPR3DDataViewer::setColorTransferFunction(vtkColorTransferFunction* colortable){
-       _saggitalColors->SetLookupTable(colortable);
-        _coronalColors->SetLookupTable(colortable);
-       _axialColors->SetLookupTable(colortable);
+       if(_saggitalColors){
+               _saggitalColors->SetLookupTable(colortable);
+               _coronalColors->SetLookupTable(colortable);
+               _axialColors->SetLookupTable(colortable);
+       }
 }
 
index c097c93ca832c5fc1370ea1ea33defe46f8ed47a..b89ff63d3a371c9d568458d20d978b66c79a6479 100644 (file)
@@ -3,8 +3,8 @@
   Program:   wxMaracas
   Module:    $RCSfile: wxMaracas_N_ViewersWidget.cxx,v $
   Language:  C++
-  Date:      $Date: 2010/08/04 18:45:27 $
-  Version:   $Revision: 1.18 $
+  Date:      $Date: 2010/08/25 17:51:12 $
+  Version:   $Revision: 1.19 $
 
   Copyright: (c) 2002, 2003
   License:
                        extent[2] = 0;
                        extent[3] = 1;
                        extent[4] = 0;
-                       extent[5] = 1;
+                       extent[5] = 0;
                        
                        imagedata = vtkImageData::New();
                        imagedata->SetSpacing(spc);
                        imagedata->SetExtent(extent);
-                       imagedata->SetScalarTypeToUnsignedShort();
+                       imagedata->SetScalarTypeToUnsignedChar();
                        imagedata->AllocateScalars();
                }*/
                
         if (wxwindow2!=NULL) { wxwindow2->SetImage(image); } 
         if (wxwindow3!=NULL) { wxwindow3->SetImage(image); }
         if (wxwindow4!=NULL) { wxwindow4->SetImage(image); }
-        
         ConfigureVTK();
         
  }
index 58fc9ecbd72bff3307a35851b61beef84e57598d..1ae47ff4e6fd3f7e8ac6636efd90d2c5f90f372e 100644 (file)
@@ -3,8 +3,8 @@
   Program:   wxMaracas
   Module:    $RCSfile: wxMaracas_ViewerWidget.cxx,v $
   Language:  C++
-  Date:      $Date: 2010/08/21 15:19:14 $
-  Version:   $Revision: 1.29 $
+  Date:      $Date: 2010/08/25 17:51:12 $
+  Version:   $Revision: 1.30 $
 
   Copyright: (c) 2002, 2003
   License:
                if ( mwidgetMesure       !=NULL ) { mwidgetMesure->SetActiveLink(true);         }
                if ( mwidgetMesure       !=NULL ) { mwidgetMesure->SetMesureScale( 1 );         }
                if ( mwxsphereview       !=NULL ) { mwxsphereview->Configure();                 }
+               
 
                if (mwxvtk3Dbaseview_Clipping3D !=NULL) 
                {
                if (vtkmpr3Ddataviewer                  !=NULL)
                {                       
                        vtkmpr3Ddataviewer->Configure();                        
+
                }
+               
+
 
                if (mwxvtkmpr3Dview                     !=NULL)
                {                       
+
                        mwxvtkmpr3Dview->Configure();
                        mwxvtkmpr3Dview->ResetCamera(ext,org,spc);
                }
                { 
                        mwxvtkclipping3Dview->Configure();      
                }
+
+               
+               if (mwxvtkclipping3Dview                !=NULL) { mwxvtkclipping3Dview->Configure();    }
+
                
                //if(vtkmpr3Ddataviewer!=NULL){vtkmpr3Ddataviewer->Configure();}
 //             RefreshView();
        //-------------------------------------------------------------------------
        void wxMaracas_ViewerWidget::RefreshView()
        {
-               
                        if (mvtk2Dbaseview              !=NULL ){ mvtk2Dbaseview->Refresh();            }
                        if (mvtkmpr2Dview_X             !=NULL ){ mvtkmpr2Dview_X->Refresh();           }
                        if (mvtkmpr2Dview_Y             !=NULL ){ mvtkmpr2Dview_Y->Refresh();           }
index 9c313b558d4a29683686f73eb5ba669cc0329cb2..692419ad63be654a4504975c62c30a200dc93f48 100644 (file)
@@ -3,8 +3,8 @@
   Program:   Visualization Toolkit
   Module:    $RCSfile: wxVTKRenderWindowInteractor.cxx,v $
   Language:  C++
-  Date:      $Date: 2009/05/14 13:54:35 $
-  Version:   $Revision: 1.3 $
+  Date:      $Date: 2010/08/25 17:51:12 $
+  Version:   $Revision: 1.4 $
 
   Copyright (c) 1993-2002 Ken Martin, Will Schroeder, Bill Lorensen 
   All rights reserved.
@@ -351,6 +351,7 @@ void wxVTKRenderWindowInteractor::OnPaint(wxPaintEvent& WXUNUSED(event))
   //std::cout << "wxVTKRenderWindowInteractor::OnPaint"<<std::endl;
   Render();
 
+ //  this->Refresh();
 #if defined(__WXGTK__) && defined(USE_WXGLCANVAS)
   //  bbtkDebugMessage("Core",9,"wxVTKRenderWindowInteractor::OnPaint   public wxGLCanvas, virtual public vtkRenderWindowInteractor  \n");
 #else
index eba5e3e48aac346dce4f9862e18b638a2ab05bde..4203d27b4a45884df23c9a168dbec48283fbbcad 100644 (file)
@@ -157,6 +157,7 @@ void wxVtk2DBaseView::Configure(bool okimage)
 
        vtkImageData *imageData = GetVtkBaseData()->GetMarImageData()->GetImageData();
        if (imageData!=NULL){
+               
                imageData->UpdateInformation();
                imageData->SetUpdateExtent( imageData->GetWholeExtent());
                imageData->Update();
index 7516b6c0104e8b839cce0c31ee36a43fc95884a4..37fd7270f5834e347d6136bf0855a0d2fe38e370 100644 (file)
@@ -6,6 +6,7 @@
 
 //class vtkInteractorStyleBaseView;
 #include "vtkInteractorStyleBaseView.h"
+#include "vtkInteractorStyleBaseView2D.h"
 class vtkInfoTextImage;
 class vtkInfoTextImageInteractor;
 
@@ -45,6 +46,7 @@ private:
 
        vtkInfoTextImage                                        *_vtkIinfoTextImage;
        vtkInfoTextImageInteractor                      *_vtkIinfoTextImageInteractor;
+       vtkInteractorStyleBaseView2D * _style2D;
 
 protected:
 
index b5279649f1df3dd5de6860d4c7c225bdc0d33018..247113eba042eaa7eca7d54e038665e6b4c17cf8 100644 (file)
@@ -42,13 +42,6 @@ vtkMPRBaseData *wxVtkMPR2DView::GetVtkmprbasedata()
 //-------------------------------------------------------------------
 void wxVtkMPR2DView::Configure(){
        wxVtk2DBaseView::Configure();
-
-       if(_interactorstylemprview==NULL)       
-       {
-               _interactorstylemprview = new vtkInteractorStyleMPRView();
-               ((vtkInteractorStyleBaseView*)GetInteractorStyleBaseView())->AddInteractorStyleMaracas( _interactorstylemprview );
-       }
-       
        
 
        int x1,x2,y1,y2,z1,z2;
@@ -56,6 +49,12 @@ void wxVtkMPR2DView::Configure(){
 
        double spc[3];
        vtkImageData* img =  GetVtkmprbasedata()->GetImageData();
+       if(_interactorstylemprview==NULL)       
+       {
+               _interactorstylemprview = new vtkInteractorStyleMPRView();
+               ((vtkInteractorStyleBaseView*)GetInteractorStyleBaseView())->AddInteractorStyleMaracas( _interactorstylemprview );
+       }
+       
        if(img!=NULL){
                double* origin = img->GetOrigin();
                img->GetExtent(x1,x2,y1,y2,z1,z2);
@@ -75,6 +74,9 @@ void wxVtkMPR2DView::Configure(){
                z2 = (int)(z2*spc[2]);
 
                _visibleAxis = true;
+               
+               
+               
        }
        
        // Axe A
@@ -95,8 +97,6 @@ void wxVtkMPR2DView::Configure(){
                _lineAMapper->SetInput(_pdA);
                _lineAMapper->ImmediateModeRenderingOn();
                _lineAActor->SetMapper(_lineAMapper);
-               
-               _imageViewer2XYZ->GetVtkImageViewer2()->GetRenderer()->AddActor( _lineAActor );
        }       
        
        vtkCellArray *linesA = vtkCellArray::New();
@@ -108,10 +108,6 @@ void wxVtkMPR2DView::Configure(){
        linesA->Delete();  //do not delete lines ??
 //             _lineAActor->GetProperty()->BackfaceCullingOn();
        
-       
-
-
-       
 
 // Axe B
        if(_lineBActor==NULL){
@@ -127,8 +123,6 @@ void wxVtkMPR2DView::Configure(){
                _ptsB->SetPoint(1,  1000        ,  1000 ,  1000 );
                
 //             _lineBActor->GetProperty()->BackfaceCullingOn();
-               
-               _imageViewer2XYZ->GetVtkImageViewer2()->GetRenderer()->AddActor( _lineBActor );
        }
        
        vtkCellArray *linesB;
@@ -146,56 +140,60 @@ void wxVtkMPR2DView::Configure(){
        _lineBMapper->ImmediateModeRenderingOn();
 
 
-       vtkCamera *camera =_imageViewer2XYZ->GetVtkImageViewer2()->GetRenderer()->GetActiveCamera();
-       
-//EED 17Avril2009
-/*             
-       if (_direction==0) {
-               camera->SetViewUp               (   0   ,    -1         ,     0         );
-               camera->SetPosition             ( -10000,(y1+y2)/2      , (z1+z2)/2     ); 
-               camera->SetFocalPoint   (   0   , (y1+y2)/2     , (z1+z2)/2     );
-               camera->SetParallelScale( (z2-z1)/3.0 );
-       }
+       if(_imageViewer2XYZ){
+               _imageViewer2XYZ->GetVtkImageViewer2()->GetRenderer()->AddActor( _lineAActor );
+               _imageViewer2XYZ->GetVtkImageViewer2()->GetRenderer()->AddActor( _lineBActor );
+               vtkCamera *camera =_imageViewer2XYZ->GetVtkImageViewer2()->GetRenderer()->GetActiveCamera();
+               
+       //EED 17Avril2009
+       /*              
+               if (_direction==0) {
+                       camera->SetViewUp               (   0   ,    -1         ,     0         );
+                       camera->SetPosition             ( -10000,(y1+y2)/2      , (z1+z2)/2     ); 
+                       camera->SetFocalPoint   (   0   , (y1+y2)/2     , (z1+z2)/2     );
+                       camera->SetParallelScale( (z2-z1)/3.0 );
+               }
 
-       if (_direction==1) { 
-               camera->SetViewUp               (       0               ,       0       ,       -1              );
-               camera->SetPosition             ((x1+x2)/2      , 10000 , (z1+z2)/2     ); 
-               camera->SetFocalPoint   ((x1+x2)/2      ,   0   , (z1+z2)/2     );
-               camera->SetParallelScale( (x2-x1)/3.0 );
-       }
+               if (_direction==1) { 
+                       camera->SetViewUp               (       0               ,       0       ,       -1              );
+                       camera->SetPosition             ((x1+x2)/2      , 10000 , (z1+z2)/2     ); 
+                       camera->SetFocalPoint   ((x1+x2)/2      ,   0   , (z1+z2)/2     );
+                       camera->SetParallelScale( (x2-x1)/3.0 );
+               }
 
-       if (_direction==2) { 
-               camera->SetViewUp               (       0               ,       -1              ,       0       );
-               camera->SetPosition             ((x1+x2)/2      , (y1+y2)/2     , -10000); 
-               camera->SetFocalPoint   ((x1+x2)/2      , (y1+y2)/2     ,       0       ); 
-               camera->SetParallelScale( (x2-x1)/3.0 );
-       }
-*/
+               if (_direction==2) { 
+                       camera->SetViewUp               (       0               ,       -1              ,       0       );
+                       camera->SetPosition             ((x1+x2)/2      , (y1+y2)/2     , -10000); 
+                       camera->SetFocalPoint   ((x1+x2)/2      , (y1+y2)/2     ,       0       ); 
+                       camera->SetParallelScale( (x2-x1)/3.0 );
+               }
+       */
 
-       if (_direction==0) {    // YZ
-               camera->SetViewUp               (   0   ,     1         ,     0         );
-               camera->SetPosition             (  10000,(y1+y2)/2      , (z1+z2)/2     ); 
-               camera->SetFocalPoint   (   0   , (y1+y2)/2     , (z1+z2)/2     );
-               camera->SetParallelScale( (z2-z1)/3.0 );
-       }
-       
-       if (_direction==1) {    // XZ
-               camera->SetViewUp               (       0               ,       0       ,       -1              );
-               camera->SetPosition             ((x1+x2)/2      , 10000 , (z1+z2)/2     ); 
-               camera->SetFocalPoint   ((x1+x2)/2      ,   0   , (z1+z2)/2     );
-               camera->SetParallelScale( (x2-x1)/3.0 );
-       }
-       
-       if (_direction==2) {    // XY
-               camera->SetViewUp               (       0               ,       1               ,       0       );
-               camera->SetPosition             ((x1+x2)/2      , (y1+y2)/2     ,  10000); 
-               camera->SetFocalPoint   ((x1+x2)/2      , (y1+y2)/2     ,       0       ); 
-               camera->SetParallelScale( (x2-x1)/3.0 );
-       }
-       
+               if (_direction==0) {    // YZ
+                       camera->SetViewUp               (   0   ,     1         ,     0         );
+                       camera->SetPosition             (  10000,(y1+y2)/2      , (z1+z2)/2     ); 
+                       camera->SetFocalPoint   (   0   , (y1+y2)/2     , (z1+z2)/2     );
+                       camera->SetParallelScale( (z2-z1)/3.0 );
+               }
+               
+               if (_direction==1) {    // XZ
+                       camera->SetViewUp               (       0               ,       0       ,       -1              );
+                       camera->SetPosition             ((x1+x2)/2      , 10000 , (z1+z2)/2     ); 
+                       camera->SetFocalPoint   ((x1+x2)/2      ,   0   , (z1+z2)/2     );
+                       camera->SetParallelScale( (x2-x1)/3.0 );
+               }
+               
+               if (_direction==2) {    // XY
+                       camera->SetViewUp               (       0               ,       1               ,       0       );
+                       camera->SetPosition             ((x1+x2)/2      , (y1+y2)/2     ,  10000); 
+                       camera->SetFocalPoint   ((x1+x2)/2      , (y1+y2)/2     ,       0       ); 
+                       camera->SetParallelScale( (x2-x1)/3.0 );
+               }
+               
 
-//     _imageViewer2XYZ->GetVtkImageViewer2()->SetColorWindow (160);
-//     _imageViewer2XYZ->GetVtkImageViewer2()->SetColorLevel (800);
+       //      _imageViewer2XYZ->GetVtkImageViewer2()->SetColorWindow (160);
+       //      _imageViewer2XYZ->GetVtkImageViewer2()->SetColorLevel (800);
+       }
 
 }
 
@@ -267,22 +265,24 @@ void wxVtkMPR2DView::Refresh()
                if ((x!=_backX) || (y!=_backY) || (z!=_backZ)) {
 
                        if (_direction==0) {    // YZ 
-                               _imageViewer2XYZ->SetXSlice( (int)(GetVtkmprbasedata()->GetX()) ); 
+                               if(_imageViewer2XYZ)
+                                       _imageViewer2XYZ->SetXSlice( (int)(GetVtkmprbasedata()->GetX()) ); 
                                _ptsA->SetPoint(0, x2, y1  , z );
                                _ptsA->SetPoint(1, x2, y2  , z );
                                _ptsB->SetPoint(0, x2, y   , z1);
                                _ptsB->SetPoint(1, x2, y   , z2);
                        }
                        if (_direction==1) {    // XZ
-                               _imageViewer2XYZ->SetYSlice( (int)(GetVtkmprbasedata()->GetY()) ); 
+                               if(_imageViewer2XYZ)
+                                       _imageViewer2XYZ->SetYSlice( (int)(GetVtkmprbasedata()->GetY()) ); 
                            _ptsA->SetPoint(0, x1 , y2 , z );
                                _ptsA->SetPoint(1, x2 , y2 , z );
                                _ptsB->SetPoint(0, x  , y2 , z1);
                                _ptsB->SetPoint(1, x  , y2 , z2);
                        }
                        if (_direction==2) {    // XY
-                               _imageViewer2XYZ->SetZSlice( (int)(GetVtkmprbasedata()->GetZ()) ); 
-                               _imageViewer2XYZ->SetZSlice( (int)(GetVtkmprbasedata()->GetZ()) ); 
+                               if(_imageViewer2XYZ)
+                                       _imageViewer2XYZ->SetZSlice( (int)(GetVtkmprbasedata()->GetZ()) ); 
                        //      _ptsA->SetPoint(0, x1 , y , -z2 );
                        //      _ptsA->SetPoint(1, x2 , y , -z2 );
                        //      _ptsB->SetPoint(0, x  , y1, -z2 );
index e406380814b179a5794fffd504f142716790fcd9..67ecb3fe665ddf113d04ce5dda2cd3023a08ae94 100644 (file)
@@ -28,7 +28,9 @@ wxVtkMPR3DView::wxVtkMPR3DView( wxVtk3DBaseView *wxvtk3Dbaseview )
        _probe                                          =       NULL;
        _contourMapper                          =       NULL;
        
-       
+       _planeWidgetX = 0;
+       _planeWidgetY = 0;
+       _planeWidgetZ = 0;
        //EED Fev 3 2010
        //Free Planes 
 }
@@ -138,88 +140,92 @@ void wxVtkMPR3DView::Configure(){
        //}
        vtkmyPWCallback_3DPointWidget *_myCallback = vtkmyPWCallback_3DPointWidget::New();
        _myCallback->SetWxVtkMPR3DView(this);
-       if(_pointWidget!=NULL){
-               _pointWidget->Delete();
-       }
-       _pointWidget = vtkPointWidget::New();
-       _myCallback->SetVtkPointWidget(_pointWidget);
-       _pointWidget->SetInteractor( GetWxvtk3Dbaseview()->GetWxVTKRenderWindowInteractor() ); 
        
-       if(imageData){
-               _pointWidget->SetInput( imageData );
-       }
        
-       _pointWidget->AllOff();
-       
-       _pointWidget->PlaceWidget();
-//     _pointWidget->SetPosition( x,y,z ); 
-       
-//EED01 29Mars2009
-// MACOS probleme vtk-window out of wx-window  
-//     _pointWidget->On();
-       
-       _pointWidget->AddObserver(vtkCommand::InteractionEvent,_myCallback);
-
-
-// PlaneWidget
-       if(_planeWidget!=NULL)
-       {
-               _planeWidget->Delete();
-       }
-       _planeWidget = vtkPlaneWidget::New();
-       _myCallback->SetVtkPlaneWidget(_planeWidget);
        if(imageData){
+               if(_pointWidget==NULL){
+                       _pointWidget = vtkPointWidget::New();
+               }
+               _pointWidget->SetInput( imageData );
+               _myCallback->SetVtkPointWidget(_pointWidget);
+               _pointWidget->SetInteractor( GetWxvtk3Dbaseview()->GetWxVTKRenderWindowInteractor() ); 
+               _pointWidget->AllOff();
+               _pointWidget->PlaceWidget();
+               
+               _pointWidget->AddObserver(vtkCommand::InteractionEvent,_myCallback);
+               
+               
+               if(_planeWidget==NULL)
+               {
+                       _planeWidget = vtkPlaneWidget::New();
+               }
                _planeWidget->SetInput( imageData );
-       }
-       _planeWidget->NormalToXAxisOn();
-       _planeWidget->SetResolution(50);
-       _planeWidget->SetRepresentationToOutline();
-       int dim[3];
-       if(imageData){
-               imageData->GetDimensions(dim);
-       }else{
-               dim[0] = 0;
-               dim[1] = 0;
-               dim[2] = 0;
-       }
-       int px=(dim[0]/2);
-       int py=(dim[1]/2);
-       int pz=(dim[2]/2);
-       int dd=20;
-       _planeWidget->PlaceWidget( px-dd , px+dd , py-dd , py+dd , pz-dd , pz+dd );
-
-
-       if(_vtkplane==NULL){
-               _vtkplane = vtkPolyData::New();
                
-               _probe = vtkProbeFilter::New();
-               _probe->SetInput(_vtkplane);
+               _myCallback->SetVtkPlaneWidget(_planeWidget);
 
-               _contourMapper = vtkPolyDataMapper::New();
+               _planeWidget->NormalToXAxisOn();
+               _planeWidget->SetResolution(50);
+               _planeWidget->SetRepresentationToOutline();
+               
+               int dim[3];
+       
+               imageData->GetDimensions(dim);
+               int px=(dim[0]/2);
+               int py=(dim[1]/2);
+               int pz=(dim[2]/2);
+               int dd=20;
+               _planeWidget->PlaceWidget( px-dd , px+dd , py-dd , py+dd , pz-dd , pz+dd );
                
-               _contourMapper->SetInput( _probe->GetPolyDataOutput() );
+               if(_vtkplane==NULL){
+                       _vtkplane = vtkPolyData::New();
+                       
+                       _probe = vtkProbeFilter::New();
+                       _probe->SetInput(_vtkplane);
 
-               _contourPlaneActor = vtkActor::New();
-               _contourPlaneActor->SetMapper(_contourMapper);
+                       _contourMapper = vtkPolyDataMapper::New();
+                       
+                       _contourMapper->SetInput( _probe->GetPolyDataOutput() );
 
-               _contourPlaneActor->VisibilityOff();
+                       _contourPlaneActor = vtkActor::New();
+                       _contourPlaneActor->SetMapper(_contourMapper);
 
-               _planeWidget->SetInteractor( GetWxvtk3Dbaseview()->GetWxVTKRenderWindowInteractor() );
-               _planeWidget->AddObserver(vtkCommand::InteractionEvent,_myCallback);
+                       _contourPlaneActor->VisibilityOff();
 
-               _planeWidget->Off();
-               _wxvtk3Dbaseview->GetRenderer()->AddActor( _contourPlaneActor );        
+                       _planeWidget->SetInteractor( GetWxvtk3Dbaseview()->GetWxVTKRenderWindowInteractor() );
+                       _planeWidget->AddObserver(vtkCommand::InteractionEvent,_myCallback);
 
-       }
+                       _planeWidget->Off();
+                       _wxvtk3Dbaseview->GetRenderer()->AddActor( _contourPlaneActor );        
 
-       _planeWidget->GetPolyData(_vtkplane);
-       if(imageData){
+               }
+
+               _planeWidget->GetPolyData(_vtkplane);
                _probe->SetSource( imageData );
                _contourMapper->SetScalarRange( imageData->GetScalarRange() );
+               
+               
+               ConfigureFreePlanes();
        }
        
-       ConfigureFreePlanes();
+//     _pointWidget->SetPosition( x,y,z ); 
+       
+//EED01 29Mars2009
+// MACOS probleme vtk-window out of wx-window  
+//     _pointWidget->On();
+       
+       
+
+
+// PlaneWidget
+       
+       
+       
+       
+       
+       
+
+
+       
 }
 
 //-------------------------------------------------------------------
@@ -294,27 +300,30 @@ vtkImagePlaneWidget* wxVtkMPR3DView::GetPlaneWidget(unsigned char activationkey,
 //-------------------------------------------------------------------
 void wxVtkMPR3DView::FreePlaneVisible(int plane, bool ok)
 {
-       
-       if ((plane==1) && (ok==true)) _planeWidgetX->EnabledOn();
-       if ((plane==2) && (ok==true)) _planeWidgetY->EnabledOn();
-       if ((plane==3) && (ok==true)) _planeWidgetZ->EnabledOn();
-       if ((plane==1) && (ok==false)) _planeWidgetX->EnabledOff();
-       if ((plane==2) && (ok==false)) _planeWidgetY->EnabledOff();
-       if ((plane==3) && (ok==false)) _planeWidgetZ->EnabledOff();
+       if(_planeWidgetX){
+               if ((plane==1) && (ok==true)) _planeWidgetX->EnabledOn();
+               if ((plane==2) && (ok==true)) _planeWidgetY->EnabledOn();
+               if ((plane==3) && (ok==true)) _planeWidgetZ->EnabledOn();
+               if ((plane==1) && (ok==false)) _planeWidgetX->EnabledOff();
+               if ((plane==2) && (ok==false)) _planeWidgetY->EnabledOff();
+               if ((plane==3) && (ok==false)) _planeWidgetZ->EnabledOff();
+       }
 }
 
 //-------------------------------------------------------------------
 void wxVtkMPR3DView::FreePlaneInteraction(bool ok)
 {
-       if (ok==true)
-       {
-               _planeWidgetX->InteractionOn();
-               _planeWidgetY->InteractionOn();
-               _planeWidgetZ->InteractionOn();
-       } else {
-               _planeWidgetX->InteractionOff();
-               _planeWidgetY->InteractionOff();
-               _planeWidgetZ->InteractionOff();
+       if(_planeWidgetX){
+               if (ok==true)
+               {
+                       _planeWidgetX->InteractionOn();
+                       _planeWidgetY->InteractionOn();
+                       _planeWidgetZ->InteractionOn();
+               } else {
+                       _planeWidgetX->InteractionOff();
+                       _planeWidgetY->InteractionOff();
+                       _planeWidgetZ->InteractionOff();
+               }
        }
 }
 
@@ -361,20 +370,22 @@ void wxVtkMPR3DView::RefreshView()   // virtual
        y=y*spc[1];
        z=z*spc[2];
 
-       _pointWidget->SetPosition( x,y,z ); 
+       if(_pointWidget){
+               _pointWidget->SetPosition( x,y,z ); 
 
 
-       double in[3]; 
-       double normal[3];
-       vtkTransform *transform = GetVtkMPR3DDataViewer ()->GetVtkMPRBaseData()->GetTransformOrientation();
-       in[0]=1;                in[1]=0;                        in[2]=0;
-       transform->TransformPoint(in,normal);
-       _planeWidget->SetNormal( normal[0],normal[1],normal[2] );
+               double in[3]; 
+               double normal[3];
+               vtkTransform *transform = GetVtkMPR3DDataViewer ()->GetVtkMPRBaseData()->GetTransformOrientation();
+               in[0]=1;                in[1]=0;                        in[2]=0;
+               transform->TransformPoint(in,normal);
+               _planeWidget->SetNormal( normal[0],normal[1],normal[2] );
 
 
-       _planeWidget->SetCenter( x,y,z );
-       _planeWidget->UpdatePlacement();
-       _planeWidget->GetPolyData(_vtkplane);
+               _planeWidget->SetCenter( x,y,z );
+               _planeWidget->UpdatePlacement();
+               _planeWidget->GetPolyData(_vtkplane);
+       }
 }
 //-------------------------------------------------------------------
 wxPanel* wxVtkMPR3DView::CreateControlPanel(wxWindow *parent, bool align)
@@ -421,25 +432,29 @@ void wxVtkMPR3DView::VisibleImageActor(int idPosition, bool visible){
 //-------------------------------------------------------------------
 void wxVtkMPR3DView::VisiblePointWidget( bool visible )
 {
-       if (visible==true)
-       {
-               _pointWidget->On();
-       } else {
-               _pointWidget->Off();
+       if(_pointWidget){
+               if (visible==true)
+               {
+                       _pointWidget->On();
+               } else {
+                       _pointWidget->Off();
+               }
        }
 }
 
 //-------------------------------------------------------------------
 void wxVtkMPR3DView::VisiblePlaneWidget( bool visible )
 {
-       if (visible==true)
-       {
-               _planeWidget->On();
-               _contourPlaneActor->VisibilityOn();
+       if(_planeWidget){
+               if (visible==true)
+               {
+                       _planeWidget->On();
+                       _contourPlaneActor->VisibilityOn();
 
-       } else {
-               _planeWidget->Off();
-               _contourPlaneActor->VisibilityOff();
+               } else {
+                       _planeWidget->Off();
+                       _contourPlaneActor->VisibilityOff();
+               }
        }
 }
 
index cae5f74dc7422fb5fb2ffaa19a22a5d463f0dfd6..25a2781e3497d37acb1ab4077ea483a806b55568 100644 (file)
@@ -12,9 +12,9 @@ wxVtkMPR3DViewCntrlPanel::wxVtkMPR3DViewCntrlPanel(wxWindow *parent, wxVtkMPR3DV
        int maxY = _wxvtkmpr3Dview->GetVtkMPR3DDataViewer()->GetVtkMPRBaseData()->GetMaxPositionY();
        int maxZ = _wxvtkmpr3Dview->GetVtkMPR3DDataViewer()->GetVtkMPRBaseData()->GetMaxPositionZ();*/
 
-       int maxX = 1;
-       int maxY = 1;
-       int maxZ = 1;
+       //int maxX = 1;
+       //int maxY = 1;
+       //int maxZ = 1;
 
        //CPR: Modified 30 Nov 2009
        /*
@@ -28,11 +28,11 @@ wxVtkMPR3DViewCntrlPanel::wxVtkMPR3DViewCntrlPanel(wxWindow *parent, wxVtkMPR3DV
        */
 
        ckBoxX                  = new wxCheckBox(panel,-1,_T("X           "));
-       _positionX              = new wxSlider(panel,-1,maxX/2,0,maxX, wxDefaultPosition, wxSize(300,40), wxSL_HORIZONTAL | wxSL_LABELS);
+       _positionX              = new wxSlider(panel,-1,0,0,1, wxDefaultPosition, wxSize(300,40), wxSL_HORIZONTAL | wxSL_LABELS);
        ckBoxY                  = new wxCheckBox(panel,-1,_T("Y           "));
-       _positionY              = new wxSlider(panel,-1,maxY/2,0,maxY, wxDefaultPosition, wxSize(300,40), wxSL_HORIZONTAL | wxSL_LABELS);
+       _positionY              = new wxSlider(panel,-1,0,0,1, wxDefaultPosition, wxSize(300,40), wxSL_HORIZONTAL | wxSL_LABELS);
        ckBoxZ                  = new wxCheckBox(panel,-1,_T("Z           "));
-       _positionZ              = new wxSlider(panel,-1,maxZ/2,0,maxZ, wxDefaultPosition, wxSize(300,40), wxSL_HORIZONTAL | wxSL_LABELS);
+       _positionZ              = new wxSlider(panel,-1,0,0,1, wxDefaultPosition, wxSize(300,40), wxSL_HORIZONTAL | wxSL_LABELS);
        wxButton                *btnColorTable  = new wxButton (panel, -1, _T("Color Table") );
 
        _ckBoxXYZ               = new wxCheckBox(panel,-1,_T("Show XYZ axis         "));
@@ -180,7 +180,7 @@ wxVtkMPR3DViewCntrlPanel::wxVtkMPR3DViewCntrlPanel(wxWindow *parent, wxVtkMPR3DV
        panel->Layout();
 
        panel->SetEventHandler((wxEvtHandler*)this);
-
+       
        //this->UpdateControlPanel();
 }
 void wxVtkMPR3DViewCntrlPanel::UpdateControlPanel()
@@ -191,9 +191,8 @@ void wxVtkMPR3DViewCntrlPanel::UpdateControlPanel()
                /*int maxX = basedata->GetMaxPositionX();
                int maxY = basedata->GetMaxPositionY();
                int maxZ = basedata->GetMaxPositionZ();*/
+               vtkImageData* img = basedata->GetImageData();
                int x0,x1,y0,y1,z0,z1;
-
-               basedata->GetDimensionExtention(&x0,&x1,&y0,&y1,&z0,&z1);
                /*int maxX = x1-x0;//basedata->GetMaxPositionX();
                int maxY = y1-y0;//basedata->GetMaxPositionY();
                int maxZ = z1-z0;//basedata->GetMaxPositionZ();*/
@@ -202,18 +201,22 @@ void wxVtkMPR3DViewCntrlPanel::UpdateControlPanel()
                /*_positionX->SetRange(0,maxX);
                _positionY->SetRange(0,maxY);
                _positionZ->SetRange(0,maxZ);*/
-               _positionX->SetRange(x0,x1);
-               _positionY->SetRange(y0,y1);
-               _positionZ->SetRange(z0,z1);
-
-               _positionX->SetValue((x0+x1)/2);
-               _positionY->SetValue((y0+y1)/2);
-               _positionZ->SetValue((z0+z1)/2);
-
-               _positionX->Update();
-               _positionY->Update();
-               _positionZ->Update();
-               this->Update();
+               if(img){
+                       img->GetExtent(x0,x1,y0,y1,z0,z1);
+                       _positionX->SetRange(x0,x1);
+                       _positionY->SetRange(y0,y1);
+                       _positionZ->SetRange(z0,z1);
+
+                       _positionX->SetValue((x0+x1)/2);
+                       _positionY->SetValue((y0+y1)/2);
+                       _positionZ->SetValue((z0+z1)/2);
+
+                       _positionX->Update();
+                       _positionY->Update();
+                       _positionZ->Update();
+                       this->Update();
+               }
+               
        }
        
 }
index d6d6d0169b2ef4d6d84cddc110ed6c131b7ebe3e..b0c7ebd797257cd7abf1452e1ae4c30f71c0ef98 100644 (file)
@@ -35,7 +35,7 @@ double PlanesOperations::getMagnitud(double* vect)
 
        mag = sqrt(pow(vect[0],2) + pow(vect[1],2) + pow(vect[2],2));
 
-       std::cout<<"mag "<<mag <<std::endl;
+       //std::cout<<"mag "<<mag <<std::endl;
 
        return mag;
 }