From: Eduardo DAVILA Date: Tue, 7 Aug 2018 14:41:26 +0000 (+0200) Subject: #3219 creaMaracasVisu Feature New Normal - vtk8itk4wx3-mingw64 X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=commitdiff_plain;h=25e3adf442d6a8d357d52410267445c54426c525;p=creaMaracasVisu.git #3219 creaMaracasVisu Feature New Normal - vtk8itk4wx3-mingw64 --- 25e3adf442d6a8d357d52410267445c54426c525 diff --cc bbtk/src/bbmaracasvisuImageActor.cxx index d640d8d,40b3f24..34c0fd7 --- a/bbtk/src/bbmaracasvisuImageActor.cxx +++ b/bbtk/src/bbmaracasvisuImageActor.cxx @@@ -40,29 -47,87 +47,88 @@@ printf("EED ImageActor::Process Start\n vtkRenderer *render = bbGetInputRenderer(); vtkImageData *img = bbGetInputIn(); vtkLinearTransform* transform = bbGetInputTransform(); - - if(img != NULL) ++ ++ ++ if(img != NULL) + { + if (bbGetInputLookupTable()==NULL) + { + imageactor->SetInput( img ); + } else { + /* + vtkLookupTable *table = vtkLookupTable::New(); + table->SetRange(0, 1000); // image intensity range + table->SetValueRange(0.0, 1.0); // from black to white + table->SetSaturationRange(0.0, 0.0); // no color saturation + table->SetRampToLinear(); + table->Build(); + double rgba[4]; + table->GetTableValue(0,rgba); + rgba[3]=0; + table->SetTableValue(0,rgba); + */ - if(img != NULL){ - - //EED 2017-01-01 Migration VTK7 - #if VTK_MAJOR_VERSION <= 5 - imageshiftscale->SetInput( img ); - #else - imageshiftscale->SetInputData( img ); - #endif - imageshiftscale->SetOutputScalarTypeToUnsignedChar(); - - //EED 2017-01-01 Migration VTK7 - #if VTK_MAJOR_VERSION <= 5 - imageactor->SetInput( imageshiftscale->GetOutput() ); - #else - imageshiftscale->Update(); - imageactor->SetInputData( imageshiftscale->GetOutput() ); - #endif - if (transform!=NULL){ + + /* + vtkLookupTable *table = vtkLookupTable::New(); + table->SetTableRange (0, 2000); + table->SetHueRange (1, 0); + table->SetSaturationRange (1, 1); + table->SetValueRange (1, 1); + table->Build(); //effective built + */ + + /* + vtkColorTransferFunction *table = vtkColorTransferFunction::New(); + table->SetColorSpaceToHSV(); + table->HSVWrapOff(); + table->AddHSVSegment(0.0, 0.6, 1.0, 1.0, + 1.0, 0.0, 1.0, 1.0); + table->SetNanColor(1.0, 0.0, 1.0); + */ + + /* + printf("EED ImageActor::Process Warnning ***************************Not here this code *"); + vtkLookupTable *table = vtkLookupTable::New(); + table->SetNumberOfTableValues(1000); + table->SetRange(0, 1000); + table->Build(); + double rgba1[4]; + double rgba2[4]; + for (int iLookTable = 0; iLookTable<500; iLookTable++) + { + table->GetTableValue( iLookTable, rgba1); + table->GetTableValue(1000-1-iLookTable, rgba2); + table->SetTableValue(1000-1-iLookTable , rgba1[0],rgba1[1],rgba1[2],rgba1[3]); + table->SetTableValue( iLookTable , rgba2[0],rgba2[1],rgba2[2],rgba2[3]); + } // for iLookTable + double rgba[4]; + table->GetTableValue(0,rgba); + rgba[3]=0; + table->SetTableValue(0,rgba); + */ + vtkImageMapToColors *color = vtkImageMapToColors::New(); + color->SetLookupTable( bbGetInputLookupTable() ); + // color->SetLookupTable( table ); + color->PassAlphaToOutputOn(); + + // imageshiftscale->SetInput( img ); + // imageshiftscale->SetOutputScalarTypeToUnsignedChar(); + + // color->SetInput( imageshiftscale->GetOutput() ); + color->SetInput( img ); + color->Update(); + imageactor->GetMapper()->SetInput( color->GetOutput() ); + imageactor->GetProperty()->SetInterpolationTypeToNearest(); + } + + if (transform!=NULL) + { imageactor->SetUserTransform( transform ); } // transform - if(render != NULL ){ - render->AddActor( imageactor ); + if(render != NULL ) + { + // render->AddActor( imageactor ); } // render bbSetOutputOut(imageactor); } // img diff --cc bbtk/src/bbmaracasvisuImageChangeInformation.cxx index 4a9c2d3,b956413..f32c600 --- a/bbtk/src/bbmaracasvisuImageChangeInformation.cxx +++ b/bbtk/src/bbmaracasvisuImageChangeInformation.cxx @@@ -43,22 -44,7 +44,14 @@@ void ImageChangeInformation::Process( } mchange = vtkImageChangeInformation::New(); img->GetExtent( ext ); - double origin[3]; - origin[0]=0.0; - origin[1]=0.0; - origin[2]=0.0; - img->SetOrigin(origin); + +//EED 2017-01-01 Migration VTK7 +#if VTK_MAJOR_VERSION <= 5 mchange->SetInput( img ); +#else + mchange->SetInputData( img ); +#endif + - //EED 2016 15 06 - // mchange->SetExtentTranslation( -ext[0], -ext[2], -ext[4] ); - mchange->SetOutputOrigin (0, 0, 0); mchange->SetOutputExtentStart(0,0,0); if (bbGetInputNewSpacing().size()==3) { @@@ -67,16 -53,34 +60,35 @@@ spc[2] = bbGetInputNewSpacing()[2]; mchange->SetOutputSpacing( spc[0] , spc[1] , spc [2] ); //spacing } + if (bbGetInputNewOrigin().size()==3) + { + if ( (bbGetInputNewOrigin()[0]==-1) && (bbGetInputNewOrigin()[1]==-1) && (bbGetInputNewOrigin()[2]==-1) ) + { + img->GetOrigin( origin ); + } else { + origin[0] = bbGetInputNewOrigin()[0]; + origin[1] = bbGetInputNewOrigin()[1]; + origin[2] = bbGetInputNewOrigin()[2]; + } + } else { + origin[0] = 0; + origin[1] = 0; + origin[2] = 0; + } + mchange->SetOutputOrigin( origin ); + mchange->Modified(); //important mchange->Update(); //important bbSetOutputOut( mchange->GetOutput() ); - } // img + } // if img ++ } + void ImageChangeInformation::bbUserSetDefaultValues() { - mchange = NULL; - bbSetOutputOut( NULL); - bbSetInputIn(NULL); + mchange = NULL; + bbSetOutputOut( NULL); + bbSetInputIn(NULL); } void ImageChangeInformation::bbUserInitializeProcessing() diff --cc lib/maracasVisuLib/src/interface/wxWindows/Contour/ContourExtractData.cxx index 2947bdc,c08f5d9..8010789 --- a/lib/maracasVisuLib/src/interface/wxWindows/Contour/ContourExtractData.cxx +++ b/lib/maracasVisuLib/src/interface/wxWindows/Contour/ContourExtractData.cxx @@@ -572,36 -561,29 +575,53 @@@ void ContourExtractData::InitVtkImagesR imagedataValueResult->Delete(); } imagedataValueResult = vtkImageData::New(); ++<<<<<<< HEAD + // imagedataValueResult->SetScalarType(scalartype); ++======= + + //EED 2017-12-18 + imagedataValueResult->SetScalarType(scalartype); + //imagedataValueResult->SetScalarTypeToUnsignedShort(); + ++>>>>>>> master imagedataValueResult->SetSpacing(spc); imagedataValueResult->SetDimensions( newDim ); + +//EED 2017-01-01 Migration VTK7 +#if VTK_MAJOR_VERSION <= 5 + imagedataValueResult->SetScalarTypeToUnsignedShort(); imagedataValueResult->AllocateScalars(); +#else + imagedataValueResult->AllocateScalars(VTK_UNSIGNED_SHORT,1); +#endif + if (imagedataMaskResult!=NULL) { imagedataMaskResult->Delete(); } imagedataMaskResult = vtkImageData::New(); ++<<<<<<< HEAD + // imagedataMaskResult->SetScalarType(scalartype); ++======= + + //EED 2017-12-18 + // imagedataMaskResult->SetScalarType(scalartype); + // imagedataMaskResult->SetScalarTypeToUnsignedShort(); + imagedataMaskResult->SetScalarTypeToUnsignedChar(); + ++>>>>>>> master imagedataMaskResult->SetSpacing(spc); imagedataMaskResult->SetDimensions( newDim ); + +//EED 2017-01-01 Migration VTK7 +#if VTK_MAJOR_VERSION <= 5 + imagedataMaskResult->SetScalarTypeToUnsignedShort(); imagedataMaskResult->AllocateScalars(); +#else + imagedataMaskResult->AllocateScalars(VTK_UNSIGNED_SHORT,1); +#endif + } diff --cc lib/maracasVisuLib/src/interface/wxWindows/widgets/ThresholdImageView/LayerImageBase.cxx index 316f785,5140983..9078a7e --- a/lib/maracasVisuLib/src/interface/wxWindows/widgets/ThresholdImageView/LayerImageBase.cxx +++ b/lib/maracasVisuLib/src/interface/wxWindows/widgets/ThresholdImageView/LayerImageBase.cxx @@@ -536,26 -505,13 +539,27 @@@ void LayerImageBase::onThreshold( vtkImageData *img = _imageReslicer->GetOutput(); // img->Update(); // img->UpdateInformation(); - // _thresholdTable->Update(); + +//EED 2017-01-01 Migration VTK7 +#if VTK_MAJOR_VERSION <= 5 _thresholdMapper->SetInput( img ); +#else + _thresholdMapper->SetInputData( img ); +#endif + _thresholdMapper->SetLookupTable( _thresholdTable ); + + +//EED 2017-01-01 Migration VTK7 +#if VTK_MAJOR_VERSION <= 5 _thresholdActor->SetInput( _thresholdMapper->GetOutput() ); +#else + _thresholdMapper->Update(); + _thresholdActor->SetInputData( _thresholdMapper->GetOutput() ); +#endif + + _thresholdActor->SetOpacity(_opacity); - _scalarbarActor->SetLookupTable( _thresholdTable ); // _scalarbarActor->SetLookupTable( _thresholdMapper->GetLookupTable() ); _scalarbarActor->SetTitle("Value"); diff --cc lib/maracasVisuLib/src/interface/wxWindows/widgets/manualInteractorWindowLevel.cxx index 9e09456,f64909e..8ecfd9e --- a/lib/maracasVisuLib/src/interface/wxWindows/widgets/manualInteractorWindowLevel.cxx +++ b/lib/maracasVisuLib/src/interface/wxWindows/widgets/manualInteractorWindowLevel.cxx @@@ -52,18 -52,23 +52,23 @@@ bool manualInteractorWindowLevel::OnMou if (_stateWindowLevel==true) { int tmpPx,tmpPy; - wxVTKRenderWindowInteractor *wxVTKiren; + crea::wxVTKRenderWindowInteractor *wxVTKiren; wxVTKiren = _vtkInteractorStyleBaseView->GetWxVtk2DBaseView()->GetWxVTKRenderWindowInteractor(); wxVTKiren->GetEventPosition( tmpPx , tmpPy ); - double colorWin; double colorLev; - vtkImageData* imgrange = ((wxVtk2DBaseView*)_vtkInteractorStyleBaseView->GetWxVtk2DBaseView())->GetVtkBaseData()->GetImageData(); - - if(imgrange != NULL){ + if(imgrange != NULL) + { double* scalarrange = imgrange->GetScalarRange(); - double scalarr = scalarrange[1] - scalarrange[0]; + double scalarr; + if (scalarrange[1] == scalarrange[0]) + { + scalarr=scalarrange[1]; + if (scalarrange[1]==0) {scalarr=100;} + } else { + scalarr = scalarrange[1] - scalarrange[0]; + } //std::cout<<"scalar r="<GetSize(&w, &h); diff --cc lib/maracasVisuLib/src/interface/wxWindows/widgets/manualPaint/FillFilter.cpp index 4156a3d,8210bec..c1ac0be --- a/lib/maracasVisuLib/src/interface/wxWindows/widgets/manualPaint/FillFilter.cpp +++ b/lib/maracasVisuLib/src/interface/wxWindows/widgets/manualPaint/FillFilter.cpp @@@ -46,28 -50,29 +50,45 @@@ FillFilter::~FillFilter( void FillFilter::SetImages(vtkImageData *image,vtkImageData *image2) // virtual { baseFilterManualPaint::SetImages(image,image2); - if (_auxImageFill != NULL) + + if ((_maxX!=_maxXback) || (_maxY!=_maxYback) || (_maxZ!=_maxZback)) { - _auxImageFill->Delete(); + if (_auxImageFill != NULL) + { + _auxImageFill->Delete(); + } + _auxImageFill = vtkImageData::New(); + _auxImageFill->SetDimensions(_maxX + 1, _maxY + 1, _maxZ + 1); + _auxImageFill->SetOrigin(0, 0, 0); + _auxImageFill->SetExtent(0, _maxX, 0, _maxY, 0, _maxZ); + _auxImageFill->SetWholeExtent(0, _maxX, 0, _maxY, 0, _maxZ); + _auxImageFill->SetScalarTypeToUnsignedChar(); + _auxImageFill->AllocateScalars(); + _ptrAuxImageFill = (unsigned char *)_auxImageFill->GetScalarPointer(); + memset(_ptrAuxImageFill, 0, (_maxX+1) * (_maxY+1) * (_maxZ+1) ); } ++ + _auxImageFill = vtkImageData::New(); + _auxImageFill->SetDimensions(_maxX + 1, _maxY + 1, _maxZ + 1); + _auxImageFill->SetOrigin(0, 0, 0); + _auxImageFill->SetExtent(0, _maxX, 0, _maxY, 0, _maxZ); + + +//EED 2017-01-01 Migration VTK7 +#if VTK_MAJOR_VERSION <= 5 + _auxImageFill->SetWholeExtent(0, _maxX, 0, _maxY, 0, _maxZ); + _auxImageFill->SetScalarTypeToUnsignedChar(); + _auxImageFill->AllocateScalars(); +#else + _auxImageFill->AllocateScalars(VTK_UNSIGNED_CHAR,1); +#endif + - + _maxXback=_maxX; + _maxYback=_maxY; + _maxYback=_maxZ; } + //--------------------------------------------------------------------------- void FillFilter::Run() // virtual { diff --cc lib/maracasVisuLib/src/interface/wxWindows/widgets/manualPaint/baseFilterManualPaint.cpp index 0ca0de2,3941e84..909db02 --- a/lib/maracasVisuLib/src/interface/wxWindows/widgets/manualPaint/baseFilterManualPaint.cpp +++ b/lib/maracasVisuLib/src/interface/wxWindows/widgets/manualPaint/baseFilterManualPaint.cpp @@@ -89,14 -91,8 +91,13 @@@ void baseFilterManualPaint::SetImages(v { _image = image; _image2 = image2; - int ext[6]; +//EED 2017-01-01 Migration VTK7 +#if VTK_MAJOR_VERSION <= 5 _image->GetWholeExtent(ext); +#else + _image->GetExtent(ext); +#endif _minX = 0; _minY = 0; _minZ = 0; diff --cc lib/maracasVisuLib/src/interface/wxWindows/widgets/vtkMPR3DDataViewer.cxx index f352067,45e4f38..5c4e0c7 --- a/lib/maracasVisuLib/src/interface/wxWindows/widgets/vtkMPR3DDataViewer.cxx +++ b/lib/maracasVisuLib/src/interface/wxWindows/widgets/vtkMPR3DDataViewer.cxx @@@ -142,16 -141,10 +141,17 @@@ std::vector* vtkMPR3DDataVi //------------------------------------------------------------------- void vtkMPR3DDataViewer::SetImage() { - _saggitalColors -> SetInput( _vtkmprbasedata->GetImageData() ); - _axialColors -> SetInput( _vtkmprbasedata->GetImageData() ); - _coronalColors -> SetInput( _vtkmprbasedata->GetImageData() ); +//EED 2017-01-01 Migration VTK7 +#if VTK_MAJOR_VERSION <= 5 + _saggitalColors->SetInput( _vtkmprbasedata->GetImageData() ); + _axialColors->SetInput( _vtkmprbasedata->GetImageData() ); + _coronalColors->SetInput( _vtkmprbasedata->GetImageData() ); +#else + _saggitalColors->SetInputData( _vtkmprbasedata->GetImageData() ); + _axialColors->SetInputData( _vtkmprbasedata->GetImageData() ); + _coronalColors->SetInputData( _vtkmprbasedata->GetImageData() ); +#endif + _outlineData -> SetInput((vtkDataSet *) _vtkmprbasedata->GetImageData() ); } //------------------------------------------------------------------- @@@ -182,18 -175,11 +182,16 @@@ void vtkMPR3DDataViewer::Configure( _satLut->SetValueRange (1, 1); */ - double range[2]; double delta; - if(_vtkmprbasedata->GetImageData()) { +//EED 2017-01-01 Migration VTK7 +#if VTK_MAJOR_VERSION <= 5 _vtkmprbasedata->GetImageData()->Update(); +#else + // .. +#endif _vtkmprbasedata->GetImageData()->Modified(); _vtkmprbasedata->GetImageData()->GetScalarRange(range); delta = range[1]-range[0]; @@@ -281,18 -267,9 +279,18 @@@ _saggitalColors = vtkImageMapToColors::New(); } _saggitalColors->RemoveAllInputs(); - _saggitalColors->SetInput( _vtkmprbasedata->GetImageData() ); ++ // _saggitalColors->SetLookupTable(_bwLut); _saggitalColors->SetLookupTable(_ctfun); +//EED 2017-01-01 Migration VTK7 +#if VTK_MAJOR_VERSION <= 5 + _saggitalColors->SetInput( _vtkmprbasedata->GetImageData() ); +#else + _saggitalColors->SetInputData( _vtkmprbasedata->GetImageData() ); + _saggitalColors->Update(); +#endif + + - if(_saggital==NULL) { _saggital = vtkImageActor::New(); @@@ -315,20 -284,10 +310,19 @@@ { _axialColors = vtkImageMapToColors::New(); } - _axialColors->RemoveAllInputs(); - _axialColors->SetInput( _vtkmprbasedata->GetImageData() ); // _axialColors->SetLookupTable(_hueLut); _axialColors->SetLookupTable(_ctfun); + ++ +//EED 2017-01-01 Migration VTK7 +#if VTK_MAJOR_VERSION <= 5 + _axialColors->SetInput( _vtkmprbasedata->GetImageData() ); +#else + _axialColors->SetInputData( _vtkmprbasedata->GetImageData() ); + _axialColors->Update(); +#endif + - if(_axial==NULL) { _axial = vtkImageActor::New(); @@@ -352,33 -302,15 +344,32 @@@ _coronalColors = vtkImageMapToColors::New(); } _coronalColors->RemoveAllInputs(); - _coronalColors->SetInput( _vtkmprbasedata->GetImageData() ); // _coronalColors->SetLookupTable(_satLut); _coronalColors->SetLookupTable(_ctfun); + ++ +//EED 2017-01-01 Migration VTK7 +#if VTK_MAJOR_VERSION <= 5 + _coronalColors->SetInput( _vtkmprbasedata->GetImageData() ); +#else + _coronalColors->SetInputData( _vtkmprbasedata->GetImageData() ); + _coronalColors->Update(); +#endif + + if(_coronal==NULL) { _coronal = vtkImageActor::New(); + +//EED 2017-01-01 Migration VTK7 +#if VTK_MAJOR_VERSION <= 5 _coronal->SetInput(_coronalColors->GetOutput()); - } +#else + _coronal->SetInputData(_coronalColors->GetOutput()); +#endif + + } // if _coronal - - // An outline provides context around the data. // if(_outlineData==NULL) diff --cc lib/maracasVisuLib/src/interface/wxWindows/widgets/wxVtk2DBaseView.cxx index 393b3f1,3879377..b705076 --- a/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxVtk2DBaseView.cxx +++ b/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxVtk2DBaseView.cxx @@@ -104,12 -101,10 +101,12 @@@ void wxVtk2DBaseView::ResetView( double spx = 0,spy = 0,spz = 0; int x1 = 1,x2 = 1,y1 = 1,y2 = 1,z1 = 1,z2 = 1; wxVtkBaseView::Configure(); - - wxVTKRenderWindowInteractor *iren = GetWxVTKRenderWindowInteractor(); + crea::wxVTKRenderWindowInteractor *iren = GetWxVTKRenderWindowInteractor(); vtkImageData *imageData = GetVtkBaseData()->GetImageData(); - if(imageData){ + if(imageData) + { +//EED 2017-01-01 Migration VTK7 +#if VTK_MAJOR_VERSION <= 5 imageData->UpdateInformation(); imageData->SetUpdateExtent( imageData->GetWholeExtent()); imageData->Update(); @@@ -154,15 -146,17 +151,22 @@@ printf("//EED wxVtk2DBaseView::ResetVie //------------------------------------------------------------------- void wxVtk2DBaseView::SetImageToVtkViewer(vtkImageData *imageData) { + int ext[6]; + imageData->Update(); + imageData->GetWholeExtent(ext); if (_imageViewer2XYZ!=NULL) { +//EED 2017-01-01 Migration VTK7 +#if VTK_MAJOR_VERSION <= 5 + _imageViewer2XYZ->SetExtentDimension( ext[0],ext[1],ext[2],ext[3],ext[4],ext[5] ); _imageViewer2XYZ->GetVtkImageViewer2()->SetInput( imageData ); +#else + _imageViewer2XYZ->GetVtkImageViewer2()->SetInputData( imageData ); +#endif } // if _imageViewer2XYZ + + GetRenderer()->GetActiveCamera()->SetClippingRange(0.01, 1000000); + } //------------------------------------------------------------------- diff --cc lib/maracasVisuLib/src/interface/wxWindows/widgets/wxVtkMPR2DView.cxx index 87b4fa3,bf82364..01c7e14 --- a/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxVtkMPR2DView.cxx +++ b/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxVtkMPR2DView.cxx @@@ -160,16 -155,10 +162,17 @@@ void wxVtkMPR2DView::Configure( _pdB->SetPoints( _ptsB ); _pdB->SetLines( linesB ); linesB->Delete(); //do not delete lines ?? + +//EED 2017-01-01 Migration VTK7 +#if VTK_MAJOR_VERSION <= 5 _lineBMapper->SetInput(_pdB); +#else + _lineBMapper->SetInputData(_pdB); +#endif + _lineBMapper->ImmediateModeRenderingOn(); - if(_imageViewer2XYZ){ + if(_imageViewer2XYZ) + { _imageViewer2XYZ->GetVtkImageViewer2()->GetRenderer()->AddActor( _lineAActor ); _imageViewer2XYZ->GetVtkImageViewer2()->GetRenderer()->AddActor( _lineBActor ); vtkCamera *camera =_imageViewer2XYZ->GetVtkImageViewer2()->GetRenderer()->GetActiveCamera(); @@@ -357,21 -348,23 +362,32 @@@ void wxVtkMPR2DView::Refresh( _ptsA->SetPoint(1, xx2 , y , z1 ); _ptsB->SetPoint(0, x , yy1, z1 ); _ptsB->SetPoint(1, x , yy2, z1 ); - - + position[0] = x; + position[1] = y; + focalpoint[0] = x; + focalpoint[1] = y; } // if back - ++ +//EED 2017-01-01 Migration VTK7 +#if VTK_MAJOR_VERSION <= 5 + // .. +#else + _ptsA->Modified(); + _ptsB->Modified(); +#endif + - _backX=xx; - _backY=yy; - _backZ=zz; + if (fixAxis2D == true) + { + GetRenderer()->GetActiveCamera()->SetPosition(position); + GetRenderer()->GetActiveCamera()->SetFocalPoint(focalpoint); + } // if GetFixAxis2D + _lineAActor->GetProperty()->SetOpacity( opacityAxis ); + _lineBActor->GetProperty()->SetOpacity( opacityAxis ); + _backX = xx; + _backY = yy; + _backZ = zz; + _backFixAxis2D = fixAxis2D; + _backOpacityAxis= opacityAxis; } // if image //EED 2016/02/19 diff --cc lib/maracasVisuLib/src/interface/wxWindows/widgets/wxVtkMPR2DView.h index 7a66d83,aea0d6f..4f5e226 --- a/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxVtkMPR2DView.h +++ b/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxVtkMPR2DView.h @@@ -62,6 -62,8 +62,10 @@@ private int _backX; int _backY; int _backZ; ++ + bool _backFixAxis2D; + double _backOpacityAxis; ++ bool _visibleAxis; int _direction; vtkPoints *_ptsA; diff --cc lib/maracasVisuLib/src/interface/wxWindows/widgets/wxVtkMPR3DView.cxx index d6fb6a5,69ffc56..3703011 --- a/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxVtkMPR3DView.cxx +++ b/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxVtkMPR3DView.cxx @@@ -191,6 -171,15 +171,7 @@@ void wxVtkMPR3DView::Configure( // Actors are added to the renderer. vtkActor* _outlineActor = _vtkmpr3Ddataviewer->GetOutlineActor(); _wxvtk3Dbaseview->GetRenderer()->AddActor( _outlineActor ); -// _wxvtk3Dbaseview->GetRenderer()->AddActor( _vtkmpr3Ddataviewer->GetImageActor(0) ); // _saggital -// _wxvtk3Dbaseview->GetRenderer()->AddActor( _vtkmpr3Ddataviewer->GetImageActor(1) ); // _axial -// _wxvtk3Dbaseview->GetRenderer()->AddActor( _vtkmpr3Ddataviewer->GetImageActor(2) ); // _coronal - // vtkPointWidget - //if(_myCallback!=NULL){ - //_myCallback->Delete(); - //} ++ vtkmyPWCallback_3DPointWidget *_myCallback = vtkmyPWCallback_3DPointWidget::New(); _myCallback->SetWxVtkMPR3DView(this); if(imageData){ @@@ -215,15 -197,8 +194,14 @@@ { _planeWidget = vtkPlaneWidget::New(); } +//EED 2017-01-01 Migration VTK7 +#if VTK_MAJOR_VERSION <= 5 _planeWidget->SetInput( imageData ); +#else + _planeWidget->SetInputData( imageData ); +#endif + _myCallback->SetVtkPlaneWidget(_planeWidget); - _planeWidget->NormalToXAxisOn(); _planeWidget->SetResolution(50); _planeWidget->SetRepresentationToOutline(); @@@ -236,49 -209,23 +212,43 @@@ 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(); ++ if(_vtkplane==NULL) ++ { + _vtkplane = vtkPolyData::New(); + _probe = vtkProbeFilter::New(); + _contourMapper = vtkPolyDataMapper::New(); + +//EED 2017-01-01 Migration VTK7 +#if VTK_MAJOR_VERSION <= 5 _probe->SetInput(_vtkplane); - _contourMapper = vtkPolyDataMapper::New(); _contourMapper->SetInput( _probe->GetPolyDataOutput() ); +#else + _myCallback->SetVtkPolyData(_vtkplane); + _myCallback->SetVtkProbeFilter(_probe); + _planeWidget->GetPolyData(_vtkplane); + _probe->SetInputData(_vtkplane); + _probe->SetSourceData(imageData); +// _probe->Update(); + _contourMapper->SetInputData( _probe->GetPolyDataOutput() ); +#endif + _contourPlaneActor = vtkActor::New(); _contourPlaneActor->SetMapper(_contourMapper); - _contourPlaneActor->VisibilityOff(); - _planeWidget->SetInteractor( GetWxvtk3Dbaseview()->GetWxVTKRenderWindowInteractor() ); _planeWidget->AddObserver(vtkCommand::InteractionEvent,_myCallback); - _planeWidget->Off(); _wxvtk3Dbaseview->GetRenderer()->AddActor( _contourPlaneActor ); - } - _planeWidget->GetPolyData(_vtkplane); + +//EED 2017-01-01 Migration VTK7 +#if VTK_MAJOR_VERSION <= 5 _probe->SetSource( imageData ); +#else + _probe->SetSourceData( imageData ); +#endif _contourMapper->SetScalarRange( imageData->GetScalarRange() ); - ConfigureFreePlanes(); } @@@ -725,8 -638,7 +689,7 @@@ void wxVtkMPR3DView::showOutlineActor(b _wxvtk3Dbaseview->GetRenderer()->AddActor( _outlineActor ); } else { _wxvtk3Dbaseview->GetRenderer()->RemoveActor( _outlineActor ); - } + } // value - } //------------------------------------------------------------------- diff --cc lib/maracasVisuLib/src/interface/wxWindows/widgets/wxVtkMPR3DView.h index 4d42b26,c1a639f..5ab97aa --- a/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxVtkMPR3DView.h +++ b/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxVtkMPR3DView.h @@@ -67,15 -63,10 +63,11 @@@ public // EED 25 Janvier 2007 testLoic void TestLoic1(); void TestLoic2(); - - void RemoveActor(vtkActor* actor); - + void RemoveActor(vtkActor* actor); //EED 27/05/2013 // void ResetCamera(int *ext=NULL,double* spc=NULL); - void setColorTransferFunction(vtkColorTransferFunction* colortable); + //Free planes //------------------------------------------------------------------- void ConfigureFreePlanes(); @@@ -83,10 -74,8 +75,9 @@@ void FreePlaneVisible(int plane, bool ok); void FreePlaneInteraction(bool ok); void SetFreePlanesOrtho(); - void SetColorWindow(double colorWindow); void SetColorLevel(double colorLevel); + private: wxVtk3DBaseView *_wxvtk3Dbaseview; vtkMPR3DDataViewer *_vtkmpr3Ddataviewer; diff --cc lib/maracasVisuLib/src/interface/wxWindows/widgets/wxVtkMPR3DViewCntrlPanel.cxx index 33294b4,dd182d5..253a683 --- a/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxVtkMPR3DViewCntrlPanel.cxx +++ b/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxVtkMPR3DViewCntrlPanel.cxx @@@ -141,8 -140,8 +140,9 @@@ wxVtkMPR3DViewCntrlPanel::wxVtkMPR3DVie // wxBoxSizer *sizerH4 = new wxBoxSizer(wxHORIZONTAL); //CPR: If-else statements added 30 Nov 2009 + wxFlexGridSizer *sizerV1; wxFlexGridSizer *sizerH4; + wxFlexGridSizer *sizerH4a; wxFlexGridSizer *sizerH5; wxFlexGridSizer *sizerH6; @@@ -150,48 -149,62 +150,61 @@@ { sizer = new wxFlexGridSizer(4); sizerH4 = new wxFlexGridSizer(3); - - sizerH4->Add( new wxStaticText(panel, -1,_T(" ")) , 1, wxALL|wxEXPAND, 0); - sizerH4->Add( new wxStaticText(panel, -1,_T("GL")) , 1, wxALL|wxEXPAND, 0); - sizerH4->Add( new wxStaticText(panel, -1,_T("Color ")) , 1, wxALL|wxEXPAND, 0); - - sizerH4->Add( _positionX ,1,wxGROW , 0 ); - sizerH4->Add( _ckFreePlaneX, 1, wxALL|wxEXPAND, 0); - sizerH4->Add( _ckBoxX ,0,wxALIGN_CENTER_VERTICAL|wxSHAPED, 0 ); - - sizerH4->Add( _positionY ,1,wxGROW, 0 ); - sizerH4->Add( _ckFreePlaneY, 1, wxALL|wxEXPAND, 0); - sizerH4->Add( _ckBoxY ,0,wxALIGN_CENTER_VERTICAL|wxSHAPED, 0 ); ++ + sizerH4a = new wxFlexGridSizer(3); - sizerH4->Add( _positionZ ,1,wxGROW, 0 ); - sizerH4->Add( _ckFreePlaneZ, 1, wxALL|wxEXPAND, 0); - sizerH4->Add( _ckBoxZ ,0,wxALIGN_CENTER_VERTICAL|wxSHAPED, 0 ); + sizerH4->Add( new wxStaticText(panel, -1,_T(" ")) ,1, wxALL|wxEXPAND , 0); + sizerH4->Add( new wxStaticText(panel, -1,_T("GL")) ,1, wxALL|wxEXPAND , 0); + sizerH4->Add( new wxStaticText(panel, -1,_T("Color ")),1, wxALL|wxEXPAND , 0); + sizerH4->Add( _positionX ,1, wxGROW , 0); + sizerH4->Add( _ckFreePlaneX ,1, wxALL|wxEXPAND , 0); + sizerH4->Add( _ckBoxX ,0, wxALIGN_CENTER_VERTICAL|wxSHAPED , 0); + sizerH4->Add( _positionY ,1, wxGROW , 0); + sizerH4->Add( _ckFreePlaneY ,1, wxALL|wxEXPAND , 0); + sizerH4->Add( _ckBoxY ,0, wxALIGN_CENTER_VERTICAL|wxSHAPED , 0); + sizerH4->Add( _positionZ ,1, wxGROW , 0); + sizerH4->Add( _ckFreePlaneZ ,1, wxALL|wxEXPAND , 0); + sizerH4->Add( _ckBoxZ ,0, wxALIGN_CENTER_VERTICAL|wxSHAPED , 0); //EED 2016/02/19 - sizerH4->Add( _ckBoxInterpolate , 1, wxALL|wxEXPAND, 0); - sizerH4->Add( new wxStaticText(panel, -1,_T(" ")) , 1, wxALL|wxEXPAND, 0); - sizerH4->Add( new wxStaticText(panel, -1,_T(" ")) , 1, wxALL|wxEXPAND, 0); - + sizerH4->Add( _ckBoxInterpolate ,1, wxALL|wxEXPAND , 0); + sizerH4->Add( new wxStaticText(panel, -1,_T(" ")) ,1, wxALL|wxEXPAND , 0); + sizerH4->Add( new wxStaticText(panel, -1,_T(" ")) ,1, wxALL|wxEXPAND , 0); + // sizerH4->Add( _ckBoxXYZ ,1, wxALL|wxEXPAND , 0); + // sizerH4->Add( new wxStaticText(panel, -1,_T(" ")) ,1, wxALL|wxEXPAND , 0); + // sizerH4->Add( new wxStaticText(panel, -1,_T(" ")) ,1, wxALL|wxEXPAND , 0); + + // sizerH4a->Add( new wxStaticText(panel, -1,_T("Axis 2D:")),1, wxALL|wxEXPAND , 0); + sizerH4a->Add( _ckBoxXYZ ,1, wxALL|wxEXPAND , 0); + sizerH4a->Add( _ckBoxFixAxis2D ,1, wxALL|wxEXPAND , 0); + sizerH4a->Add( _opacityAxis ,1, wxALL|wxEXPAND , 0); + + sizerH4->Add( sizerH4a ,1, wxALL|wxEXPAND , 0); + sizerH4->Add( new wxStaticText(panel, -1,_T(" ")) ,1, wxALL|wxEXPAND , 0); + sizerH4->Add( new wxStaticText(panel, -1,_T(" ")) ,1, wxALL|wxEXPAND , 0); + + + sizerH5 = new wxFlexGridSizer(1); - sizerH5->Add( _ckBoxXYZ , 1, wxALL|wxEXPAND, 0); - sizerH5->Add( _ckBoxPlane , 1, wxALL|wxEXPAND, 0); - sizerH5->Add( new wxStaticText(panel, -1,_T(" ")) , 1, wxALL|wxEXPAND, 0); - ////EED 05Nov2012 sizerH5->Add( _ckBox_BW_Color_Plane , 1, wxALL|wxEXPAND, 0); - sizerH5->Add( _ckFreePlaneInteraction , 1, wxALL|wxEXPAND, 0); - sizerH5->Add( btnFreePlanesOrtho , 0, wxALIGN_CENTER_VERTICAL|wxSHAPED, 0 ); - sizerH5->Add( new wxStaticText(panel, -1,_T(" ")) , 1, wxALL|wxEXPAND, 0); - sizerH5->Add( btnColorTable , 0, wxALIGN_CENTER_VERTICAL|wxSHAPED, 0 ); - sizerH5->Add( new wxStaticText(panel, -1,_T(" ")) , 1, wxALL|wxEXPAND, 0); - sizerH5->Add( _cbStereo, 1, wxALL|wxEXPAND, 0); + sizerH5->Add( new wxStaticText(panel, -1,_T(" ")) , 1, wxALL|wxEXPAND , 0); + sizerH5->Add( _ckBoxPlane , 1, wxALL|wxEXPAND , 0); + sizerH5->Add( new wxStaticText(panel, -1,_T(" ")) , 1, wxALL|wxEXPAND , 0); + ////EED 05Nov2012 sizerH5->Add( _ckBox_BW_Color_Plane , 1, wxALL|wxEXPAND , 0); + sizerH5->Add( _ckFreePlaneInteraction , 1, wxALL|wxEXPAND , 0); + sizerH5->Add( btnFreePlanesOrtho , 0, wxALIGN_CENTER_VERTICAL|wxSHAPED , 0); + sizerH5->Add( new wxStaticText(panel, -1,_T(" ")) , 1, wxALL|wxEXPAND , 0); + sizerH5->Add( btnColorTable , 0, wxALIGN_CENTER_VERTICAL|wxSHAPED , 0); + sizerH5->Add( new wxStaticText(panel, -1,_T(" ")) , 1, wxALL|wxEXPAND , 0); + sizerH5->Add( _cbStereo , 1, wxALL|wxEXPAND , 0); sizerH6 = new wxFlexGridSizer(1); - sizerH6->Add( _ckBoxOutline , 1, wxALL|wxEXPAND, 0); - sizerH6->Add( _ckBoxBackGroundBlack , 1, wxALL|wxEXPAND, 0); + sizerH6->Add( _ckBoxOutline , 1, wxALL|wxEXPAND , 0); + sizerH6->Add( _ckBoxBackGroundBlack , 1, wxALL|wxEXPAND , 0); - - sizer->Add( sizerH4 , 1, wxALL|wxGROW, 2); + sizer->Add( sizerH4, 1, wxALL|wxGROW, 2); sizer->Add( sizerH5, 1, wxALL|wxEXPAND,2); sizer->Add( sizerH6, 1, wxALL|wxEXPAND,2); - - + } else { sizer = new wxFlexGridSizer(1); @@@ -750,18 -719,27 +763,32 @@@ void wxVtkMPR3DViewCntrlPanel::OnBackGr void wxVtkMPR3DViewCntrlPanel::OnInterpolate(wxCommandEvent& event) { _wxvtkmpr3Dview->GetVtkMPR3DDataViewer()->GetVtkMPRBaseData()->SetInterpolate( _ckBoxInterpolate->GetValue() ); - _wxvtkmpr3Dview->Refresh(); + wxCommandEvent newevent1(wxEVT_COMMAND_MENU_SELECTED,12121); // Refresh + _wxvtkmpr3Dview->GetWxvtk3Dbaseview()->GetWxVTKRenderWindowInteractor()->GetParent()->ProcessEvent(newevent1); + } + //------------------------------------------------------------------- + void wxVtkMPR3DViewCntrlPanel::OnFixAxis2D(wxCommandEvent& event) + { + _wxvtkmpr3Dview->GetVtkMPR3DDataViewer()->GetVtkMPRBaseData()->SetFixAxis2D( _ckBoxFixAxis2D->GetValue() ); + _wxvtkmpr3Dview->Refresh(); wxCommandEvent newevent1(wxEVT_COMMAND_MENU_SELECTED,12121); // Refresh +//EED 2017-09-16 Migration wxWidgets 2.8 to 3.0 +#if wxMAJOR_VERSION <= 2 _wxvtkmpr3Dview->GetWxvtk3Dbaseview()->GetWxVTKRenderWindowInteractor()->GetParent()->ProcessEvent(newevent1); +#else + _wxvtkmpr3Dview->GetWxvtk3Dbaseview()->GetWxVTKRenderWindowInteractor()->GetParent()->ProcessWindowEvent(newevent1); +#endif + } - + //------------------------------------------------------------------- + void wxVtkMPR3DViewCntrlPanel::OnOpacityAxis(wxCommandEvent& event) + { + _wxvtkmpr3Dview->GetVtkMPR3DDataViewer()->GetVtkMPRBaseData()->SetOpacityAxis( _opacityAxis->GetValue()/100.0 ); + _wxvtkmpr3Dview->Refresh(); + wxCommandEvent newevent1(wxEVT_COMMAND_MENU_SELECTED,12121); // Refresh + _wxvtkmpr3Dview->GetWxvtk3Dbaseview()->GetWxVTKRenderWindowInteractor()->GetParent()->ProcessEvent(newevent1); }