X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=lib%2FmaracasVisuLib%2Fsrc%2Finterface%2FwxWindows%2Fwidgets%2FwxVtkMPR2DView.cxx;h=247113eba042eaa7eca7d54e038665e6b4c17cf8;hb=e5dd3702826e57ae15d40b8cda521e8ae17d5c57;hp=b5279649f1df3dd5de6860d4c7c225bdc0d33018;hpb=d653db1bd5d3650822d8c8f6febd9e1ab59cd701;p=creaMaracasVisu.git 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 );