]> Creatis software - creaMaracasVisu.git/commitdiff
#3109 creaMaracasVisu Bug New Normal - branch vtk7itk4 compilation with vtk7
authorEduardo DAVILA <davila@localhost.localdomain>
Thu, 27 Jul 2017 09:14:08 +0000 (11:14 +0200)
committerEduardo DAVILA <davila@localhost.localdomain>
Thu, 27 Jul 2017 09:14:08 +0000 (11:14 +0200)
lib/maracasVisuLib/src/interface/wxWindows/widgets/vtkPlane2DView.cxx
lib/maracasVisuLib/src/interface/wxWindows/widgets/wxMaracasMultipleVolumeRendererManager.cxx
lib/maracasVisuLib/src/interface/wxWindows/widgets/wxMaracasMultipleVolumeRendererManagerData.cxx
lib/maracasVisuLib/src/interface/wxWindows/widgets/wxPanelCuttingImageData.cxx
lib/maracasVisuLib/src/interface/wxWindows/widgets/wxSTLWidget_03.cxx
lib/maracasVisuLib/src/interface/wxWindows/widgets/wxSphereView.cxx
lib/maracasVisuLib/src/interface/wxWindows/widgets/wxVTKRenderWindowInteractor.cxx

index 1f5ceee9bdbcfefc0a59f14e18dc02b7e05404b2..5d2b63cc8f926f5846b9e1b8ccf34078a6072e7b 100644 (file)
@@ -248,10 +248,14 @@ void vtkPlane2DView::Extract_One_PlaneVTK()
 //     _change   -> SetInput( _stPoints );  
 //     _change   -> Update();    //important
        _imageViewer2XYZ->GetVtkImageViewer2()->SetInput ( _stPoints );
-
 #else
-       _stPoints -> SetScalarType( imagedata->GetScalarType() );
-       _stPoints -> SetScalarTypeToShort();
+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
index 8ab810eb2d87f954bc1791461ca9cc86f4926380..c0690bdaf5b9fbaeff30e98082365758127abde1 100644 (file)
@@ -163,7 +163,13 @@ vtkImageData* wxMaracasMultipleVolumeRendererManager::getImageData(std::string f
                vtkImageData* img = reader->GetOutput();        
 
                vtkImageCast* cast = vtkImageCast::New(); 
+//EED 2017-01-01 Migration VTK7
+#if VTK_MAJOR_VERSION <= 5
                cast->SetInput(img);
+#else
+               cast->SetInputData(img);
+#endif
+
                cast->SetOutputScalarTypeToUnsignedShort();
                cast->Update();                 
                //reader->Delete();
index d1197c5f5c6a20519dc87e0e7562bbc238a38478..a7680bb84171bd365bb03b189a5a1d18c1c4f411 100644 (file)
@@ -56,7 +56,14 @@ wxMaracasMultipleVolumeRendererManagerData::wxMaracasMultipleVolumeRendererManag
        _newvol = vtkVolume::New();
        _newvol->SetMapper(_volumeMapper );
        _newvol->SetProperty(_volumeProperty );
+
+//EED 2017-01-01 Migration VTK7
+#if VTK_MAJOR_VERSION <= 5
        _volumeMapper->SetInput( _vol );
+#else
+       _volumeMapper->SetInputData( _vol );
+#endif
+
        _volumeMapper->Update();
        _newvol->Update();
 }
index 110ba6d858b8ea4d8b81215433af05a93b7036a1..f656c94742bae153779ad0e5866c354595881efc 100644 (file)
@@ -106,7 +106,12 @@ void wxPanelCuttingImageData::Create3DViewObjects()
        _vtksphere->SetThetaResolution (20);
        _vtksphere->SetPhiResolution (20);
        _sphereMapper   = vtkPolyDataMapper::New();
+//EED 2017-01-01 Migration VTK7
+#if VTK_MAJOR_VERSION <= 5
        _sphereMapper->SetInput( _vtksphere->GetOutput() );
+#else
+       _sphereMapper->SetInputData( _vtksphere->GetOutput() );
+#endif
        _sphereActor    = vtkActor::New();
        _sphereActor->SetMapper(_sphereMapper);
        _sphereActor->SetOrigin(0, 0, 0);
@@ -120,7 +125,12 @@ void wxPanelCuttingImageData::Create3DViewObjects()
        _vtkcube->SetYLength (1);
        _vtkcube->SetZLength (1);
        _cubeMapper             = vtkPolyDataMapper::New();
+//EED 2017-01-01 Migration VTK7
+#if VTK_MAJOR_VERSION <= 5
        _cubeMapper->SetInput( _vtkcube->GetOutput() );
+#else
+       _cubeMapper->SetInputData( _vtkcube->GetOutput() );
+#endif
        _cubeActor              = vtkActor::New();
        _cubeActor->SetMapper(_cubeMapper);
        _cubeActor->SetOrigin(0, 0, 0);
@@ -132,7 +142,14 @@ void wxPanelCuttingImageData::Create3DViewObjects()
        _vtkcylinder    = vtkCylinderSource::New();
        _vtkcylinder->SetResolution(20);
        _cylinderMapper = vtkPolyDataMapper::New();
+
+//EED 2017-01-01 Migration VTK7
+#if VTK_MAJOR_VERSION <= 5
        _cylinderMapper->SetInput( _vtkcylinder->GetOutput() );
+#else
+       _cylinderMapper->SetInputData( _vtkcylinder->GetOutput() );
+#endif
+
        _cylinderActor  = vtkActor::New();
        _cylinderActor->SetMapper(_cylinderMapper);
        _cylinderActor->SetOrigin(0, 0, 0);
@@ -166,7 +183,12 @@ void wxPanelCuttingImageData::InitHistogramme()
        } else {
                _imageData->GetScalarRange(rangeA);
        }
+//EED 2017-01-01 Migration VTK7
+#if VTK_MAJOR_VERSION <= 5
        _xyplot->RemoveAllInputs();
+#else
+       _xyplot->RemoveAllDataSetInputConnections();
+#endif
 /*
        if ( _histogrammeVector!=NULL )
        {
@@ -175,9 +197,14 @@ void wxPanelCuttingImageData::InitHistogramme()
 */
        _histogrammeVector =  vtkImageData::New();
     _histogrammeVector -> SetDimensions ( (int)(rangeA[1]),1,1 );
+//EED 2017-01-01 Migration VTK7
+#if VTK_MAJOR_VERSION <= 5
     _histogrammeVector -> SetScalarTypeToUnsignedShort();
     _histogrammeVector -> AllocateScalars();    
     _histogrammeVector -> Update(); 
+#else
+    _histogrammeVector -> AllocateScalars(VTK_UNSIGNED_SHORT,1);    
+#endif
        
        unsigned short *p_vol = (unsigned short*)_histogrammeVector->GetScalarPointer(0,0,0);
        int i,size = (int) (rangeA[1]);
@@ -188,7 +215,15 @@ void wxPanelCuttingImageData::InitHistogramme()
        }
        _xyplot->SetXRange(0, rangeA[1]);
        _xyplot->SetYRange(0, 10);
+
+
+//EED 2017-01-01 Migration VTK7
+#if VTK_MAJOR_VERSION <= 5
        _xyplot->AddInput( _histogrammeVector );
+#else
+       _xyplot->AddDataSetInput( _histogrammeVector );
+#endif
+
 }
 
 //-------------------------------------------------------------------
@@ -478,7 +513,14 @@ void wxPanelCuttingImageData::OnExtract(wxCommandEvent& event)
                }
        }
        double range[2];
+
+//EED 2017-01-01 Migration VTK7
+#if VTK_MAJOR_VERSION <= 5
        _histogrammeVector->Update();
+#else
+       _histogrammeVector->Modified();
+#endif
+
        _histogrammeVector->GetScalarRange(range);
        _xyplot->SetYRange( 0   , range[1]      );
        _xyplot->SetXRange( min , max           );
index 59c33cd49750734b47fa007f243f615744e2b21a..94735f1d7d0c8f1a6ac6b0ef7bfe3550d6d18857 100644 (file)
@@ -551,17 +551,34 @@ void wxSTLWidget_03::ConfigureProcessing(vtkImageData *img, int x, int y, int z)
                //_thresh->ThresholdBetween(_sl_minSize->GetValue(), _range[1]);
                //SIL//
                _cast = vtkImageCast::New();
+
+//EED 2017-01-01 Migration VTK7
+#if VTK_MAJOR_VERSION <= 5
                _cast->SetInput(_thresh->GetOutput());
+#else
+               _cast->SetInputData(_thresh->GetOutput());
+#endif
+
                _cast->SetOutputScalarTypeToUnsignedChar();
 
                _connect = vtkImageSeedConnectivity::New();
+//EED 2017-01-01 Migration VTK7
+#if VTK_MAJOR_VERSION <= 5
                _connect->SetInput(_cast->GetOutput());
+#else
+               _connect->SetInputData(_cast->GetOutput());
+#endif
                _connect->SetInputConnectValue(255);
                _connect->SetOutputConnectedValue(255);
                _connect->SetOutputUnconnectedValue(0);
 
                cast3 = vtkImageCast::New();
+//EED 2017-01-01 Migration VTK7
+#if VTK_MAJOR_VERSION <= 5
                cast3->SetInput(_connect->GetOutput());
+#else
+               cast3->SetInputData(_connect->GetOutput());
+#endif
                cast3->SetOutputScalarTypeToUnsignedShort();
 
                _thresh2 = vtkImageThreshold::New();
@@ -572,20 +589,40 @@ void wxSTLWidget_03::ConfigureProcessing(vtkImageData *img, int x, int y, int z)
                //SIL//_thresh2->ThresholdBetween(_sl_minSize->GetValue(), _sl_maxSize->GetValue());
 
                cast2 = vtkImageCast::New();
+//EED 2017-01-01 Migration VTK7
+#if VTK_MAJOR_VERSION <= 5
                cast2->SetInput(_thresh2->GetOutput());
+#else
+               cast2->SetInputData(_thresh2->GetOutput());
+#endif
                cast2->SetOutputScalarTypeToUnsignedChar();
                _connect2 = vtkImageSeedConnectivity::New();
+//EED 2017-01-01 Migration VTK7
+#if VTK_MAJOR_VERSION <= 5
                _connect2->SetInput(cast2->GetOutput());
+#else
+               _connect2->SetInputData(cast2->GetOutput());
+#endif
                _connect2->SetInputConnectValue(255);
                _connect2->SetOutputConnectedValue(255);
                _connect2->SetOutputUnconnectedValue(0);
 
                cast4 = vtkImageCast::New();
+//EED 2017-01-01 Migration VTK7
+#if VTK_MAJOR_VERSION <= 5
                cast4->SetInput(_connect2->GetOutput());
+#else
+               cast4->SetInputData(_connect2->GetOutput());
+#endif
                cast4->SetOutputScalarTypeToUnsignedShort();
        }
        _thresh->RemoveAllInputs();
+//EED 2017-01-01 Migration VTK7
+#if VTK_MAJOR_VERSION <= 5
        _thresh->SetInput(_imagedata);  
+#else
+       _thresh->SetInputData(_imagedata);      
+#endif
        _thresh->ThresholdBetween(sl_barrange_segmentation->GetStart(), sl_barrange_segmentation->GetEnd());    
        _thresh->Update();
        
@@ -598,7 +635,14 @@ void wxSTLWidget_03::ConfigureProcessing(vtkImageData *img, int x, int y, int z)
        //cast3->Update();
 //SIL//        
        _thresh2->RemoveAllInputs();
+
+//EED 2017-01-01 Migration VTK7
+#if VTK_MAJOR_VERSION <= 5
        _thresh2->SetInput(_imagedata); 
+#else
+       _thresh2->SetInputData(_imagedata);     
+#endif
+
        _thresh2->ThresholdBetween(sl_barrange_segmentation->GetStart(), sl_barrange_segmentation->GetEnd());
        _thresh2->Update();
        cast2->Update();
@@ -687,9 +731,14 @@ void wxSTLWidget_03::ExtractSurface(int x, int y, int z)
        puntoactualprov[1]      =       y;
        puntoactualprov[2]      =       z;
        
+//EED 2017-01-01 Migration VTK7
+#if VTK_MAJOR_VERSION <= 5
        _imagedata->UpdateInformation();
        _imagedata->SetUpdateExtent(_imagedata->GetWholeExtent());
        _imagedata->Update();
+#else
+       // ..
+#endif
 
        _imagedata->GetSpacing(espprin);
        _imagedata->GetExtent(extprin);
@@ -727,13 +776,26 @@ void wxSTLWidget_03::ExtractSurface(int x, int y, int z)
        // Visualisation - result volume
    
     _2_isoMC6 = vtkMarchingCubes::New();
+//EED 2017-01-01 Migration VTK7
+#if VTK_MAJOR_VERSION <= 5
        _2_isoMC6->SetInput(cast4->GetOutput());
+#else
+       _2_isoMC6->SetInputData(cast4->GetOutput());
+#endif
 
     _2_isoMC6->SetValue(0, 128);
        _2_isoMC6->Update();
 
        _2_isoMapperMC6 = vtkPolyDataMapper::New();
+
+//EED 2017-01-01 Migration VTK7
+#if VTK_MAJOR_VERSION <= 5
     _2_isoMapperMC6->SetInput(_2_isoMC6->GetOutput());
+#else
+    _2_isoMapperMC6->SetInputData(_2_isoMC6->GetOutput());
+#endif
+
+
     _2_isoMapperMC6->ScalarVisibilityOff();
     _2_isoMapperMC6->ImmediateModeRenderingOn();
 
@@ -854,7 +916,12 @@ void wxSTLWidget_03::OnBtnSaveBinaryFile(wxCommandEvent& event)
        {
                vtkMetaImageWriter  *writer= vtkMetaImageWriter::New();
                writer->SetFileName( dialog.GetPath().mb_str(wxConvUTF8) );     
+//EED 2017-01-01 Migration VTK7
+#if VTK_MAJOR_VERSION <= 5
                writer->SetInput(cast4->GetOutput());
+#else
+               writer->SetInputData(cast4->GetOutput());
+#endif
                writer->Write();
                writer->Delete();
        }
@@ -942,7 +1009,12 @@ void wxSTLWidget_03::OnBtnSTLFileLoad(wxCommandEvent& event)
                vtkSTLReader *imgReader= vtkSTLReader::New();
                imgReader->SetFileName( dialog.GetPath().mb_str(wxConvUTF8) );  
                _loadSTLMapper = vtkPolyDataMapper::New();
+//EED 2017-01-01 Migration VTK7
+#if VTK_MAJOR_VERSION <= 5
                _loadSTLMapper->SetInput(imgReader->GetOutput());
+#else
+               _loadSTLMapper->SetInputData(imgReader->GetOutput());
+#endif
                _loadActorSTL = vtkActor::New();
                _loadActorSTL->SetMapper(_loadSTLMapper);
                _loadActorSTL->GetProperty()->SetColor( 1, 0, 0);
@@ -974,7 +1046,12 @@ void wxSTLWidget_03::ConfigureSTL()
                stlInterna = vtkPolyData::New();
 
                dsm1 = vtkPolyDataMapper ::New();
-               dsm1->SetInput (stlInterna); 
+//EED 2017-01-01 Migration VTK7
+#if VTK_MAJOR_VERSION <= 5
+               dsm1->SetInput(stlInterna); 
+#else
+               dsm1->SetInputData(stlInterna); 
+#endif
                dsm1->ScalarVisibilityOff();
 
                actorInternal = vtkActor::New();
@@ -982,7 +1059,14 @@ void wxSTLWidget_03::ConfigureSTL()
                actorInternal->GetProperty()->SetColor (0,1,0);
 
                dsm2 = vtkPolyDataMapper ::New();
-               dsm2->SetInput (stlExterna);
+
+//EED 2017-01-01 Migration VTK7
+#if VTK_MAJOR_VERSION <= 5
+               dsm2->SetInput(stlExterna);
+#else
+               dsm2->SetInputData(stlExterna);
+#endif
+
                dsm2->ScalarVisibilityOff();
 
                actorExternal= vtkActor::New();
@@ -1054,17 +1138,29 @@ void wxSTLWidget_03::OnBtnCreateFileSTL(wxCommandEvent& event)
 
                // 1.1. Se hace un filtro triangular puesto que el stl writer solo recibe poligonos triangulares.
 
-        vtkTriangleFilter *filtro = vtkTriangleFilter::New();
+        vtkClosePolyData                               *cpd    = vtkClosePolyData::New();
+        vtkTriangleFilter                              *filtro = vtkTriangleFilter::New();
+               vtkPolyDataConnectivityFilter   *pdcf   = vtkPolyDataConnectivityFilter::New();
+
+               // 1.2 se escribe a disco el archivo stl de la superficie interna
+//EED 2017-01-01 Migration VTK7
+#if VTK_MAJOR_VERSION <= 5
                filtro->SetInput(stlInterna);
-               vtkPolyDataConnectivityFilter *pdcf = vtkPolyDataConnectivityFilter::New();
         pdcf->SetInput( filtro->GetOutput() );
-        vtkClosePolyData *cpd = vtkClosePolyData::New();
         cpd->SetInput( pdcf->GetOutput() );
-
-               // 1.2 se escribe a disco el archivo stl de la superficie interna
         cpd->Update();
+#else
+               filtro->SetInputData(stlInterna);
+        pdcf->SetInputData( filtro->GetOutput() );
+        cpd->SetInputData( pdcf->GetOutput() );
+#endif
         vtkSTLWriter *writerI = vtkSTLWriter::New();
+//EED 2017-01-01 Migration VTK7
+#if VTK_MAJOR_VERSION <= 5
         writerI->SetInput( cpd->GetOutput() );
+#else
+        writerI->SetInputData( cpd->GetOutput() );
+#endif
 //        prefix = fileprefix;
                filename=prefix+"_internal.stl";
         writerI->SetFileName(filename.c_str());
@@ -1073,10 +1169,20 @@ void wxSTLWidget_03::OnBtnCreateFileSTL(wxCommandEvent& event)
         writerI->Delete();
 
                // 1.3 se escribe a disco el archivo stl de la superficie externa
+//EED 2017-01-01 Migration VTK7
+#if VTK_MAJOR_VERSION <= 5
                filtro->SetInput(stlExterna);
+#else
+               filtro->SetInputData(stlExterna);
+#endif
         cpd->Update();
         vtkSTLWriter *writerE = vtkSTLWriter::New();
+//EED 2017-01-01 Migration VTK7
+#if VTK_MAJOR_VERSION <= 5
         writerE->SetInput( cpd->GetOutput() );
+#else
+        writerE->SetInputData( cpd->GetOutput() );
+#endif
 //        prefix = fileprefix;
                filename=prefix+"_external.stl";
         writerE->SetFileName( filename.c_str() );
index 961918187031c5118bb9d2c959e8aa8d29bc9b43..180e4cd182ed1326275d88a833816412853adf23 100644 (file)
@@ -38,12 +38,18 @@ wxSphereView::wxSphereView( wxWindow *parent, vtkMPRBaseData *vtkmprbasedata/*,
        _imageSphere            =       vtkImageData::New();
        _imageSphere->SetDimensions (150,150,500);
 
+//EED 2017-01-01 Migration VTK7
+#if VTK_MAJOR_VERSION <= 5
 //EED
 //     _imageSphere->SetScalarTypeToUnsignedShort();
        _imageSphere->SetScalarType( _imageDataOriginal->GetScalarType() );
-
        _imageSphere->AllocateScalars();   
        _imageSphere->Update();   
+#else
+       _imageSphere->AllocateScalars(_imageDataOriginal->GetScalarType(),1);   
+#endif
+
+
 
 //EED  ???? vtkBaseData  no esta compartido con los otros objetos .. PLOP
 //     vtkBaseData *vtkbasedata = new vtkBaseData();
@@ -158,7 +164,12 @@ void wxSphereView::Refresh(  )
 void wxSphereView::RefreshView()
 {
 //EED
-       _imageViewer2XYZ->GetVtkImageViewer2()->SetInput ( _imageSphere );
+//EED 2017-01-01 Migration VTK7
+#if VTK_MAJOR_VERSION <= 5
+       _imageViewer2XYZ->GetVtkImageViewer2()->SetInput( _imageSphere );
+#else
+       _imageViewer2XYZ->GetVtkImageViewer2()->SetInputData( _imageSphere );
+#endif
        DefineImageSphere();
 //     UpdateColorWindowLevel();
 //     wxVtk2DBaseView::Refresh();
@@ -419,7 +430,12 @@ void wxSphereView::FiltreImageB(int id, double radio, bool ok,int deltaTMP)
                }
        }
        _imageSphere->Modified();  
+//EED 2017-01-01 Migration VTK7
+#if VTK_MAJOR_VERSION <= 5
        _imageSphere->Update();
+#else
+       // ..
+#endif
 }
 
 //----------------------------------------------------------------------------
index cd205a40428def0a7638f32cb9825deb89bcf72d..a0210c1b752e7c5e3a0de0e0cf1129ebc44f8266 100644 (file)
@@ -152,7 +152,12 @@ BEGIN_EVENT_TABLE(wxVTKRenderWindowInteractor, wxWindow)
   EVT_SIZE        (wxVTKRenderWindowInteractor::OnSize)
 END_EVENT_TABLE()
 
+//EED 2017-01-01 Migration VTK7
+#if VTK_MAJOR_VERSION <= 5
 vtkCxxRevisionMacro(wxVTKRenderWindowInteractor, "$Revision: 1.7 $")
+#else
+  //...
+#endif
 vtkInstantiatorNewMacro(wxVTKRenderWindowInteractor)
 
 //---------------------------------------------------------------------------