X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=lib%2FmaracasVisuLib%2Fsrc%2Finterface%2FwxWindows%2Fwidgets%2FwxMPRWidget.cxx;h=806b3d9c3762e3f514b8c2459dd19d1d76815484;hb=5966a6fc8f1b45882a5f2ab391c92d3c80f8c137;hp=38720c05fa171d1f1687f091a58fc50a80cdc41c;hpb=e6b030ceb3ee4eea1f012e7d5c47503cf6322c61;p=creaMaracasVisu.git diff --git a/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxMPRWidget.cxx b/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxMPRWidget.cxx index 38720c0..806b3d9 100644 --- a/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxMPRWidget.cxx +++ b/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxMPRWidget.cxx @@ -3,8 +3,8 @@ Program: wxMaracas Module: $RCSfile: wxMPRWidget.cxx,v $ Language: C++ - Date: $Date: 2009/03/24 10:49:21 $ - Version: $Revision: 1.5 $ + Date: $Date: 2009/04/23 10:15:56 $ + Version: $Revision: 1.10 $ Copyright: (c) 2002, 2003 License: @@ -1381,9 +1381,11 @@ void vtkPlane2DView::Configure( ) GetInteractorStyleBaseView()->AddInteractorStyleMaracas( _interactorstyleplane2D ); vtkCamera *camera =_imageViewer2XYZ->GetVtkImageViewer2()->GetRenderer()->GetActiveCamera(); + camera->SetViewUp ( 0 , 1 , 0 ); - camera->SetFocalPoint ((0+_sizeIma)/2 , (0+_sizeIma)/2 , 0 ); camera->SetPosition ((0+_sizeIma)/2 , (0+_sizeIma)/2 , 10000 ); + + camera->SetFocalPoint ((0+_sizeIma)/2 , (0+_sizeIma)/2 , 0 ); camera->SetClippingRange(0.01, 100000); camera->ComputeViewPlaneNormal(); camera->SetParallelScale( _sizeIma/3.0 ); @@ -1973,7 +1975,6 @@ vtkMPRBaseData *wxVtkMPR2DView::GetVtkmprbasedata() void wxVtkMPR2DView::Configure(){ wxVtk2DBaseView::Configure(); - _interactorstylemprview = new vtkInteractorStyleMPRView(); GetInteractorStyleBaseView()->AddInteractorStyleMaracas( _interactorstylemprview ); @@ -2013,7 +2014,7 @@ void wxVtkMPR2DView::Configure(){ _lineAMapper->SetInput(_pdA); _lineAMapper->ImmediateModeRenderingOn(); _lineAActor->SetMapper(_lineAMapper); - _lineAActor->GetProperty()->BackfaceCullingOn(); +// _lineAActor->GetProperty()->BackfaceCullingOn(); _lineAActor->GetProperty()->SetDiffuseColor(1,0,0); _lineAActor->GetProperty()->SetLineWidth(2); _imageViewer2XYZ->GetVtkImageViewer2()->GetRenderer()->AddActor( _lineAActor ); @@ -2037,12 +2038,16 @@ void wxVtkMPR2DView::Configure(){ _lineBMapper->SetInput(_pdB); _lineBMapper->ImmediateModeRenderingOn(); _lineBActor->SetMapper(_lineBMapper); - _lineBActor->GetProperty()->BackfaceCullingOn(); +// _lineBActor->GetProperty()->BackfaceCullingOn(); _lineBActor->GetProperty()->SetDiffuseColor(1,0,0); _lineBActor->GetProperty()->SetLineWidth(2); _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 ); @@ -2063,8 +2068,32 @@ void wxVtkMPR2DView::Configure(){ camera->SetFocalPoint ((x1+x2)/2 , (y1+y2)/2 , 0 ); camera->SetParallelScale( (x2-x1)/3.0 ); } - } + */ + 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==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 ); + } + + + + } // _imageViewer2XYZ->GetVtkImageViewer2()->SetColorWindow (160); // _imageViewer2XYZ->GetVtkImageViewer2()->SetColorLevel (800); @@ -2137,17 +2166,23 @@ void wxVtkMPR2DView::Refresh() } if (_direction==1) { _imageViewer2XYZ->SetYSlice( (int)(GetVtkmprbasedata()->GetY()) ); - _ptsA->SetPoint(0, x1 , y2 , z ); + _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) { _imageViewer2XYZ->SetZSlice( (int)(GetVtkmprbasedata()->GetZ()) ); - _ptsA->SetPoint(0, x1 , y , -z2 ); - _ptsA->SetPoint(1, x2 , y , -z2 ); - _ptsB->SetPoint(0, x , y1, -z2 ); - _ptsB->SetPoint(1, x , y2, -z2 ); + _imageViewer2XYZ->SetZSlice( (int)(GetVtkmprbasedata()->GetZ()) ); + // _ptsA->SetPoint(0, x1 , y , -z2 ); + // _ptsA->SetPoint(1, x2 , y , -z2 ); + // _ptsB->SetPoint(0, x , y1, -z2 ); + // _ptsB->SetPoint(1, x , y2, -z2 ); + + _ptsA->SetPoint(0, x1 , y , z2 ); + _ptsA->SetPoint(1, x2 , y , z2 ); + _ptsB->SetPoint(0, x , y1, z2 ); + _ptsB->SetPoint(1, x , y2, z2 ); } _backX=x; _backY=y; @@ -2474,7 +2509,7 @@ wxVtkMPR3DViewCntrlPanel::wxVtkMPR3DViewCntrlPanel(wxWindow *parent, wxVtkMPR3DV ckBoxX->SetValue(false); ckBoxY->SetValue(false); ckBoxZ->SetValue(false); - _ckBoxXYZ->SetValue(true); + _ckBoxXYZ->SetValue(false); _ckBoxPlane->SetValue(false); _positionX->SetSize(400,20); @@ -3574,7 +3609,6 @@ void wxVtkMPR3DView::Configure(){ _wxvtk3Dbaseview->GetRenderer()->ResetCameraClippingRange(); - // vtkPointWidget _myCallback = vtkmyPWCallback_3DPointWidget::New(); _myCallback->SetWxVtkMPR3DView(this); @@ -3583,10 +3617,16 @@ void wxVtkMPR3DView::Configure(){ _myCallback->SetVtkPointWidget(_pointWidget); _pointWidget->SetInteractor( GetWxvtk3Dbaseview()->GetWxVTKRenderWindowInteractor() ); _pointWidget->SetInput( GetVtkMPR3DDataViewer()->GetVtkMPRBaseData()->GetImageData() ); + _pointWidget->AllOff(); + _pointWidget->PlaceWidget(); // _pointWidget->SetPosition( x,y,z ); - _pointWidget->On(); + +//EED01 29Mars2009 +// MACOS probleme vtk-window out of wx-window +// _pointWidget->On(); + _pointWidget->AddObserver(vtkCommand::InteractionEvent,_myCallback); @@ -3619,10 +3659,12 @@ void wxVtkMPR3DView::Configure(){ contourMapper->SetScalarRange( imageData->GetScalarRange() ); _contourPlaneActor = vtkActor::New(); _contourPlaneActor->SetMapper(contourMapper); + _contourPlaneActor->VisibilityOff(); _planeWidget->SetInteractor( GetWxvtk3Dbaseview()->GetWxVTKRenderWindowInteractor() ); _planeWidget->AddObserver(vtkCommand::InteractionEvent,_myCallback); + _planeWidget->Off(); _wxvtk3Dbaseview->GetRenderer()->AddActor( _contourPlaneActor ); } @@ -4017,7 +4059,10 @@ void wxVtkClipping3DView::Configure(){ VisibleActor(3, false ); _boxWidgetS1->HandlesOn (); - _boxWidgetS1->On(); + +//EED 29Mars2009 +// _boxWidgetS1->On(); + _boxWidgetS1->Off(); _boxWidgetS1->GetPlanes( this->GetVtkClipping3DDataViewer()->GetTissuePlanes(0) ); @@ -4037,7 +4082,10 @@ void wxVtkClipping3DView::Configure(){ _boxWidgetVolume->AddObserver( vtkCommand::InteractionEvent , _vtkclipping3Ddataviewer->GetObserverV() ); _boxWidgetVolume->HandlesOn (); - _boxWidgetVolume->On(); + +//EED 29Mars2009 +// _boxWidgetVolume->On(); + _boxWidgetVolume->Off(); @@ -4672,10 +4720,10 @@ void wxPanelCuttingImageData::OnExtract(wxCommandEvent& event) double contBeforPorc = 100*(double)contBefor/(double)totalSubVolume; double contAfterPorc = 100*(double)contAfter/(double)totalSubVolume; infoToVo.Printf(_T("%dx%dx%d = %d"),dim[0],dim[1],dim[2], dim[0]*dim[1]*dim[2] ); - infoSuVo.Printf(_T("%d") , totalSubVolume); + infoSuVo.Printf(_T("%ld") , totalSubVolume); infoSuVoA.Printf(_T("%.2f"), _actualCuttingModel->GetTheoricVolume() ); - infoPixLe.Printf(_T("%d pix. (%.2f %s) - %.2f mm^3"),contBefor, contBeforPorc ,_T("%"),contBefor*volumeUnit); - infoPixHi.Printf(_T("%d pix. (%.2f %s) - %.2f mm^3"),contAfter, contAfterPorc ,_T("%"),contAfter*volumeUnit); + infoPixLe.Printf(_T("%ld pix. (%.2f %s) - %.2f mm^3"),contBefor, contBeforPorc ,_T("%"),contBefor*volumeUnit); + infoPixHi.Printf(_T("%ld pix. (%.2f %s) - %.2f mm^3"),contAfter, contAfterPorc ,_T("%"),contAfter*volumeUnit); _infoToVo->SetLabel(infoToVo); _infoSuVo->SetLabel(infoSuVo); @@ -5936,8 +5984,10 @@ void wxMPRWidget::ConfigureVTK(){ { _wxvtk3Dbaseview_Clipping3D_BB->GetInteractorStyleBaseView()->AddInteractorStyleMaracas( vtkinteractorstyle3Dview ); } - - RefreshView(true); + +//EED 29Mars2009 +// RefreshView(true); + } //----------------------------------------------------------------------------