From: eduardo.davila@creatis.insa-lyon.fr Date: Fri, 30 Oct 2026 16:58:05 +0000 (+0100) Subject: #3592 ColorLayerView in vtkPlane2DView (free 2D plane) X-Git-Url: http://git.creatis.insa-lyon.fr/pubgit/?a=commitdiff_plain;h=refs%2Fheads%2Fvtk9itk5wx3-macos;p=creaMaracasVisu.git #3592 ColorLayerView in vtkPlane2DView (free 2D plane) --- diff --git a/bbtk/src/bbcreaMaracasVisuColorLayerImageView2.cxx b/bbtk/src/bbcreaMaracasVisuColorLayerImageView2.cxx index 692bc2e1..d3045108 100644 --- a/bbtk/src/bbcreaMaracasVisuColorLayerImageView2.cxx +++ b/bbtk/src/bbcreaMaracasVisuColorLayerImageView2.cxx @@ -18,22 +18,6 @@ BBTK_BLACK_BOX_IMPLEMENTATION(ColorLayerImageView2,bbtk::AtomicBlackBox); //===== void ColorLayerImageView2::Process() { - -// THE MAIN PROCESSING METHOD BODY -// Here we simply set the input 'In' value to the output 'Out' -// And print out the output value -// INPUT/OUTPUT ACCESSORS ARE OF THE FORM : -// void bbSet{Input|Output}NAME(const TYPE&) -// const TYPE& bbGet{Input|Output}NAME() const -// Where : -// * NAME is the name of the input/output -// (the one provided in the attribute 'name' of the tag 'input') -// * TYPE is the C++ type of the input/output -// (the one provided in the attribute 'type' of the tag 'input') - // bbSetOutputOut( bbGetInputIn() ); - // std::cout << "Output value = " <ResetRefresh(); // _Xback=-9999 _Yback=-9999 _Zback=-9999 @@ -183,9 +196,9 @@ void LayerImageBase::SetImage(vtkImageData* image) spcBase[0] = 0; spcBase[1] = 0; spcBase[2] = 0; - spcBase[3] = 0; - spcBase[4] = 0; - spcBase[5] = 0; +// spcBase[3] = 0; +// spcBase[4] = 0; +// spcBase[5] = 0; _image = image; @@ -282,8 +295,6 @@ void LayerImageBase::SetDimensionBase(int dim[3]) _dimBase[2] = dim[2]; } - - //------------------------------------------------------------------------------ void LayerImageBase::GetSpcOriginalLayer(double *spc) { @@ -430,8 +441,313 @@ void LayerImageBase::CleanXYZ(double &x, double &y, double &z) } } + + //---------------------------------------------------------------------------- void LayerImageBase::onThreshold() +{ + bool ok = false; + int directionViewer = 0; + double x = GetX(); + double y = GetY(); + double z = GetZ(); + x = x*_spcBase[0]; + y = y*_spcBase[1]; + z = z*_spcBase[2]; + double rotationXactor = 0; + double rotationYactor = 0; + double rotationZactor = 0; + double AxesDirectionCosines[9]; + double positionActor[3]; + double AxesOrigin[3]; + + if (_baseView!=NULL) + { + vtkCamera *camera = _baseView->GetRenderer()->GetActiveCamera(); + if (camera->GetParallelProjection()==1) + { + wxVtk2DBaseView *wxvtk2dbasevie = (wxVtk2DBaseView *)_baseView; + directionViewer = wxvtk2dbasevie->GetDirection(); + } // ParallelProjection + + if (_image!=_imageBack) + { + ok = true; + _imageBack = _image; + } + + if (directionViewer==0) + { + if (GetX()!=_Xback) + { + ok = true; + _Xback = GetX(); + AxesDirectionCosines[0] = 0; // + AxesDirectionCosines[1] = 0; + AxesDirectionCosines[2] = 1; + AxesDirectionCosines[3] = 0; // + AxesDirectionCosines[4] = 1; + AxesDirectionCosines[5] = 0; + AxesDirectionCosines[6] = -1; // + AxesDirectionCosines[7] = 0; + AxesDirectionCosines[8] = 0; + AxesOrigin[0] = x; + AxesOrigin[1] = 0; + AxesOrigin[2] = 0; + positionActor[0] = 900-1; + positionActor[1] = 0; + positionActor[2] = 0; + rotationYactor = -90; + } // if _Xback + } + + if (directionViewer==1) + { + if (GetY()!=_Yback) + { + ok = true; + _Yback = GetY(); + AxesDirectionCosines[0] = 1; + AxesDirectionCosines[1] = 0; + AxesDirectionCosines[2] = 0; + AxesDirectionCosines[3] = 0; + AxesDirectionCosines[4] = 0; + AxesDirectionCosines[5] = 1; + AxesDirectionCosines[6] = 0; + AxesDirectionCosines[7] = -1; + AxesDirectionCosines[8] = 0; + AxesOrigin[0] = 0; + AxesOrigin[1] = y; + AxesOrigin[2] = 0; + positionActor[0] = 0; + positionActor[1] = -900-1; + positionActor[2] = 0; + rotationXactor = 90; + } // if _Yback + } + + if (directionViewer==2) + { + if (GetZ()!=_Zback) + { + ok = true; + _Zback = GetZ(); + AxesDirectionCosines[0] = 1; + AxesDirectionCosines[1] = 0; + AxesDirectionCosines[2] = 0; + AxesDirectionCosines[3] = 0; + AxesDirectionCosines[4] = 1; + AxesDirectionCosines[5] = 0; + AxesDirectionCosines[6] = 0; + AxesDirectionCosines[7] = 0; + AxesDirectionCosines[8] = 1; + AxesOrigin[0] = 0; + AxesOrigin[1] = 0; + AxesOrigin[2] = z; + positionActor[0] = 0; + positionActor[1] = 0; + positionActor[2] = -900+100; + } // if _Zback + } + + if (directionViewer==3) + { +// EED Borrame +// if ( (GetX()!=_Xback) || (GetY()!=_Yback) || (GetZ()!=_Zback) ) +// { +// _Xback = GetX(); +// _Yback = GetY(); +// _Zback = GetZ(); +// ok = true; +// } // if _Yback + ok = true; + AxesDirectionCosines[0] = 1; + AxesDirectionCosines[1] = 0; + AxesDirectionCosines[2] = 0; + AxesDirectionCosines[3] = 0; + AxesDirectionCosines[4] = 1; + AxesDirectionCosines[5] = 0; + AxesDirectionCosines[6] = 0; + AxesDirectionCosines[7] = 0; + AxesDirectionCosines[8] = 1; + AxesOrigin[0] = x; + AxesOrigin[1] = y; + AxesOrigin[2] = z; + positionActor[0] = 0; + positionActor[1] = 0; + positionActor[2] = 900-100; + } + + } // if _baseView != NULL + +// EED 2025-09-16 Borrame +// ok=true; +// + + if ( (_image!=NULL) && (_baseView!=NULL) && (ok==true) ) + { + CleanXYZ(x,y,z); + if (!GetActorPresent()) + { + if (_thresholdTable==NULL) + { + _thresholdTable = vtkLookupTable::New(); + _thresholdMapper = vtkImageMapToColors::New( ); + _3Dslices = vtkProbeFilter::New( ) ; + _stPoints = vtkStructuredPoints::New( ); + } + /* + if (_thresholdTable==NULL) + { + //Lookup Table + _thresholdTable = vtkLookupTable::New(); + } // _thresholdTable + + if (_thresholdMapper==NULL) + { + _thresholdMapper = vtkImageMapToColors::New( ); + } +*/ + + if (_thresholdActor==NULL) + { + _thresholdActor = vtkImageActor::New( ); + _scalarbarActor = vtkScalarBarActor::New(); + UpdateColorBarPosition(); + _scalarbarActor->SetHeight(0.4); //default 0.8 + _scalarbarActor->SetWidth(0.10); //default 0.17 + _thresholdActor->SetOpacity( 1 ); + _thresholdActor->InterpolateOn(); + + _thresholdActor->SetPosition( positionActor ); + _thresholdActor->RotateX( rotationXactor ); + _thresholdActor->RotateY( rotationYactor ); + _thresholdActor->RotateZ( rotationZactor ); + +/* EED Borrame + if (directionViewer==0) + { + _thresholdActor->SetPosition( 900-1,0,0 ); + _thresholdActor->RotateY( -90 ); + } + if (directionViewer==1) + { + _thresholdActor->SetPosition( 0,-900-1, 0 ); + _thresholdActor->RotateX( 90 ); + } + if (directionViewer==2) + { + _thresholdActor->SetPosition( 0,0, -900+100 ); + } + if (directionViewer==3) + { + _thresholdActor->SetPosition( 0,0, 900-100 ); + } +*/ + } // _thresholdActor + + _baseView->GetRenderer()->AddActor( _thresholdActor ); + _baseView->GetRenderer()->AddActor2D( _scalarbarActor ); + _actorPresent = true; + } // !GetActorPresent() + + ConfigLookupTable(); // virtual method + + vtkImageData *img=NULL; + if ( (directionViewer>=0) && (directionViewer<=2) ) + { + + _imageReslicer->SetInputData( GetImage() ); + _imageReslicer->SetInformationInput( GetImage() ); + _imageReslicer->SetResliceAxesDirectionCosines( AxesDirectionCosines ); + _imageReslicer->SetResliceAxesOrigin( AxesOrigin ); + + /* + if (directionViewer==0) + { + _imageReslicer->SetResliceAxesDirectionCosines( 0,0,1, 0,1,0, -1,0,0 ); + _imageReslicer->SetResliceAxesOrigin(x,0,0); + } + + if (directionViewer==1) + { + _imageReslicer->SetResliceAxesDirectionCosines( 1,0,0 ,0,0,1, 0,-1,0 ); + _imageReslicer->SetResliceAxesOrigin(0,y,0); + } + + if (directionViewer==2) + { + _imageReslicer->SetResliceAxesDirectionCosines( 1,0,0, 0,1,0 ,0,0,1 ); + _imageReslicer->SetResliceAxesOrigin(0,0,z); + } + */ + + _imageReslicer->SetOutputDimensionality(2); +// _imageReslicer->SetInterpolationModeToLinear(); + _imageReslicer->SetInterpolationModeToNearestNeighbor(); +// _imageReslicer->Modified(); + _imageReslicer->Update(); + img = _imageReslicer->GetOutput(); + } + + + if (directionViewer==3) + { + vtkPlane2DView *plane2DView = (vtkPlane2DView*)_baseView; + vtkPlaneSource *pSource = plane2DView->GetPlaneSource(); + int sizeIma = plane2DView->GetImgSize(); + + // EED Borrame + /* + if (_3Dslices==NULL) + { + _3Dslices = vtkProbeFilter::New( ) ; + } + if (_stPoints==NULL) + { + _stPoints = vtkStructuredPoints::New( ); + } + */ + + _3Dslices -> SetInputData( (vtkDataSet*)pSource->GetOutput( ) ); + _3Dslices -> SetSourceData( GetImage() ); + _3Dslices -> Update( ); + _stPoints -> GetPointData( )->SetScalars( _3Dslices->GetOutput()->GetPointData()->GetScalars() ); + _stPoints -> SetDimensions( sizeIma, sizeIma, 1 ); + vtkInformation* info=_stPoints->GetInformation(); + vtkDataObject::SetPointDataActiveScalarInfo(info, VTK_SHORT, 1); + img = _stPoints; + + /* + vtkProbeFilter *_3Dslices; + _3Dslices -> SetInputData( (vtkDataSet*)pSource->GetOutput( ) ); + _3Dslices -> SetSourceData( GetImage() ); + _3Dslices -> Update( ); + _stPoints -> GetPointData( )->SetScalars( _3Dslices->GetOutput()->GetPointData()->GetScalars() ); + _stPoints -> SetDimensions( _sizeIma, _sizeIma, 1 ); + vtkInformation* info=_stPoints->GetInformation(); + vtkDataObject::SetPointDataActiveScalarInfo(info, VTK_SHORT, 1); + img = _stPoints; + */ + } + + _thresholdMapper->SetInputData( img ); + _thresholdMapper->SetLookupTable( _thresholdTable ); + _thresholdMapper->Update(); + _thresholdActor->SetInputData( _thresholdMapper->GetOutput() ); + _thresholdActor->SetOpacity(_opacity*2); + _scalarbarActor->SetLookupTable( _thresholdTable ); +// _scalarbarActor->SetLookupTable( _thresholdMapper->GetLookupTable() ); + _scalarbarActor->SetTitle("Value"); + _scalarbarActor->SetNumberOfLabels(4); + int fontsize = _scalarbarActor->GetLabelTextProperty()->GetFontSize(); + _scalarbarActor->GetLabelTextProperty()->SetFontSize(fontsize/2); +// _scalarbarActor->SetTextPad(4); ?? + } // if _image _baseView ok +} + +/* -------------------Borrame EED--------------------------------------------- +void LayerImageBase::onThreshold() { bool ok = false; int directionViewer = 0; @@ -448,8 +764,8 @@ void LayerImageBase::onThreshold() { if (GetX()!=_Xback) { - _Xback = GetX(); - ok=true; + _Xback = GetX(); + ok = true; } // if _Yback } @@ -457,8 +773,8 @@ void LayerImageBase::onThreshold() { if (GetY()!=_Yback) { - _Yback = GetY(); - ok=true; + _Yback = GetY(); + ok = true; } // if _Yback } @@ -466,10 +782,25 @@ void LayerImageBase::onThreshold() { if (GetZ()!=_Zback) { - _Zback = GetZ(); - ok=true; + _Zback = GetZ(); + ok = true; } // if _Yback } + + if (directionViewer==3) + { +// if ( (GetX()!=_Xback) || (GetY()!=_Yback) || (GetZ()!=_Zback) ) +// { +// _Xback = GetX(); +// _Yback = GetY(); +// _Zback = GetZ(); +// ok = true; +// } // if _Yback + ok = true; + } + +printf("EED LayerImageBase::onThreshold directionViewer=%d\n", directionViewer); + if (_image!=_imageBack) { _imageBack=_image; @@ -526,6 +857,11 @@ void LayerImageBase::onThreshold() { _thresholdActor->SetPosition( 0,0, -900+100 ); } + if (directionViewer==3) + { + _thresholdActor->SetPosition( 0,0, 900-100 ); + } + } // _thresholdActor _baseView->GetRenderer()->AddActor( _thresholdActor ); @@ -562,6 +898,15 @@ void LayerImageBase::onThreshold() _imageReslicer->SetResliceAxesOrigin(0,0,z); } + if (directionViewer==3) + { + vtkMPRBaseData *mprbasedata = (vtkMPRBaseData*)_baseView -> GetVtkBaseData(); + vtkTransform *transform = mprbasedata -> GetTransformOrientation(); + _imageReslicer->SetResliceTransform( transform ); + _imageReslicer->SetResliceAxesOrigin(x,y,z); + } + + _imageReslicer->SetOutputDimensionality(2); // _imageReslicer->SetInterpolationModeToLinear(); _imageReslicer->SetInterpolationModeToNearestNeighbor(); @@ -604,6 +949,7 @@ void LayerImageBase::onThreshold() // _scalarbarActor->SetTextPad(4); ?? } // if _image _baseView ok } +*/ //---------------------------------------------------------------------------- void LayerImageBase::onThresholdChange() diff --git a/lib/maracasVisuLib/src/interface/wxWindows/widgets/ThresholdImageView/LayerImageBase.h b/lib/maracasVisuLib/src/interface/wxWindows/widgets/ThresholdImageView/LayerImageBase.h index 59f91dca..6a44291e 100644 --- a/lib/maracasVisuLib/src/interface/wxWindows/widgets/ThresholdImageView/LayerImageBase.h +++ b/lib/maracasVisuLib/src/interface/wxWindows/widgets/ThresholdImageView/LayerImageBase.h @@ -43,6 +43,9 @@ #include #include "wxVtkBaseView.h" #include "vtkScalarBarActor.h" +#include "vtkPlaneSource.h" +#include "vtkStructuredPoints.h" +#include "vtkProbeFilter.h" #include "InteractorStyleMaracas.h" #include "vtkImageChangeInformation.h" @@ -145,6 +148,9 @@ class LayerImageBase vtkScalarBarActor *_scalarbarActor; virtual void ConfigLookupTable() = 0; void CleanXYZ(double &x, double &y, double &z); + vtkProbeFilter *_3Dslices; + vtkStructuredPoints *_stPoints; + protected: double _range[2]; @@ -152,7 +158,5 @@ class LayerImageBase std::vector _colorBarPosition; }; - - #endif // __LayerImageBase_h__ diff --git a/lib/maracasVisuLib/src/interface/wxWindows/widgets/ThresholdImageView/ThresholdImageView.cxx b/lib/maracasVisuLib/src/interface/wxWindows/widgets/ThresholdImageView/ThresholdImageView.cxx index e1d0cd57..6f01ac4b 100644 --- a/lib/maracasVisuLib/src/interface/wxWindows/widgets/ThresholdImageView/ThresholdImageView.cxx +++ b/lib/maracasVisuLib/src/interface/wxWindows/widgets/ThresholdImageView/ThresholdImageView.cxx @@ -95,10 +95,10 @@ void ThresholdImageView::ConfigLookupTable() // virtual int minTot2; int maxTot2; - minVal2=minVal-minTot; - maxVal2=maxVal-minTot; - minTot2=minTot-minTot; - maxTot2=maxTot-minTot; + minVal2 = minVal-minTot; + maxVal2 = maxVal-minTot; + minTot2 = minTot-minTot; + maxTot2 = maxTot-minTot; // thresholdTable->SetTableRange(minVal,maxVal); //EED You need to do this loop just the first time diff --git a/lib/maracasVisuLib/src/interface/wxWindows/widgets/vtkBaseData.cxx b/lib/maracasVisuLib/src/interface/wxWindows/widgets/vtkBaseData.cxx index e2e7c366..b985ef97 100644 --- a/lib/maracasVisuLib/src/interface/wxWindows/widgets/vtkBaseData.cxx +++ b/lib/maracasVisuLib/src/interface/wxWindows/widgets/vtkBaseData.cxx @@ -252,7 +252,7 @@ double vtkBaseData::GetCameraParallelScale() //------------------------------------------------------------------- void vtkBaseData::SetCameraParallelScale(double value) { - _cameraparallelScale=value; + _cameraparallelScale = value; } //------------------------------------------------------------------- @@ -271,3 +271,10 @@ void vtkBaseData::GetPointMouse(int &x, int &y , int &z) z = _pointMouseZ; } +void vtkBaseData::CallObserver(bool withObserver) +{ + if (withObserver==true) + { + _observable->InvokeEvent(4); + } // if withObserver +} diff --git a/lib/maracasVisuLib/src/interface/wxWindows/widgets/vtkBaseData.h b/lib/maracasVisuLib/src/interface/wxWindows/widgets/vtkBaseData.h index aed33a78..e3a5120d 100644 --- a/lib/maracasVisuLib/src/interface/wxWindows/widgets/vtkBaseData.h +++ b/lib/maracasVisuLib/src/interface/wxWindows/widgets/vtkBaseData.h @@ -64,7 +64,9 @@ public: void SetCameraParallelScale(double value); void SetPointMouse( int x, int y, int z); void GetPointMouse( int &x, int &y, int &z); + void CallObserver(bool withObserver); + protected: marImageData *_marImageData; double _z; diff --git a/lib/maracasVisuLib/src/interface/wxWindows/widgets/vtkMPR3DDataViewer.cxx b/lib/maracasVisuLib/src/interface/wxWindows/widgets/vtkMPR3DDataViewer.cxx index 189bdfae..8c86f079 100644 --- a/lib/maracasVisuLib/src/interface/wxWindows/widgets/vtkMPR3DDataViewer.cxx +++ b/lib/maracasVisuLib/src/interface/wxWindows/widgets/vtkMPR3DDataViewer.cxx @@ -29,21 +29,21 @@ vtkMPR3DDataViewer::vtkMPR3DDataViewer() { - _visiblePosition[0]=false; - _visiblePosition[1]=false; - _visiblePosition[2]=false; - _ctfun = NULL; - _vtkmprbasedata = NULL; - _ctfun = NULL; - _saggitalColors = NULL; - _saggital = NULL; - _axialColors = NULL; - _axial = NULL; - _coronalColors = NULL; - _coronal = NULL; - _mapOutline = NULL; - _outline = NULL; - _outlineData = NULL; + _visiblePosition[0] = false; + _visiblePosition[1] = false; + _visiblePosition[2] = false; + _ctfun = NULL; + _vtkmprbasedata = NULL; + _ctfun = NULL; + _saggitalColors = NULL; + _saggital = NULL; + _axialColors = NULL; + _axial = NULL; + _coronalColors = NULL; + _coronal = NULL; + _mapOutline = NULL; + _outline = NULL; + _outlineData = NULL; } //------------------------------------------------------------------- vtkMPR3DDataViewer::~vtkMPR3DDataViewer() diff --git a/lib/maracasVisuLib/src/interface/wxWindows/widgets/vtkPlane2DView.cxx b/lib/maracasVisuLib/src/interface/wxWindows/widgets/vtkPlane2DView.cxx index 166a12a0..2b05c4b2 100644 --- a/lib/maracasVisuLib/src/interface/wxWindows/widgets/vtkPlane2DView.cxx +++ b/lib/maracasVisuLib/src/interface/wxWindows/widgets/vtkPlane2DView.cxx @@ -24,49 +24,42 @@ # ------------------------------------------------------------------------ */ #include "vtkPlane2DView.h" - #include "vtkCellArray.h" +#include "vtkPointData.h" +#include "vtkImageAppend.h" +#include "vtkImageSlab.h" + #include "vtkInteractorStyleBaseView2D.h" -#include "vtkPointData.h" -vtkPlane2DView::vtkPlane2DView( wxWindow *parent) -: wxVtk2DBaseView(parent) +vtkPlane2DView::vtkPlane2DView( wxWindow *parent) : wxVtk2DBaseView(parent) { - _backX = -99999; _backY = -99999; _backZ = -99999; - _backOrient[0] = -99999; _backOrient[1] = -99999; _backOrient[2] = -99999; _backOrient[3] = -99999; - _active = true; _mip_visualization = true; _mip_width = 2; - _transform1 = vtkTransform::New(); _transform2 = vtkTransform::New(); _transform1->Identity(); _transform2->Identity(); - _sizeIma = 200; - _pSource = NULL; _3Dslices = NULL; _stPoints = NULL; _change = NULL; _imageResult = NULL; - // line horizontal _pts = NULL; _lineActor = NULL; _lineMapper = NULL; _pd = NULL; - _interactorstyleplane2D = NULL; } //------------------------------------------------------------------- @@ -85,13 +78,13 @@ vtkPlane2DView::~vtkPlane2DView() //------------------------------------------------------------------- void vtkPlane2DView::ResetBack() { - _backX=-1; - _backY=-1; - _backZ=-1; - _backOrient[0]=-1; - _backOrient[1]=-1; - _backOrient[2]=-1; - _backOrient[3]=-1; + _backX = -1; + _backY = -1; + _backZ = -1; + _backOrient[0] = -1; + _backOrient[1] = -1; + _backOrient[2] = -1; + _backOrient[3] = -1; } //------------------------------------------------------------------- @@ -120,9 +113,9 @@ void vtkPlane2DView::SetPSource(int sizeIma){ double spc[3]; vtkImageData *imagedata = GetVtkmprbasedata()->GetImageData(); imagedata->GetSpacing(spc); - x=x*spc[0]; - y=y*spc[1]; - z=z*spc[2]; + x = x*spc[0]; + y = y*spc[1]; + z = z*spc[2]; vtkMPRBaseData *mprbasedata = (vtkMPRBaseData*)this->GetVtkBaseData(); @@ -133,26 +126,20 @@ void vtkPlane2DView::SetPSource(int sizeIma){ double pB[3]; in[0]=1; in[1]=0; in[2]=0; transform->TransformPoint(in,_n); - in[0]=0; in[1]=dimIma-1; in[2] = 0; transform->TransformPoint(in,pA); - in[0]=0; in[1]=0; in[2]=dimIma-1; transform->TransformPoint(in,pB); - _pSource -> SetPoint1( pA ); _pSource -> SetPoint2( pB ); - _pSource -> SetOrigin( 0 , 0 , 0 ); _pSource -> SetResolution( sizeIma-1 , sizeIma -1 ); _pSource -> Update(); _pSource -> SetCenter( x, y, z ); _pSource -> SetNormal( _n ); _pSource -> Update( ); - // EED Borrame // transform->Delete(); - } //------------------------------------------------------------------- @@ -161,36 +148,31 @@ void vtkPlane2DView::ExtractPlane() double x = GetVtkmprbasedata()->GetX(); double y = GetVtkmprbasedata()->GetY(); double z = GetVtkmprbasedata()->GetZ(); - double spc[3]; vtkImageData *imagedata = GetVtkmprbasedata()->GetImageData(); imagedata->GetSpacing(spc); - x=x*spc[0]; - y=y*spc[1]; - z=z*spc[2]; - + x = x*spc[0]; + y = y*spc[1]; + z = z*spc[2]; vtkTransform *transform = GetVtkmprbasedata()->GetTransformOrientation(); double orientation[4]; transform->GetOrientationWXYZ(orientation); - bool okOrientation=true; if ((orientation[0]!=_backOrient[0]) || (orientation[1]!=_backOrient[1]) || (orientation[2]!=_backOrient[2]) || (orientation[3]!=_backOrient[3])) { okOrientation=false; } - bool okPosicion=true; if ( (x!=_backX) || (y!=_backY) || (z!=_backZ) ) { okPosicion=false; } - - if ((okPosicion==false) || (okOrientation==false) ) { - if (_active==true){ - + if ((okPosicion==false) || (okOrientation==false) ) + { + if (_active==true) + { bool ok = false; - if ( _mip_visualization==true ) { if (_interactorstyleplane2D!=NULL) @@ -202,7 +184,6 @@ void vtkPlane2DView::ExtractPlane() } } // ok=true; - if (ok==true) { Extract_MIP_PlaneVTK(); @@ -211,22 +192,24 @@ void vtkPlane2DView::ExtractPlane() } // ok } // active - _backX=x; - _backY=y; - _backZ=z; - _backOrient[0]=orientation[0]; - _backOrient[1]=orientation[1]; - _backOrient[2]=orientation[2]; - _backOrient[3]=orientation[3]; + GetVtkmprbasedata()->CallObserver(true); // This is for refresh ColorLayer mechanism + _backX = x; + _backY = y; + _backZ = z; + _backOrient[0] = orientation[0]; + _backOrient[1] = orientation[1]; + _backOrient[2] = orientation[2]; + _backOrient[3] = orientation[3]; } //okPosition okOrientation } //------------------------------------------------------------------- void vtkPlane2DView::Extract_One_PlaneVTK() { + printf("EED vtkPlane2DView::Extract_One_PlaneVTK \n"); + vtkImageData *imagedata = GetVtkmprbasedata()->GetImageData(); SetPSource(_sizeIma); - //EED 2017-01-01 Migration VTK7 #if VTK_MAJOR_VERSION <= 5 _3Dslices -> SetInput( ( vtkDataSet* )_pSource->GetOutput( ) ); @@ -235,11 +218,9 @@ void vtkPlane2DView::Extract_One_PlaneVTK() _3Dslices -> SetInputData( ( vtkDataSet* )_pSource->GetOutput( ) ); _3Dslices -> SetSourceData( imagedata ); #endif - _3Dslices -> Update( ); _stPoints -> GetPointData( )->SetScalars( _3Dslices->GetOutput()->GetPointData()->GetScalars() ); _stPoints -> SetDimensions( _sizeIma, _sizeIma, 1 ); - //EED 2017-01-01 Migration VTK7 #if VTK_MAJOR_VERSION <= 5 _stPoints -> SetScalarType( imagedata->GetScalarType() ); @@ -249,25 +230,20 @@ void vtkPlane2DView::Extract_One_PlaneVTK() // _change -> Update(); //important _imageViewer2XYZ->GetVtkImageViewer2()->SetInput ( _stPoints ); #else -printf("EED Warning! vtkPlane2DView::Extract_One_PlaneVTK VTK 5->7 ???? SetScalarTypeToShort \n"); -printf("EED Warning! vtkPlane2DView::Extract_One_PlaneVTK VTK 5->7 ???? SetScalarTypeToShort \n"); -printf("EED Warning! vtkPlane2DView::Extract_One_PlaneVTK VTK 5->7 ???? SetScalarTypeToShort \n"); -printf("EED Warning! vtkPlane2DView::Extract_One_PlaneVTK VTK 5->7 ???? SetScalarTypeToShort \n"); printf("EED Warning! vtkPlane2DView::Extract_One_PlaneVTK VTK 5->7 ???? SetScalarTypeToShort \n"); vtkInformation* info=_stPoints->GetInformation(); vtkDataObject::SetPointDataActiveScalarInfo(info, VTK_SHORT, 1); _imageViewer2XYZ->GetVtkImageViewer2()->SetInputData( _stPoints ); - #endif - - // _imageViewer2XYZ->GetVtkImageViewer2()->SetInput ( _change->GetOutput() ); // vtkImageActor *imageActor = _imageViewer2XYZ->GetVtkImageViewer2()->GetImageActor(); + } //------------------------------------------------------------------- void vtkPlane2DView::Extract_MIP_PlaneVTK( /*double heightDefinition*/ ) { + int mipWidth; double sp; int sizeWidth = (_mip_width*2)+1 ; @@ -294,9 +270,19 @@ void vtkPlane2DView::Extract_MIP_PlaneVTK( /*double heightDefinition*/ ) sizeWidth = tmpSizeWith; deltaPixel = 4; } + std::vector< vtkProbeFilter* > slicesLST; + std::vector< vtkStructuredPoints* > stPointsLST; + _pSource->Push( -mipWidth * sp ); _pSource->Update(); + + + vtkImageAppend *appender = vtkImageAppend::New(); + // Définition de l'axe : 0 = X (horizontal), 1 = Y (vertical), 2 = Z (profondeur) + appender->SetAppendAxis(2); +// vtkImageData* outputImage = appender->GetOutput(); + for ( iWidth=0 ; iWidth SetSourceData( imagedata ); #endif slice -> Update( ); + + vtkStructuredPoints *stPoints = vtkStructuredPoints::New(); + stPoints -> GetPointData( )->SetScalars( slice->GetOutput()->GetPointData()->GetScalars() ); + stPoints -> SetDimensions( _sizeIma, _sizeIma, 1 ); + vtkInformation* info=stPoints->GetInformation(); + vtkDataObject::SetPointDataActiveScalarInfo(info, VTK_SHORT, 1); + slicesLST.push_back( slice ); + stPointsLST.push_back( stPoints ); + appender->AddInputData(stPoints); + _pSource->Push( sp ); } + + appender->Update(); + vtkImageSlab *imageSlab = vtkImageSlab::New(); + imageSlab->SetInputData( appender->GetOutput() ); + imageSlab->SetOperationToMax(); + imageSlab->Update(); + + _imageResult = imageSlab->GetOutput(); + + printf(">>> \n"); + printf(">>>EED Warning! vtkPlane2DView::Extract_MIP_PlaneVTK \n"); + printf(">>> 1) Add mip options in control panel \n"); + printf(">>> 2) We need to check the sp pSource to the correct mip thicknes \n"); + printf(">>> 3) We need to check resolution of the pixels in the different mip width \n"); + printf(">>> \n"); + + + + /* --- EED Borrame ------------ if (_imageResult ==NULL) { _imageResult = vtkImageData::New(); @@ -329,42 +344,49 @@ void vtkPlane2DView::Extract_MIP_PlaneVTK( /*double heightDefinition*/ ) #endif } + unsigned short *pTemp; - unsigned short *pResult; - pResult = (unsigned short*)_imageResult->GetScalarPointer( 0 , 0 , 0 ); + 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); + pTemp = (unsigned short*)stPointsLST[0]->GetScalarPointer(); + pResult = (unsigned short*)_imageResult->GetScalarPointer( 0 , 0 , 0 ); + pResult[iPixels] = pTemp[iPixels]; + for ( iWidth=1 ; iWidthGetOutput()->GetPointData()->GetScalars()->GetVoidPointer(0); - +// pTemp = (unsigned short*)slicesLST[iWidth]->GetOutput()->GetPointData()->GetScalars()->GetVoidPointer(0); + pTemp = (unsigned short*)stPointsLST[0]->GetScalarPointer(); if (pResult[iPixels]< pTemp[iPixels]) { pResult[iPixels] = pTemp[iPixels]; } - } + } // for iWidth if (deltaPixel!=1) { for (itmp=1;itmpDelete(); - } + slicesLST[iWidth]->Delete(); + stPointsLST[iWidth]->Delete(); + } // for iWidth _imageResult->Modified(); + */ + + + //EED 2017-01-01 Migration VTK7 #if VTK_MAJOR_VERSION <= 5 _imageViewer2XYZ->GetVtkImageViewer2()->SetInput( _imageResult ); #else - _imageViewer2XYZ->GetVtkImageViewer2()->SetInputData( _imageResult ); + _imageViewer2XYZ->GetVtkImageViewer2()->SetInputData( _imageResult ); #endif } @@ -473,16 +495,14 @@ void vtkPlane2DView::RotationDrag(double vx, double vy, bool ok_v, bool ok_ang) { if (ok_ang==false) { - _ang =sqrt( vx*vx + vy*vy ) / 1.5; + _ang = sqrt( vx*vx + vy*vy ) / 1.5; } - if (ok_v==false){ - _vxb=-vy; - _vyb=vx; + _vxb = -vy; + _vyb = vx; } _transform2->Identity(); _transform2->RotateWXYZ(_ang,0,_vxb,_vyb); - vtkMPRBaseData *mprbasedata = (vtkMPRBaseData*)this->GetVtkBaseData(); vtkTransform *transform = vtkTransform::New(); transform->Identity(); @@ -490,7 +510,6 @@ void vtkPlane2DView::RotationDrag(double vx, double vy, bool ok_v, bool ok_ang) transform->Concatenate(_transform2); mprbasedata->InitTransformOrientation(transform); transform->Delete(); - // Refresh Horizontal Line _pts->SetPoint( 0 , (_sizeIma/2) - _vxb*2 , (_sizeIma/2) - _vyb*2 , 1 ); _pts->SetPoint( 1 , (_sizeIma/2) + _vxb*2 , (_sizeIma/2) + _vyb*2 , 1 ); @@ -539,7 +558,7 @@ int vtkPlane2DView::GetMipWidth() //------------------------------------------------------------------- void vtkPlane2DView::SetActualSlice(int slice) // Virtual { - double dir=(double)slice/3.0; + double dir = (double)slice/3.0; GetVtkmprbasedata()->SetXYZ( _cx+(_n[0]*dir) , _cy+(_n[1]*dir) , _cz+(_n[2]*dir) ); } @@ -558,14 +577,14 @@ void vtkPlane2DView::SetActive(bool active) void vtkPlane2DView::SetMipVisualization(bool ok) { - _mip_visualization=ok; + _mip_visualization = ok; } //--------------------------------------------------------------------------- void vtkPlane2DView::SetMipWidth(int value) { - _mip_width=value; + _mip_width = value; } //--------------------------------------------------------------------------- @@ -607,3 +626,14 @@ void vtkPlane2DView::TransfromCoordViewWorld2(double &X, double &Y, double &Z) Z = out[2] + GetVtkmprbasedata()->GetZ() ; } +//------------------------------------------------------------------- +int vtkPlane2DView::GetDirection() // virtual +{ + return 3; +} + +//------------------------------------------------------------------- +vtkPlaneSource* vtkPlane2DView::GetPlaneSource() +{ + return _pSource; +} diff --git a/lib/maracasVisuLib/src/interface/wxWindows/widgets/vtkPlane2DView.h b/lib/maracasVisuLib/src/interface/wxWindows/widgets/vtkPlane2DView.h index 522b6a02..ca7fe5c3 100644 --- a/lib/maracasVisuLib/src/interface/wxWindows/widgets/vtkPlane2DView.h +++ b/lib/maracasVisuLib/src/interface/wxWindows/widgets/vtkPlane2DView.h @@ -49,72 +49,56 @@ public: void ExtractPlane(); int GetImgSize(); void SetImgSize( int imgSize ); - void RotationStart(); void RotationDrag(double vx, double vy, bool ok_v, bool ok_ang); - virtual int GetActualSlice(); virtual void SetActualSlice(int slice); - virtual void Refresh( ); - vtkMPRBaseData *GetVtkmprbasedata(); vtkInteractorStylePlane2D *GetInteractorstyleplane2D(); - void SetActive(bool active); void SetVisibleLine(bool ok); - void TransfromCoordViewWorld2(double &X, double &Y, double &Z); - int GetMipWidth(); void SetMipWidth(int value); bool GetMipVisualization(); void SetMipVisualization(bool ok); - void ResetBack(); - + int GetDirection(); // virtual + vtkPlaneSource* GetPlaneSource(); + private: bool _active; int _mip_width; bool _mip_visualization; - double _backX; double _backY; double _backZ; double _backOrient[4]; - double _ang; double _vxb; double _vyb; double _n[3]; // Normal - double _cx; double _cy; double _cz; - int _sizeIma; - vtkImageData * _imageResult; - // Horizontal line vtkPoints *_pts; vtkActor *_lineActor; vtkPolyDataMapper *_lineMapper; vtkPolyData *_pd; - vtkProbeFilter *_3Dslices; vtkPlaneSource *_pSource; vtkStructuredPoints *_stPoints; vtkImageChangeInformation *_change; vtkTransform *_transform1; - vtkTransform *_transform2; - + vtkTransform *_transform2; vtkInteractorStylePlane2D *_interactorstyleplane2D; - vtkInfoTextImage *_vtkInfoTextImage; vtkInfoTextImageInteractorPlane2D *_vtkInfoTextImageInteractorPlane2D; - void SetPSource(int sizeIma); void HorizontalLine(); void ResetPlane(); diff --git a/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxMPRBaseData.cxx b/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxMPRBaseData.cxx index d6728374..1a567f44 100644 --- a/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxMPRBaseData.cxx +++ b/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxMPRBaseData.cxx @@ -51,15 +51,15 @@ //------------------------------------------------------------------- vtkMPRBaseData::vtkMPRBaseData() { - _x = 0; - _y = 0; - _z = 0; - _x1 = 0; - _x2 = 0; - _y1 = 0; - _y2 = 0; - _z1 = 0; - _z2 = 0; + _x = 0; + _y = 0; + _z = 0; + _x1 = 0; + _x2 = 0; + _y1 = 0; + _y2 = 0; + _z1 = 0; + _z2 = 0; _transformOrientation = NULL; _marImageData = NULL; } @@ -76,60 +76,60 @@ void vtkMPRBaseData::Configure() { //EED 03nov2012 vtkBaseData::Configure(); - vtkImageData* img = _marImageData->GetImageData(); if(img !=NULL) { img->GetExtent (_x1,_x2,_y1,_y2,_z1,_z2); //std::cout<<"vtkMPRBaseData::Configure() _x1= "<<_x1<<" _x2= "<<_x2<<" _y1= "<<_y1<<" _y2= "<<_y2<<" _z1= "<<_z1<<" _z2= "<<_z2<Identity(); } //------------------------------------------------------------------- void vtkMPRBaseData::GetDimensionExtention(int *x1,int *x2,int *y1,int *y2,int *z1,int *z2) { - *x1=_x1; - *x2=_x2; - *y1=_y1; - *y2=_y2; - *z1=_z1; - *z2=_z2; + *x1 = _x1; + *x2 = _x2; + *y1 = _y1; + *y2 = _y2; + *z1 = _z1; + *z2 = _z2; } - //------------------------------------------------------------------------ int vtkMPRBaseData::GetMaxPositionX( ) { return _x2; } + //------------------------------------------------------------------------ int vtkMPRBaseData::GetMaxPositionY( ) { return _y2; } + //------------------------------------------------------------------------ int vtkMPRBaseData::GetMaxPositionZ( ) { return _z2; } + //------------------------------------------------------------------- double vtkMPRBaseData::GetX() { - return _x; } + //------------------------------------------------------------------- double vtkMPRBaseData::GetY() { return _y; } + //------------------------------------------------------------------- /** ** Calculates the value of the slider and the layer in the image that is spouse to show diff --git a/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxMPRWidget.cxx b/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxMPRWidget.cxx index 79d5d989..a238b920 100644 --- a/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxMPRWidget.cxx +++ b/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxMPRWidget.cxx @@ -377,7 +377,7 @@ wxPanel* wxMPRWidget::CreateView(int type,wxWindow *parent, vtkMPRBaseData *vtkm if (type==3) { _widgetMesure_B = new wxWidgetMesure2D_Plane_in_MPR(panel); - _vtkplane2Dview_B = new vtkPlane2DView( _widgetMesure_B->GetWindow2()); + _vtkplane2Dview_B = new vtkPlane2DView( _widgetMesure_B->GetWindow2()); _widgetMesure_B->SetVtkPlane2DView( _vtkplane2Dview_B ); _vtkplane2Dview_B->SetImgSize( 200 ); _vtkplane2Dview_B->SetVtkBaseData(vtkmprbasedata); @@ -393,31 +393,29 @@ wxPanel* wxMPRWidget::CreateView(int type,wxWindow *parent, vtkMPRBaseData *vtkm if (type==5) { - wxSplitterWindow *panelMPR3D = new wxSplitterWindow( panel , -1); - _wxvtk3Dbaseview_MPR3D_B = new wxVtk3DBaseView( panelMPR3D , vtkmprbasedata ); - - _wxvtkmpr3Dview_B = new wxVtkMPR3DView(_wxvtk3Dbaseview_MPR3D_B); - vtkMPR3DDataViewer *vtkmpr3Ddataviewer = new vtkMPR3DDataViewer(); + wxSplitterWindow *panelMPR3D = new wxSplitterWindow( panel , -1); + _wxvtk3Dbaseview_MPR3D_B = new wxVtk3DBaseView( panelMPR3D , vtkmprbasedata ); + _wxvtkmpr3Dview_B = new wxVtkMPR3DView(_wxvtk3Dbaseview_MPR3D_B); + vtkMPR3DDataViewer *vtkmpr3Ddataviewer = new vtkMPR3DDataViewer(); vtkmpr3Ddataviewer->SetVtkMPRBaseData(vtkmprbasedata); vtkmpr3Ddataviewer->Configure(); _wxvtkmpr3Dview_B->SetVtkMPR3DDataViewer(vtkmpr3Ddataviewer); - wxWindow *window3D = _wxvtk3Dbaseview_MPR3D_B->GetWxVTKRenderWindowInteractor(); - wxPanel *controlPanel3D = _wxvtkmpr3Dview_B->CreateControlPanel(panelMPR3D, false); + wxWindow *window3D = _wxvtk3Dbaseview_MPR3D_B->GetWxVTKRenderWindowInteractor(); + wxPanel *controlPanel3D = _wxvtkmpr3Dview_B->CreateControlPanel(panelMPR3D, false); //EEDxx2.4 panelMPR3D -> SetMinimumPaneSize( 5 ); panelMPR3D -> SplitHorizontally( controlPanel3D,window3D,600 ); //RaC Nov2012 Correctly resize internal panels with the window resize event panelMPR3D->SetSashGravity(0.5); - - wxwindow=panelMPR3D; + wxwindow = panelMPR3D; } if (type==6) { wxSplitterWindow *panelClipping3D = new wxSplitterWindow( panel , -1); - _wxvtk3Dbaseview_Clipping3D_BB = new wxVtk3DBaseView( panelClipping3D , vtkmprbasedata ); + _wxvtk3Dbaseview_Clipping3D_BB = new wxVtk3DBaseView( panelClipping3D , vtkmprbasedata ); _wxvtkclipping3Dview_BB = new wxVtkClipping3DView(_wxvtk3Dbaseview_Clipping3D_BB); vtkClipping3DDataViewer *vtkclipping3Ddataviewer = new vtkClipping3DDataViewer(); @@ -560,7 +558,7 @@ wxPanel* wxMPRWidget::CreateMPRPanel4View(wxWindow *parent, vtkMPRBaseData *vtkm _wxvtkclipping3Dview->SetVtkClipping3DDataViewer(vtkclipping3Ddataviewer); - wxWindow *window3D = _wxvtk3Dbaseview_MPRClipping3D->GetWxVTKRenderWindowInteractor(); + wxWindow *window3D = _wxvtk3Dbaseview_MPRClipping3D->GetWxVTKRenderWindowInteractor(); wxPanel *panelControl = new wxPanel(panelMPR3D,-1); wxPanel *controlPanelMPR3D = _wxvtkmpr3Dview->CreateControlPanel(panelControl, false); wxPanel *controlPanelClipping3D = _wxvtkclipping3Dview->CreateSurfControlPanel(panelControl); @@ -710,11 +708,11 @@ void wxMPRWidget::ConfigureVTK(){ } //---------------------------------------------------------------------------- - void wxMPRWidget::OnRefreshView(wxCommandEvent & event) { RefreshView(); } + //---------------------------------------------------------------------------- void wxMPRWidget::OnDClickLeft(wxCommandEvent & event) { @@ -725,12 +723,12 @@ void wxMPRWidget::OnDClickLeft(wxCommandEvent & event) _wxsphereview_B -> RefreshPoint(); } } + //---------------------------------------------------------------------------- void wxMPRWidget::RefreshView(bool firsttime){ if (_refreshAPage == 0 ) { - if ((_vtkmpr2Dview[0]!=NULL) && (_vtkmpr2Dview[1]!=NULL) && (_vtkmpr2Dview[2]!=NULL) ) { _vtkmpr2Dview[2] -> Refresh(); @@ -824,22 +822,26 @@ void wxMPRWidget::RefreshView(bool firsttime){ } } } - } + //---------------------------------------------------------------------------- -vtkMPRBaseData *wxMPRWidget::GetVtkMPRBaseData(){ +vtkMPRBaseData *wxMPRWidget::GetVtkMPRBaseData() +{ return _vtkmprbasedata; } + //---------------------------------------------------------------------------- vtkPlane2DView *wxMPRWidget::GetVtkPlane2DView() { return _vtkplane2Dview; } + //---------------------------------------------------------------------------- wxVtkMPR3DView *wxMPRWidget::GetWxvtkmpr3Dview_BB() { return _wxvtkmpr3Dview_BB; } + //---------------------------------------------------------------------------- wxVtkBaseView *wxMPRWidget::GetWxVtkBaseView(int page, int id) { @@ -856,23 +858,13 @@ wxVtkBaseView *wxMPRWidget::GetWxVtkBaseView(int page, int id) } return result; } + //---------------------------------------------------------------------------- wxVtkMPR2DView *wxMPRWidget::GetWxvtkMPR2Dview(int direction) { return _vtkmpr2Dview[direction]; } - - -//---------------------------------------------------------------------------- - - -//---------------------------------------------------------------------------- -//---------------------------------------------------------------------------- -//---------------------------------------------------------------------------- - - - // EOF - wxMPRWidget.cxx diff --git a/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxMaracas_ViewerWidget.cxx b/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxMaracas_ViewerWidget.cxx index bf653555..35cd355c 100644 --- a/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxMaracas_ViewerWidget.cxx +++ b/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxMaracas_ViewerWidget.cxx @@ -335,7 +335,7 @@ if ( mvtkmpr2Dview_Z !=NULL ) { mvtkmpr2Dview_Z->Configure(); } if ( mvtkplane2Dview !=NULL ) { mvtkplane2Dview->Configure(); } if ( mwidgetMesure !=NULL ) { mwidgetMesure->ConfigureA(mvtkplane2Dview); } - if ( mwidgetMesure !=NULL ) { mwidgetMesure->ConfigureA(mvtkplane2Dview); } +// if ( mwidgetMesure !=NULL ) { mwidgetMesure->ConfigureA(mvtkplane2Dview); } if ( mwidgetMesure !=NULL ) { mwidgetMesure->SetActiveLink(true); } if ( mwxsphereview !=NULL ) { mwxsphereview->Configure(); } diff --git a/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxWidgetMesure2D.cxx b/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxWidgetMesure2D.cxx index d7ca22bb..a9c8fa8c 100644 --- a/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxWidgetMesure2D.cxx +++ b/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxWidgetMesure2D.cxx @@ -40,43 +40,38 @@ wxWidgetMesure2D::wxWidgetMesure2D( wxWindow *parent ) this->SplitHorizontally( new wxPanel(this,-1) , new wxPanel(this,-1), 2 ); this->SetMinimumPaneSize(50); } + //------------------------------------------------------------------- wxWidgetMesure2D::~wxWidgetMesure2D() { } + //------------------------------------------------------------------- wxWindow *wxWidgetMesure2D::CreateWin1a(wxWindow *parent) // virtual { wxPanel *panel = new wxPanel(parent,-1); - _cb_messuretool = new wxCheckBox(panel,-1,_T("Active messure tool ")); _cb_mt_visible = new wxCheckBox(panel,-1,_T("Visibles ")); _cb_closeContour = new wxCheckBox(panel,-1,_T("Close/Open ")); - _cb_visibleText = new wxCheckBox(panel,-1,_T("Information ")); - + _cb_visibleText = new wxCheckBox(panel,-1,_T("Information ")); _cb_mt_visible->SetValue(true); _cb_closeContour->SetValue(true); _cb_visibleText->SetValue(true); - wxFlexGridSizer *sizer = new wxFlexGridSizer(4); - sizer->Add(_cb_messuretool); sizer->Add(_cb_mt_visible); sizer->Add(_cb_closeContour); sizer->Add(_cb_visibleText); - panel->SetAutoLayout(true); panel->SetSizer(sizer); panel->SetSize(400,30); panel->Layout(); //EEDxx2.4 // panel->FitInside(); - - Connect(_cb_messuretool->GetId() , wxEVT_COMMAND_CHECKBOX_CLICKED , (wxObjectEventFunction) &wxWidgetMesure2D::OnActiveMessureTool ); - Connect(_cb_mt_visible->GetId() , wxEVT_COMMAND_CHECKBOX_CLICKED , (wxObjectEventFunction) &wxWidgetMesure2D::OnVisibleMessureTool ); - Connect(_cb_closeContour->GetId() , wxEVT_COMMAND_CHECKBOX_CLICKED , (wxObjectEventFunction) &wxWidgetMesure2D::OnCloseContour ); - Connect(_cb_visibleText->GetId() , wxEVT_COMMAND_CHECKBOX_CLICKED , (wxObjectEventFunction) &wxWidgetMesure2D::OnVisibleInformation ); - + Connect(_cb_messuretool->GetId() , wxEVT_COMMAND_CHECKBOX_CLICKED , (wxObjectEventFunction) &wxWidgetMesure2D::OnActiveMessureTool ); + Connect(_cb_mt_visible->GetId() , wxEVT_COMMAND_CHECKBOX_CLICKED , (wxObjectEventFunction) &wxWidgetMesure2D::OnVisibleMessureTool ); + Connect(_cb_closeContour->GetId() , wxEVT_COMMAND_CHECKBOX_CLICKED , (wxObjectEventFunction) &wxWidgetMesure2D::OnCloseContour ); + Connect(_cb_visibleText->GetId() , wxEVT_COMMAND_CHECKBOX_CLICKED , (wxObjectEventFunction) &wxWidgetMesure2D::OnVisibleInformation ); return panel; } @@ -84,7 +79,6 @@ wxWindow *wxWidgetMesure2D::CreateWin1a(wxWindow *parent) // virtual void wxWidgetMesure2D::ConfigureA(wxVtk2DBaseView *wxvtk2Dbaseview) // virtual { _wxvtk2Dbaseview = wxvtk2Dbaseview; - // Contorno 1 _manContourControl_1 = new manualContourControler(); _mContourModel_1 = new manualContourModel(); @@ -92,43 +86,35 @@ void wxWidgetMesure2D::ConfigureA(wxVtk2DBaseView *wxvtk2Dbaseview) // virtual _mViewContour_1->SetModel( _mContourModel_1 ); _mViewContour_1->SetWxVtkBaseView( _wxvtk2Dbaseview ); _mViewContour_1->SetRange( 1 ); - // EED 3 oct 2006 // double spc[3]; // _wxvtk2Dbaseview->GetSpacing( spc ); // _mViewContour_1->SetSpacing( spc ); - - - _manContourControl_1->SetZ( 1000 ); _manContourControl_1->SetModelView( _mContourModel_1 , _mViewContour_1 ); ((vtkInteractorStyleBaseView*)_wxvtk2Dbaseview->GetInteractorStyleBaseView())->AddInteractorStyleMaracas( _manContourControl_1 ); _manContourControl_1->CreateNewManualContour(); _manContourControl_1->SetActive( false ); _mViewContour_1->RefreshContour(); - //EED 27 Oct 2007 - + // this->ReplaceWindow( this->GetWindow1() , CreateWin1a(this) ); // this->ReplaceWindow( this->GetWindow2() , _wxvtk2Dbaseview->GetWxVTKRenderWindowInteractor() ); // CreateWin1a(this->GetWindow1() ); - wxBoxSizer *sizerA = new wxBoxSizer(wxHORIZONTAL); sizerA->Add( CreateWin1a( this->GetWindow1()) ,1, wxGROW ); this->GetWindow1()->SetSizer(sizerA); - this->SetAutoLayout(true); - this->Layout(); +// this->SetAutoLayout(true); +// this->Layout(); - wxBoxSizer *sizerB = new wxBoxSizer(wxHORIZONTAL); + wxBoxSizer *sizerB = new wxBoxSizer(wxHORIZONTAL); sizerB->Add( _wxvtk2Dbaseview->GetWxVTKRenderWindowInteractor() ,1, wxGROW ); this->GetWindow2()->SetSizer(sizerB); + this->SetAutoLayout(true); this->Layout(); - - + // this->SplitHorizontally( CreateWin1a(this) , _wxvtk2Dbaseview->GetWxVTKRenderWindowInteractor() , 2 ); - - //EEDxx2.4 // this->FitInside(); } @@ -182,8 +168,8 @@ void wxWidgetMesure2D::OnCloseContour(wxCommandEvent& event) _mViewContour_1->Refresh(); _wxvtk2Dbaseview->Refresh(); _wxvtk2Dbaseview->RefreshView(); - } + //------------------------------------------------------------------- void wxWidgetMesure2D::OnVisibleInformation(wxCommandEvent& event) { @@ -192,6 +178,7 @@ void wxWidgetMesure2D::OnVisibleInformation(wxCommandEvent& event) _wxvtk2Dbaseview->Refresh(); _wxvtk2Dbaseview->RefreshView(); } + //------------------------------------------------------------------- manualContourModel* wxWidgetMesure2D::GetManualContourModel() {