From 199d5048b6c5ac6663b8671f55289e4a0820f9cc Mon Sep 17 00:00:00 2001 From: Juan Prieto Date: Wed, 25 Aug 2010 17:51:12 +0000 Subject: [PATCH] changes in viewers --- .../wxWindows/widgets/vtkImageViewer2_XYZ.cxx | 4 +- .../wxWindows/widgets/vtkImageViewer2_XYZ.h | 6 +- .../widgets/vtkInteractorStyleBaseView.cxx | 32 +- .../wxWindows/widgets/vtkMPR3DDataViewer.cxx | 278 +++++++++--------- .../widgets/wxMaracas_N_ViewersWidget.cxx | 9 +- .../widgets/wxMaracas_ViewerWidget.cxx | 14 +- .../widgets/wxVTKRenderWindowInteractor.cxx | 5 +- .../wxWindows/widgets/wxVtk2DBaseView.cxx | 1 + .../wxWindows/widgets/wxVtk2DBaseView.h | 2 + .../wxWindows/widgets/wxVtkMPR2DView.cxx | 130 ++++---- .../wxWindows/widgets/wxVtkMPR3DView.cxx | 223 +++++++------- .../widgets/wxVtkMPR3DViewCntrlPanel.cxx | 45 +-- .../src/kernel/PlanesOperations.cxx | 2 +- 13 files changed, 395 insertions(+), 356 deletions(-) diff --git a/lib/maracasVisuLib/src/interface/wxWindows/widgets/vtkImageViewer2_XYZ.cxx b/lib/maracasVisuLib/src/interface/wxWindows/widgets/vtkImageViewer2_XYZ.cxx index faea792..50252cb 100644 --- a/lib/maracasVisuLib/src/interface/wxWindows/widgets/vtkImageViewer2_XYZ.cxx +++ b/lib/maracasVisuLib/src/interface/wxWindows/widgets/vtkImageViewer2_XYZ.cxx @@ -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){ diff --git a/lib/maracasVisuLib/src/interface/wxWindows/widgets/vtkImageViewer2_XYZ.h b/lib/maracasVisuLib/src/interface/wxWindows/widgets/vtkImageViewer2_XYZ.h index 24cb363..7d231a6 100644 --- a/lib/maracasVisuLib/src/interface/wxWindows/widgets/vtkImageViewer2_XYZ.h +++ b/lib/maracasVisuLib/src/interface/wxWindows/widgets/vtkImageViewer2_XYZ.h @@ -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: + }; diff --git a/lib/maracasVisuLib/src/interface/wxWindows/widgets/vtkInteractorStyleBaseView.cxx b/lib/maracasVisuLib/src/interface/wxWindows/widgets/vtkInteractorStyleBaseView.cxx index 2e97384..6ed188a 100644 --- a/lib/maracasVisuLib/src/interface/wxWindows/widgets/vtkInteractorStyleBaseView.cxx +++ b/lib/maracasVisuLib/src/interface/wxWindows/widgets/vtkInteractorStyleBaseView.cxx @@ -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) diff --git a/lib/maracasVisuLib/src/interface/wxWindows/widgets/vtkMPR3DDataViewer.cxx b/lib/maracasVisuLib/src/interface/wxWindows/widgets/vtkMPR3DDataViewer.cxx index 07c0ec1..25f66ed 100644 --- a/lib/maracasVisuLib/src/interface/wxWindows/widgets/vtkMPR3DDataViewer.cxx +++ b/lib/maracasVisuLib/src/interface/wxWindows/widgets/vtkMPR3DDataViewer.cxx @@ -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;iAddRGBPoint( _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;iAddRGBPoint( _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); + } } diff --git a/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxMaracas_N_ViewersWidget.cxx b/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxMaracas_N_ViewersWidget.cxx index c097c93..b89ff63 100644 --- a/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxMaracas_N_ViewersWidget.cxx +++ b/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxMaracas_N_ViewersWidget.cxx @@ -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: @@ -98,12 +98,12 @@ 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(); }*/ @@ -298,7 +298,6 @@ if (wxwindow2!=NULL) { wxwindow2->SetImage(image); } if (wxwindow3!=NULL) { wxwindow3->SetImage(image); } if (wxwindow4!=NULL) { wxwindow4->SetImage(image); } - ConfigureVTK(); } diff --git a/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxMaracas_ViewerWidget.cxx b/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxMaracas_ViewerWidget.cxx index 58fc9ec..1ae47ff 100644 --- a/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxMaracas_ViewerWidget.cxx +++ b/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxMaracas_ViewerWidget.cxx @@ -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: @@ -296,6 +296,7 @@ if ( mwidgetMesure !=NULL ) { mwidgetMesure->SetActiveLink(true); } if ( mwidgetMesure !=NULL ) { mwidgetMesure->SetMesureScale( 1 ); } if ( mwxsphereview !=NULL ) { mwxsphereview->Configure(); } + if (mwxvtk3Dbaseview_Clipping3D !=NULL) { @@ -305,10 +306,14 @@ if (vtkmpr3Ddataviewer !=NULL) { vtkmpr3Ddataviewer->Configure(); + } + + if (mwxvtkmpr3Dview !=NULL) { + mwxvtkmpr3Dview->Configure(); mwxvtkmpr3Dview->ResetCamera(ext,org,spc); } @@ -317,6 +322,10 @@ { mwxvtkclipping3Dview->Configure(); } + + + if (mwxvtkclipping3Dview !=NULL) { mwxvtkclipping3Dview->Configure(); } + //if(vtkmpr3Ddataviewer!=NULL){vtkmpr3Ddataviewer->Configure();} // RefreshView(); @@ -336,7 +345,6 @@ //------------------------------------------------------------------------- void wxMaracas_ViewerWidget::RefreshView() { - if (mvtk2Dbaseview !=NULL ){ mvtk2Dbaseview->Refresh(); } if (mvtkmpr2Dview_X !=NULL ){ mvtkmpr2Dview_X->Refresh(); } if (mvtkmpr2Dview_Y !=NULL ){ mvtkmpr2Dview_Y->Refresh(); } diff --git a/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxVTKRenderWindowInteractor.cxx b/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxVTKRenderWindowInteractor.cxx index 9c313b5..692419a 100644 --- a/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxVTKRenderWindowInteractor.cxx +++ b/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxVTKRenderWindowInteractor.cxx @@ -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"<Refresh(); #if defined(__WXGTK__) && defined(USE_WXGLCANVAS) // bbtkDebugMessage("Core",9,"wxVTKRenderWindowInteractor::OnPaint public wxGLCanvas, virtual public vtkRenderWindowInteractor \n"); #else diff --git a/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxVtk2DBaseView.cxx b/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxVtk2DBaseView.cxx index eba5e3e..4203d27 100644 --- a/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxVtk2DBaseView.cxx +++ b/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxVtk2DBaseView.cxx @@ -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(); diff --git a/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxVtk2DBaseView.h b/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxVtk2DBaseView.h index 7516b6c..37fd727 100644 --- a/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxVtk2DBaseView.h +++ b/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxVtk2DBaseView.h @@ -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: diff --git a/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxVtkMPR2DView.cxx b/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxVtkMPR2DView.cxx index b527964..247113e 100644 --- a/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxVtkMPR2DView.cxx +++ b/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxVtkMPR2DView.cxx @@ -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 ); diff --git a/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxVtkMPR3DView.cxx b/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxVtkMPR3DView.cxx index e406380..67ecb3f 100644 --- a/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxVtkMPR3DView.cxx +++ b/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxVtkMPR3DView.cxx @@ -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(); + } } } diff --git a/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxVtkMPR3DViewCntrlPanel.cxx b/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxVtkMPR3DViewCntrlPanel.cxx index cae5f74..25a2781 100644 --- a/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxVtkMPR3DViewCntrlPanel.cxx +++ b/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxVtkMPR3DViewCntrlPanel.cxx @@ -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(); + } + } } diff --git a/lib/maracasVisuLib/src/kernel/PlanesOperations.cxx b/lib/maracasVisuLib/src/kernel/PlanesOperations.cxx index d6d6d01..b0c7ebd 100644 --- a/lib/maracasVisuLib/src/kernel/PlanesOperations.cxx +++ b/lib/maracasVisuLib/src/kernel/PlanesOperations.cxx @@ -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 "<