X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=lib%2FmaracasVisuLib%2Fsrc%2Finterface%2FwxWindows%2Fwidgets%2FvtkPlane2DView.cxx;h=1016dd464e1fdb5b03c5483b99418953634a35ba;hb=c5bb8b228d6fcd2a4ea1d6210bfa3a39d6bcac33;hp=d41521c4e21c6851eb091d8dfb3f2af340ea5a87;hpb=889b7474b2622f88b108fecc9786258a5a30e41f;p=creaMaracasVisu.git diff --git a/lib/maracasVisuLib/src/interface/wxWindows/widgets/vtkPlane2DView.cxx b/lib/maracasVisuLib/src/interface/wxWindows/widgets/vtkPlane2DView.cxx index d41521c..1016dd4 100644 --- a/lib/maracasVisuLib/src/interface/wxWindows/widgets/vtkPlane2DView.cxx +++ b/lib/maracasVisuLib/src/interface/wxWindows/widgets/vtkPlane2DView.cxx @@ -1,3 +1,28 @@ +/*# --------------------------------------------------------------------- +# +# Copyright (c) CREATIS (Centre de Recherche en Acquisition et Traitement de l'Image +# pour la Sant�) +# Authors : Eduardo Davila, Frederic Cervenansky, Claire Mouton +# Previous Authors : Laurent Guigues, Jean-Pierre Roux +# CreaTools website : www.creatis.insa-lyon.fr/site/fr/creatools_accueil +# +# This software is governed by the CeCILL-B license under French law and +# abiding by the rules of distribution of free software. You can use, +# modify and/ or redistribute the software under the terms of the CeCILL-B +# license as circulated by CEA, CNRS and INRIA at the following URL +# http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html +# or in the file LICENSE.txt. +# +# As a counterpart to the access to the source code and rights to copy, +# modify and redistribute granted by the license, users are provided only +# with a limited warranty and the software's author, the holder of the +# economic rights, and the successive licensors have only limited +# liability. +# +# The fact that you are presently reading this means that you have had +# knowledge of the CeCILL-B license and that you accept its terms. +# ------------------------------------------------------------------------ */ + #include "vtkPlane2DView.h" #include "vtkCellArray.h" @@ -37,24 +62,22 @@ vtkPlane2DView::vtkPlane2DView( wxWindow *parent) _imageResult = NULL; // line horizontal - _pts = NULL; - _lineActor = NULL; - _lineMapper = NULL; - _pd = NULL; + _pts = NULL; + _lineActor = NULL; + _lineMapper = NULL; + _pd = NULL; - _interactorstyleplane2D = false; + _interactorstyleplane2D = NULL; } //------------------------------------------------------------------- vtkPlane2DView::~vtkPlane2DView() { ResetPlane(); - // Horizontal Line if (_pts != NULL) { _pts -> Delete(); } if (_lineActor != NULL) { _lineActor -> Delete(); } if (_lineMapper != NULL) { _lineMapper -> Delete(); } if (_pd != NULL) { _pd -> Delete(); } - _transform1 -> Delete(); _transform2 -> Delete(); } @@ -72,12 +95,14 @@ void vtkPlane2DView::ResetBack() } //------------------------------------------------------------------- -void vtkPlane2DView::ResetPlane(){ +void vtkPlane2DView::ResetPlane() +{ if (_pSource !=NULL) { _pSource -> Delete(); } if (_3Dslices !=NULL) { _3Dslices -> Delete(); } if (_stPoints !=NULL) { _stPoints -> Delete(); } if (_change !=NULL) { _change -> Delete(); } } + //------------------------------------------------------------------- vtkMPRBaseData *vtkPlane2DView::GetVtkmprbasedata() { @@ -133,7 +158,6 @@ void vtkPlane2DView::SetPSource(int sizeIma){ //------------------------------------------------------------------- void vtkPlane2DView::ExtractPlane() { - double x = GetVtkmprbasedata()->GetX(); double y = GetVtkmprbasedata()->GetY(); double z = GetVtkmprbasedata()->GetZ(); @@ -198,7 +222,6 @@ void vtkPlane2DView::ExtractPlane() } //------------------------------------------------------------------- - void vtkPlane2DView::Extract_One_PlaneVTK() { vtkImageData *imagedata = GetVtkmprbasedata()->GetImageData(); @@ -219,27 +242,22 @@ void vtkPlane2DView::Extract_One_PlaneVTK() } //------------------------------------------------------------------- - void vtkPlane2DView::Extract_MIP_PlaneVTK( /*double heightDefinition*/ ) { - int mipWidth; double sp; int sizeWidth = (_mip_width*2)+1 ; int deltaPixel; int iWidth,itmp,tmpSizeWith; - double spc[3]; vtkImageData *imagedata = GetVtkmprbasedata()->GetImageData(); SetPSource(_sizeIma); imagedata->GetSpacing(spc); - bool heightDefinition=false; if (_mip_width<3) { heightDefinition=true; } - if (heightDefinition==true) { mipWidth = _mip_width; @@ -252,14 +270,9 @@ void vtkPlane2DView::Extract_MIP_PlaneVTK( /*double heightDefinition*/ ) sizeWidth = tmpSizeWith; deltaPixel = 4; } - - - std::vector< vtkProbeFilter* > slicesLST; - _pSource->Push( -mipWidth * sp ); _pSource->Update(); - for ( iWidth=0 ; iWidthPush( sp ); } - if (_imageResult ==NULL) { _imageResult = vtkImageData::New(); @@ -281,20 +293,15 @@ void vtkPlane2DView::Extract_MIP_PlaneVTK( /*double heightDefinition*/ ) _imageResult -> AllocateScalars(); _imageResult -> Update(); } - unsigned short *pTemp; unsigned short *pResult; pResult = (unsigned short*)_imageResult->GetScalarPointer( 0 , 0 , 0 ); - int iPixels , sizePixels = _sizeIma*_sizeIma; for(iPixels=0 ; iPixelsGetOutput()->GetPointData()->GetScalars()->GetVoidPointer(0); - pResult = (unsigned short*)_imageResult->GetScalarPointer( 0 , 0 , 0 ); pResult[iPixels] = pTemp[iPixels]; - for (iWidth=1;iWidthGetOutput()->GetPointData()->GetScalars()->GetVoidPointer(0); @@ -304,7 +311,6 @@ void vtkPlane2DView::Extract_MIP_PlaneVTK( /*double heightDefinition*/ ) pResult[iPixels] = pTemp[iPixels]; } } - if (deltaPixel!=1) { for (itmp=1;itmpDelete(); } - _imageResult->Modified(); _imageViewer2XYZ->GetVtkImageViewer2()->SetInput ( _imageResult ); - } //------------------------------------------------------------------- @@ -344,7 +346,22 @@ void vtkPlane2DView::Configure( ) // SetActive(false); _imageViewer2XYZ -> GetVtkImageViewer2() -> SetupInteractor ( iren ); - SetInteractorStyleImage( vtkInteractorStyleBaseView2D::New() ); + ////////////// + //RaC 04-2010 Look for the description of new changes in vtkInteractorStyleBaseView2D constructor. + // + // Previous version + // SetInteractorStyleImage( vtkInteractorStyleBaseView2D::New() ); + // + // Actual version + vtkInteractorStyleBaseView2D *style2D = vtkInteractorStyleBaseView2D::New(); + manualInteractorWindowLevel *_manualinteractorwindowlevel= new manualInteractorWindowLevel(); + style2D->SetInteractorWindowLevel( _manualinteractorwindowlevel ); + vtkInteractorScrollZ *_vtkInteractorScrollZ = new vtkInteractorScrollZ(); + style2D->SetInteractorScrollZ(_vtkInteractorScrollZ); + SetInteractorStyleImage( style2D ); + + // RaC + ////////////// _interactorstyleplane2D = new vtkInteractorStylePlane2D(); ((vtkInteractorStyleBaseView*)GetInteractorStyleBaseView())->AddInteractorStyleMaracas( _interactorstyleplane2D ); @@ -367,8 +384,6 @@ void vtkPlane2DView::Configure( ) _vtkInfoTextImageInteractorPlane2D->SetModelVtkInfoTextImage(_vtkInfoTextImage); _vtkInfoTextImage->Configure(); ((vtkInteractorStyleBaseView*)this->GetInteractorStyleBaseView())->AddInteractorStyleMaracas(_vtkInfoTextImageInteractorPlane2D); - - } //------------------------------------------------------------------- @@ -406,6 +421,7 @@ void vtkPlane2DView::RotationStart() vtkTransform *transform = mprbasedata->GetTransformOrientation(); _transform1->SetMatrix( transform->GetMatrix() ); } + //------------------------------------------------------------------- void vtkPlane2DView::RotationDrag(double vx, double vy, bool ok_v, bool ok_ang) { @@ -439,6 +455,7 @@ void vtkPlane2DView::RotationDrag(double vx, double vy, bool ok_v, bool ok_ang) void vtkPlane2DView::Refresh( ) { ExtractPlane(); + UpdateColorWindowLevel(); wxVtkBaseView::Refresh(); } //------------------------------------------------------------------- @@ -518,19 +535,16 @@ void vtkPlane2DView::SetVisibleLine(bool ok) } _lineActor->GetProperty()->SetOpacity(opacity); } + // ---------------------------------------------------------------------------- -void vtkPlane2DView::TransfromeCoordViewWorld2(double &X, double &Y, double &Z) +void vtkPlane2DView::TransfromCoordViewWorld2(double &X, double &Y, double &Z) { double spc[3]; GetVtkmprbasedata()->GetImageData()->GetSpacing(spc); - double xx = X; double yy = Y; double zz = 0; - - TransfromeCoordScreenToWorld(xx,yy,zz); - - + TransFromCoordScreenToWorld(xx,yy,zz); vtkTransform *transf1 = vtkTransform::New(); transf1->Identity(); vtkTransform *transf2 = GetVtkmprbasedata()->GetTransformOrientation(); @@ -541,13 +555,10 @@ void vtkPlane2DView::TransfromeCoordViewWorld2(double &X, double &Y, double &Z) in[1] = xx - center; in[2] = yy - center; in[3] = 0; - transf1->MultiplyPoint(in,out); transf1->Delete(); - X = out[0] + GetVtkmprbasedata()->GetX() ; Y = out[1] + GetVtkmprbasedata()->GetY() ; Z = out[2] + GetVtkmprbasedata()->GetZ() ; - }