]> Creatis software - creaMaracasVisu.git/commitdiff
#3109 creaMaracasVisu Bug New Normal - branch vtk7itk4 compilation with vtk7
authorEduardo DAVILA <davila@localhost.localdomain>
Wed, 26 Jul 2017 13:50:43 +0000 (15:50 +0200)
committerEduardo DAVILA <davila@localhost.localdomain>
Wed, 26 Jul 2017 13:50:43 +0000 (15:50 +0200)
lib/maracasVisuLib/src/interface/wxWindows/widgets/vtkClosePolyData.cxx
lib/maracasVisuLib/src/interface/wxWindows/widgets/vtkClosePolyData.h
lib/maracasVisuLib/src/interface/wxWindows/widgets/vtkMPR3DDataViewer.cxx
lib/maracasVisuLib/src/interface/wxWindows/widgets/vtkPlane2DView.cxx

index 397295f78e440712ac7b19b98653a4b1e9337378..1ed82f0fca438d0aff166978bb4ba2ce1d85164e 100644 (file)
@@ -42,7 +42,6 @@
 =========================================================================*/
 #include "vtkClosePolyData.h"
 
-#include "vtkObjectFactory.h"
 #include "vtkPolyData.h"
 #include "vtkFeatureEdges.h"
 #include "vtkStripper.h"
 
 //EED 2017-01-01 Migration VTK7
 #if VTK_MAJOR_VERSION <= 5
-vtkCxxRevisionMacro(vtkClosePolyData, "$Revision: 1.3 $");
+  vtkCxxRevisionMacro(vtkClosePolyData, "$Revision: 1.3 $");
 #else
-  //...
+  #include "vtkDataObject.h"
+  #include "vtkInformation.h"
+  #include "vtkDemandDrivenPipeline.h"
+  #include "vtkInformationVector.h"
 #endif
 
 vtkStandardNewMacro(vtkClosePolyData);
@@ -111,7 +113,7 @@ vtkClosePolyData::~vtkClosePolyData()
          append->AddInput( input );
          append->AddInput( triangle->GetOutput());
          triangle->Delete();
-             
+             vtkInformation
          vtkCleanPolyData *clean = vtkCleanPolyData::New();
          clean->SetInput( append->GetOutput());
          append->Delete();
@@ -124,12 +126,79 @@ vtkClosePolyData::~vtkClosePolyData()
        }
 
 #else
+/*
        int vtkClosePolyData::ProcessRequest(   vtkInformation *request, 
                                                                                        vtkInformationVector **inputVector, 
                                                                                        vtkInformationVector *outputVector)
        {
-printf("EED Warning ERROR ! vtkClosePolyData::ProcessRequest  not implemented  VTK7 migration")
+printf("EED Warning ERROR ! vtkClosePolyData::ProcessRequest  not implemented  VTK7 migration");
+               // generate the data
+               if(request->Has(vtkDemandDrivenPipeline::REQUEST_INFORMATION()))
+               {
+                       // specify that the output (only one for this filter) will be double
+                       vtkInformation* outInfo = outputVector->GetInformationObject(0);
+                       outInfo->Set(vtkDataObject::SCALAR_TYPE(),VTK_DOUBLE);
+                       return 1;
+               }
+               return this->Superclass::ProcessRequest(request,inputVector,outputVector);
        }
+*/
+
+int vtkClosePolyData::RequestData(  vtkInformation *vtkNotUsed(request),  vtkInformationVector **inputVector,  vtkInformationVector *outputVector)
+{
+
+       // get the info objects
+       vtkInformation *inInfo = inputVector[0]->GetInformationObject(0);
+       vtkInformation *outInfo = outputVector->GetInformationObject(0);
+
+       // get the input and output
+       vtkPolyData *input = vtkPolyData::SafeDownCast(    inInfo->Get(vtkDataObject::DATA_OBJECT()));
+       vtkPolyData *output = vtkPolyData::SafeDownCast(    outInfo->Get(vtkDataObject::DATA_OBJECT()));
+
+       //#closing the polydata see : close.py for details
+       vtkFeatureEdges *boundary = vtkFeatureEdges::New();
+       boundary->SetInputData( input );
+       boundary->BoundaryEdgesOn ();
+       boundary->FeatureEdgesOff ();
+       boundary->NonManifoldEdgesOff ();
+       boundary->ManifoldEdgesOff ();
+       //boundary->ColoringOff ();
+
+       vtkStripper *stripper = vtkStripper::New();
+       stripper->SetInputData( boundary->GetOutput() );
+       stripper->Update(); //important
+       boundary->Delete();
+
+       vtkPolyData *pd = vtkPolyData::New();
+       pd->SetPoints ( stripper->GetOutput()->GetPoints() );
+       pd->SetPolys  ( stripper->GetOutput()->GetLines() );
+       stripper->Delete();
+
+       //vtkGLUTesselatorTriangleFilter *triangle = vtkGLUTesselatorTriangleFilter::New();
+       vtkTriangleFilter *triangle = vtkTriangleFilter::New();
+       triangle->SetInputData( pd );
+       pd->Delete();
+
+       vtkAppendPolyData *append = vtkAppendPolyData::New();
+       append->AddInputData( input );
+       append->AddInputData( triangle->GetOutput());
+       triangle->Delete();
+
+       vtkCleanPolyData *clean = vtkCleanPolyData::New();
+       clean->SetInputData( append->GetOutput());
+       append->Delete();
+  
+       // When all optimizations are complete, this squeeze will be unecessary.
+       // (But it does not seem to cost much.)
+       clean->Update();  //important before ShallowCopy
+       output->ShallowCopy( clean->GetOutput() );
+       clean->Delete();
+
+       return 1;
+}
+
+
+
 
 #endif
 
index 059efc1bacdef1e94c72b107bf598a4c27343a3a..a11f8b858c5128310241ca584a1b45cedf43b7fa 100644 (file)
@@ -55,6 +55,8 @@
 #ifndef __vtkClosePolyData_h
 #define __vtkClosePolyData_h
 
+#include "vtkObjectFactory.h"
+
 //EED 2017-01-01 Migration VTK7
 #if VTK_MAJOR_VERSION <= 5
 #include "vtkPolyDataToPolyDataFilter.h"
@@ -77,7 +79,7 @@ public:
 #if VTK_MAJOR_VERSION <= 5
   vtkTypeRevisionMacro(vtkClosePolyData,vtkPolyDataToPolyDataFilter);
 #else
-  vtkTypeMacro(vtkClosePolyData,vtkPolyDataToPolyDataFilter);
+  vtkTypeMacro(vtkClosePolyData,vtkPolyDataAlgorithm);
 #endif
   void PrintSelf(ostream& os, vtkIndent indent);
 
@@ -91,9 +93,14 @@ protected:
   // Usual data generation method
   void Execute();
 #else
+/*
   int ProcessRequest(  vtkInformation *request, 
                                                vtkInformationVector **inputVector, 
-                                               vtkInformationVector *outputVector);    
+                                               vtkInformationVector *outputVector);
+*/ 
+int RequestData(  vtkInformation *vtkNotUsed(request),  vtkInformationVector **inputVector,  vtkInformationVector *outputVector);
+
+       
 #endif
 
 
index 242c9bd68a415e957e507a4b342621031bfd4746..e43df9aa9ca1882dcb6e674f76ae7ab745037440 100644 (file)
@@ -142,9 +142,16 @@ std::vector<double>*     vtkMPR3DDataViewer::GetctFunVectorBlue()
 //-------------------------------------------------------------------
 void vtkMPR3DDataViewer::SetImage()
 {
+//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
 }
 
 //-------------------------------------------------------------------
@@ -181,7 +188,12 @@ void vtkMPR3DDataViewer::Configure()
        
        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];
@@ -269,7 +281,12 @@ void vtkMPR3DDataViewer::Configure()
                        _saggitalColors = vtkImageMapToColors::New();
                }
                _saggitalColors->RemoveAllInputs();
+//EED 2017-01-01 Migration VTK7
+#if VTK_MAJOR_VERSION <= 5
                _saggitalColors->SetInput( _vtkmprbasedata->GetImageData() );
+#else
+               _saggitalColors->SetInputData( _vtkmprbasedata->GetImageData() );
+#endif
                
        //    _saggitalColors->SetLookupTable(_bwLut);
                
@@ -279,7 +296,12 @@ void vtkMPR3DDataViewer::Configure()
                if(_saggital==NULL)
                {
                        _saggital = vtkImageActor::New();
+//EED 2017-01-01 Migration VTK7
+#if VTK_MAJOR_VERSION <= 5
                        _saggital->SetInput(_saggitalColors->GetOutput());
+#else
+                       _saggital->SetInputData(_saggitalColors->GetOutput());
+#endif
                }       
                //_saggitalColors->Update();
        
@@ -295,14 +317,28 @@ void vtkMPR3DDataViewer::Configure()
                }
 
                _axialColors->RemoveAllInputs();
+
+//EED 2017-01-01 Migration VTK7
+#if VTK_MAJOR_VERSION <= 5
                _axialColors->SetInput( _vtkmprbasedata->GetImageData() );
+#else
+               _axialColors->SetInputData( _vtkmprbasedata->GetImageData() );
+#endif
+
        //    _axialColors->SetLookupTable(_hueLut);
                _axialColors->SetLookupTable(_ctfun);
 
                if(_axial==NULL)
                {
                        _axial = vtkImageActor::New();
+
+//EED 2017-01-01 Migration VTK7
+#if VTK_MAJOR_VERSION <= 5
                        _axial->SetInput(_axialColors->GetOutput());
+#else
+                       _axial->SetInputData(_axialColors->GetOutput());
+#endif
+
                }
                
                //_axialColors->Update();
@@ -315,15 +351,29 @@ void vtkMPR3DDataViewer::Configure()
                        _coronalColors = vtkImageMapToColors::New();
                }
                _coronalColors->RemoveAllInputs();
+
+//EED 2017-01-01 Migration VTK7
+#if VTK_MAJOR_VERSION <= 5
                _coronalColors->SetInput( _vtkmprbasedata->GetImageData() );
+#else
+               _coronalColors->SetInputData( _vtkmprbasedata->GetImageData() );
+#endif
+
        //    _coronalColors->SetLookupTable(_satLut);
                _coronalColors->SetLookupTable(_ctfun);
 
                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
                
        
 
@@ -332,17 +382,29 @@ void vtkMPR3DDataViewer::Configure()
                if(_outlineData==NULL)
                {
                        _outlineData = vtkOutlineFilter::New();
-               }
+               } // if _outlineData
                _outlineData->RemoveAllInputs();
                if(_vtkmprbasedata->GetImageData())
                {
+//EED 2017-01-01 Migration VTK7
+#if VTK_MAJOR_VERSION <= 5
                        _outlineData->SetInput((vtkDataSet *) _vtkmprbasedata->GetImageData() );
-               }
+#else
+                       _outlineData->SetInputData((vtkDataSet *) _vtkmprbasedata->GetImageData() );
+#endif
+               } // if _image
 
                if(_mapOutline==NULL)
                {
                        _mapOutline = vtkPolyDataMapper::New();
+
+//EED 2017-01-01 Migration VTK7
+#if VTK_MAJOR_VERSION <= 5
                        _mapOutline->SetInput(_outlineData->GetOutput());
+#else
+                       _mapOutline->SetInputData(_outlineData->GetOutput());
+#endif
+
                }
                _mapOutline->Update();    
                //_mapOutline->RemoveAllInputs();
index 1016dd464e1fdb5b03c5483b99418953634a35ba..1f5ceee9bdbcfefc0a59f14e18dc02b7e05404b2 100644 (file)
@@ -226,17 +226,37 @@ void vtkPlane2DView::Extract_One_PlaneVTK()
 {
        vtkImageData *imagedata = GetVtkmprbasedata()->GetImageData();
        SetPSource(_sizeIma);
+
+//EED 2017-01-01 Migration VTK7
+#if VTK_MAJOR_VERSION <= 5
        _3Dslices -> SetInput( ( vtkDataSet* )_pSource->GetOutput( ) );
        _3Dslices -> SetSource( imagedata );
+#else
+       _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() );
        _stPoints -> SetScalarTypeToShort();
        _stPoints -> Update();
 //     _change   -> SetInput( _stPoints );  
 //     _change   -> Update();    //important
        _imageViewer2XYZ->GetVtkImageViewer2()->SetInput ( _stPoints );
+
+#else
+       _stPoints -> SetScalarType( imagedata->GetScalarType() );
+       _stPoints -> SetScalarTypeToShort();
+       _imageViewer2XYZ->GetVtkImageViewer2()->SetInputData( _stPoints );
+
+#endif
+
+
 //     _imageViewer2XYZ->GetVtkImageViewer2()->SetInput ( _change->GetOutput() );
        //      vtkImageActor *imageActor = _imageViewer2XYZ->GetVtkImageViewer2()->GetImageActor();
 }
@@ -276,8 +296,14 @@ void vtkPlane2DView::Extract_MIP_PlaneVTK( /*double heightDefinition*/ )
        for ( iWidth=0 ; iWidth<sizeWidth ; iWidth++ )
        {       
                vtkProbeFilter *slice = vtkProbeFilter::New();
+//EED 2017-01-01 Migration VTK7
+#if VTK_MAJOR_VERSION <= 5
                slice -> SetInput( ( vtkDataSet* )_pSource->GetOutput( ) );
                slice -> SetSource( imagedata );
+#else
+               slice -> SetInputData( ( vtkDataSet* )_pSource->GetOutput( ) );
+               slice -> SetSourceData( imagedata );
+#endif
                slice -> Update( );
                slicesLST.push_back( slice );
                _pSource->Push( sp );
@@ -287,11 +313,17 @@ void vtkPlane2DView::Extract_MIP_PlaneVTK( /*double heightDefinition*/ )
                _imageResult = vtkImageData::New();
                _imageResult -> SetDimensions(_sizeIma,_sizeIma,1);
                _imageResult -> SetSpacing(1,1,1);
-               _imageResult -> SetScalarType( imagedata->GetScalarType() );
                _imageResult -> SetExtent(0,_sizeIma-1,0,_sizeIma-1,0,0);
+//EED 2017-01-01 Migration VTK7
+#if VTK_MAJOR_VERSION <= 5
+               _imageResult -> SetScalarType( imagedata->GetScalarType() );
                _imageResult -> SetWholeExtent(0,_sizeIma-1,0,_sizeIma-1,0,0);
                _imageResult -> AllocateScalars();
                _imageResult -> Update();
+#else
+               _imageResult -> AllocateScalars(imagedata->GetScalarType(),1);
+#endif
+
        }
        unsigned short *pTemp;
        unsigned short *pResult;
@@ -324,7 +356,12 @@ void vtkPlane2DView::Extract_MIP_PlaneVTK( /*double heightDefinition*/ )
                slicesLST[iWidth]->Delete();
        }
        _imageResult->Modified();
-       _imageViewer2XYZ->GetVtkImageViewer2()->SetInput ( _imageResult );
+//EED 2017-01-01 Migration VTK7
+#if VTK_MAJOR_VERSION <= 5
+       _imageViewer2XYZ->GetVtkImageViewer2()->SetInput( _imageResult );
+#else
+       _imageViewer2XYZ->GetVtkImageViewer2()->SetInputData( _imageResult );
+#endif
 }
 
 //-------------------------------------------------------------------
@@ -404,7 +441,12 @@ void vtkPlane2DView::HorizontalLine()
        lines->Delete();  //do not delete lines ??
        _lineActor                                      =       vtkActor::New();
     _lineMapper                                        =       vtkPolyDataMapper::New();
+//EED 2017-01-01 Migration VTK7
+#if VTK_MAJOR_VERSION <= 5
        _lineMapper->SetInput(_pd);
+#else
+       _lineMapper->SetInputData(_pd);
+#endif
        _lineMapper->ImmediateModeRenderingOn();
        _lineActor->SetMapper(_lineMapper);
        _lineActor->GetProperty()->BackfaceCullingOn();