From 2ee213ddb39ae803798099822478e210a6bf0d57 Mon Sep 17 00:00:00 2001 From: Eduardo DAVILA Date: Thu, 27 Jul 2017 15:51:06 +0200 Subject: [PATCH] #3109 creaMaracasVisu Bug New Normal - branch vtk7itk4 compilation with vtk7 --- .../manualContour/manualViewBaseContour.cpp | 8 + .../widgets/manualContour/manualViewPoint.cpp | 9 + .../widgets/manualPaint/FillFilter.cpp | 9 + .../manualPaint/baseFilterManualPaint.cpp | 12 + .../wxWindows/widgets/pPlotter/pHistogram.cxx | 15 +- .../wxWindows/widgets/wxVtk2DBaseView.cxx | 17 ++ .../wxWindows/widgets/wxVtkClipping3DView.cxx | 13 +- .../widgets/wxVtkClipping3DViewCntrlPanel.cxx | 20 +- .../wxWindows/widgets/wxVtkMPR2DView.cxx | 14 ++ .../wxWindows/widgets/wxVtkMPR3DView.cxx | 104 +++++++- .../widgets/wxWidgetMesure2D_Plane.cxx | 25 ++ .../src/kernel/PlaneDirectionManagerData.cxx | 49 ++-- .../src/kernel/marDicomBase.cpp | 28 +++ lib/maracasVisuLib/src/kernel/volume.cxx | 231 ++++++++++++++++-- 14 files changed, 506 insertions(+), 48 deletions(-) diff --git a/lib/maracasVisuLib/src/interface/wxWindows/widgets/manualContour/manualViewBaseContour.cpp b/lib/maracasVisuLib/src/interface/wxWindows/widgets/manualContour/manualViewBaseContour.cpp index 198b7b1..e1588bf 100644 --- a/lib/maracasVisuLib/src/interface/wxWindows/widgets/manualContour/manualViewBaseContour.cpp +++ b/lib/maracasVisuLib/src/interface/wxWindows/widgets/manualContour/manualViewBaseContour.cpp @@ -315,7 +315,15 @@ void manualViewBaseContour::ConstructVTKObjects() _bboxMapper = vtkPolyDataMapper::New(); _bboxMapper->ScalarVisibilityOff( ); + +//EED 2017-01-01 Migration VTK7 +#if VTK_MAJOR_VERSION <= 5 _bboxMapper->SetInput(_pd); +#else + _bboxMapper->SetInputData(_pd); +#endif + + _bboxMapper->ImmediateModeRenderingOn(); _contourVtkActor->SetMapper(_bboxMapper); _contourVtkActor->GetProperty()->BackfaceCullingOff(); diff --git a/lib/maracasVisuLib/src/interface/wxWindows/widgets/manualContour/manualViewPoint.cpp b/lib/maracasVisuLib/src/interface/wxWindows/widgets/manualContour/manualViewPoint.cpp index 5a8625a..ca17755 100644 --- a/lib/maracasVisuLib/src/interface/wxWindows/widgets/manualContour/manualViewPoint.cpp +++ b/lib/maracasVisuLib/src/interface/wxWindows/widgets/manualContour/manualViewPoint.cpp @@ -157,7 +157,16 @@ vtkActor* manualViewPoint::CreateVtkPointActor() _pointVtkActor = vtkActor::New(); _bboxMapper = vtkPolyDataMapper::New(); + + +//EED 2017-01-01 Migration VTK7 +#if VTK_MAJOR_VERSION <= 5 _bboxMapper->SetInput(_pd); +#else + _bboxMapper->SetInputData(_pd); +#endif + + // _bboxMapper->ImmediateModeRenderingOn(); _pointVtkActor->SetMapper(_bboxMapper); // _pointVtkActor->GetProperty()->BackfaceCullingOn(); diff --git a/lib/maracasVisuLib/src/interface/wxWindows/widgets/manualPaint/FillFilter.cpp b/lib/maracasVisuLib/src/interface/wxWindows/widgets/manualPaint/FillFilter.cpp index 1139e03..4156a3d 100644 --- a/lib/maracasVisuLib/src/interface/wxWindows/widgets/manualPaint/FillFilter.cpp +++ b/lib/maracasVisuLib/src/interface/wxWindows/widgets/manualPaint/FillFilter.cpp @@ -54,9 +54,18 @@ void FillFilter::SetImages(vtkImageData *image,vtkImageData *image2) // virtual _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 + + } //--------------------------------------------------------------------------- diff --git a/lib/maracasVisuLib/src/interface/wxWindows/widgets/manualPaint/baseFilterManualPaint.cpp b/lib/maracasVisuLib/src/interface/wxWindows/widgets/manualPaint/baseFilterManualPaint.cpp index 0a9f995..0ca0de2 100644 --- a/lib/maracasVisuLib/src/interface/wxWindows/widgets/manualPaint/baseFilterManualPaint.cpp +++ b/lib/maracasVisuLib/src/interface/wxWindows/widgets/manualPaint/baseFilterManualPaint.cpp @@ -91,7 +91,12 @@ void baseFilterManualPaint::SetImages(vtkImageData *image, vtkImageData *image2) _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; @@ -99,7 +104,14 @@ void baseFilterManualPaint::SetImages(vtkImageData *image, vtkImageData *image2) if (_image2!=NULL) { int extB[6]; + +//EED 2017-01-01 Migration VTK7 +#if VTK_MAJOR_VERSION <= 5 _image2->GetWholeExtent(extB); +#else + _image2->GetExtent(extB); +#endif + _maxX = std::min( ext[1]-ext[0] , extB[1]-extB[0] ); _maxY = std::min( ext[3]-ext[2] , extB[3]-extB[2] ); _maxZ = std::min( ext[5]-ext[4] , extB[5]-extB[4] ); diff --git a/lib/maracasVisuLib/src/interface/wxWindows/widgets/pPlotter/pHistogram.cxx b/lib/maracasVisuLib/src/interface/wxWindows/widgets/pPlotter/pHistogram.cxx index c14e951..95dc7a6 100644 --- a/lib/maracasVisuLib/src/interface/wxWindows/widgets/pPlotter/pHistogram.cxx +++ b/lib/maracasVisuLib/src/interface/wxWindows/widgets/pPlotter/pHistogram.cxx @@ -135,9 +135,16 @@ void pHistogram::initializePoints(int xDimension) //setting image data of the points points->SetDimensions(xDimension,1,1); //EED points->SetScalarTypeToUnsignedShort(); + +//EED 2017-01-01 Migration VTK7 +#if VTK_MAJOR_VERSION <= 5 points->SetScalarTypeToDouble(); points->AllocateScalars(); points->Update(); +#else + points->AllocateScalars(VTK_DOUBLE,1); +#endif + } /* @@ -163,12 +170,12 @@ printf("EED pHistogram::setPoints colums:%d\n", (int)(resulttable->GetNumberOfCo */ char* dataImagePointerC = (char*)imageData->GetScalarPointer(0,0,0); - unsigned char* dataImagePointerUC = (unsigned char*)imageData->GetScalarPointer(0,0,0); + unsigned char* dataImagePointerUC = (unsigned char*)imageData->GetScalarPointer(0,0,0); short* dataImagePointerS = (short*)imageData->GetScalarPointer(0,0,0); - unsigned short* dataImagePointerUS = (unsigned short*)imageData->GetScalarPointer(0,0,0); + unsigned short* dataImagePointerUS = (unsigned short*)imageData->GetScalarPointer(0,0,0); float* dataImagePointerF = (float*)imageData->GetScalarPointer(0,0,0); - double* dataImagePointerD = (double*)imageData->GetScalarPointer(0,0,0); - double* dataHistogramPointer = (double*)points->GetScalarPointer(0,0,0); + double* dataImagePointerD = (double*)imageData->GetScalarPointer(0,0,0); + double* dataHistogramPointer = (double*)points->GetScalarPointer(0,0,0); /* Range of greys diff --git a/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxVtk2DBaseView.cxx b/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxVtk2DBaseView.cxx index bd26d12..029f1ef 100644 --- a/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxVtk2DBaseView.cxx +++ b/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxVtk2DBaseView.cxx @@ -108,10 +108,15 @@ void wxVtk2DBaseView::ResetView() wxVTKRenderWindowInteractor *iren = GetWxVTKRenderWindowInteractor(); vtkImageData *imageData = GetVtkBaseData()->GetImageData(); if(imageData){ +//EED 2017-01-01 Migration VTK7 +#if VTK_MAJOR_VERSION <= 5 imageData->UpdateInformation(); imageData->SetUpdateExtent( imageData->GetWholeExtent()); imageData->Update(); _imageViewer2XYZ->GetVtkImageViewer2()->SetInput(imageData ); +#else + _imageViewer2XYZ->GetVtkImageViewer2()->SetInputData(imageData ); +#endif imageData->GetSpacing (spx,spy,spz); imageData->GetExtent (x1,x2,y1,y2,z1,z2); } @@ -151,7 +156,12 @@ void wxVtk2DBaseView::SetImageToVtkViewer(vtkImageData *imageData) { if (_imageViewer2XYZ!=NULL) { +//EED 2017-01-01 Migration VTK7 +#if VTK_MAJOR_VERSION <= 5 _imageViewer2XYZ->GetVtkImageViewer2()->SetInput( imageData ); +#else + _imageViewer2XYZ->GetVtkImageViewer2()->SetInputData( imageData ); +#endif } // if _imageViewer2XYZ } @@ -193,9 +203,16 @@ void wxVtk2DBaseView::Configure(bool okimage) vtkImageData *imageData = GetVtkBaseData()->GetMarImageData()->GetImageData(); if (imageData!=NULL) { + +//EED 2017-01-01 Migration VTK7 +#if VTK_MAJOR_VERSION <= 5 imageData->UpdateInformation(); imageData->SetUpdateExtent( imageData->GetWholeExtent()); imageData->Update(); +#else + //... +#endif + if (okimage==true){ imageData->GetSpacing (spx,spy,spz); imageData->GetExtent (x1,x2,y1,y2,z1,z2); diff --git a/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxVtkClipping3DView.cxx b/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxVtkClipping3DView.cxx index 84c3c60..6172e1d 100644 --- a/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxVtkClipping3DView.cxx +++ b/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxVtkClipping3DView.cxx @@ -179,8 +179,12 @@ void wxVtkClipping3DView::Configure() vtkStripper *stripper=_vtkclipping3Ddataviewer->GetTissueStripper(0); vtkPolyData *polydata= stripper->GetOutput(); - +//EED 2017-01-01 Migration VTK7 +#if VTK_MAJOR_VERSION <= 5 _boxWidgetS1->SetInput( polydata ); +#else + _boxWidgetS1->SetInputData( polydata ); +#endif //EED 2016-08-19 //_boxWidgetS1->PlaceWidget(); @@ -218,7 +222,14 @@ void wxVtkClipping3DView::Configure() _boxWidgetVolume = vtkBoxWidget::New(); _boxWidgetVolume->SetInteractor( _wxvtk3Dbaseview->GetWxVTKRenderWindowInteractor() ); _boxWidgetVolume->SetPlaceFactor(1.25); + +//EED 2017-01-01 Migration VTK7 +#if VTK_MAJOR_VERSION <= 5 _boxWidgetVolume->SetInput( this->GetVtkClipping3DDataViewer()->GetVtkMPRBaseData()->GetImageData() ); +#else + _boxWidgetVolume->SetInputData( this->GetVtkClipping3DDataViewer()->GetVtkMPRBaseData()->GetImageData() ); +#endif + _boxWidgetVolume->PlaceWidget(); _boxWidgetVolume->AddObserver( vtkCommand::InteractionEvent, _vtkclipping3Ddataviewer->GetObserverV() ); _boxWidgetVolume->HandlesOn (); diff --git a/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxVtkClipping3DViewCntrlPanel.cxx b/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxVtkClipping3DViewCntrlPanel.cxx index da8764c..0a706c3 100644 --- a/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxVtkClipping3DViewCntrlPanel.cxx +++ b/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxVtkClipping3DViewCntrlPanel.cxx @@ -496,16 +496,32 @@ void wxVtkClipping3DViewCntrlPanel::OnBtnCreateFileSTL(wxCommandEvent& event) vtkTriangleFilter *filtro = vtkTriangleFilter::New(); - filtro->SetInput( this->_wxvtkclipping3Dview->GetVtkClipping3DDataViewer()->GetTissueClipper(idTissue)->GetOutput() ); vtkPolyDataConnectivityFilter *pdcf = vtkPolyDataConnectivityFilter::New(); - pdcf->SetInput( filtro->GetOutput() ); vtkClosePolyData *cpd = vtkClosePolyData::New(); + + +//EED 2017-01-01 Migration VTK7 +#if VTK_MAJOR_VERSION <= 5 + filtro->SetInput( this->_wxvtkclipping3Dview->GetVtkClipping3DDataViewer()->GetTissueClipper(idTissue)->GetOutput() ); + pdcf->SetInput( filtro->GetOutput() ); cpd->SetInput( pdcf->GetOutput() ); +#else + filtro->SetInputData( this->_wxvtkclipping3Dview->GetVtkClipping3DDataViewer()->GetTissueClipper(idTissue)->GetOutput() ); + pdcf->SetInputData( filtro->GetOutput() ); + cpd->SetInputData( pdcf->GetOutput() ); +#endif // 1.2 se escribe a disco el archivo stl de la superficie interna cpd->Update(); vtkSTLWriter *writer = vtkSTLWriter::New(); + +//EED 2017-01-01 Migration VTK7 +#if VTK_MAJOR_VERSION <= 5 writer->SetInput( cpd->GetOutput() ); +#else + writer->SetInputData( cpd->GetOutput() ); +#endif + filename =prefix; writer->SetFileName(filename.c_str()); writer->SetFileTypeToASCII(); diff --git a/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxVtkMPR2DView.cxx b/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxVtkMPR2DView.cxx index 803bea1..eae1fb6 100644 --- a/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxVtkMPR2DView.cxx +++ b/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxVtkMPR2DView.cxx @@ -115,7 +115,14 @@ void wxVtkMPR2DView::Configure() _ptsA->SetPoint(1, 1000 , 1000 , 1000 ); _pdA = vtkPolyData::New(); _lineAMapper = vtkPolyDataMapper::New(); + +//EED 2017-01-01 Migration VTK7 +#if VTK_MAJOR_VERSION <= 5 _lineAMapper->SetInput(_pdA); +#else + _lineAMapper->SetInputData(_pdA); +#endif + _lineAMapper->ImmediateModeRenderingOn(); _lineAActor->SetMapper(_lineAMapper); } @@ -153,7 +160,14 @@ 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){ _imageViewer2XYZ->GetVtkImageViewer2()->GetRenderer()->AddActor( _lineAActor ); diff --git a/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxVtkMPR3DView.cxx b/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxVtkMPR3DView.cxx index 1d9ff30..a55a101 100644 --- a/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxVtkMPR3DView.cxx +++ b/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxVtkMPR3DView.cxx @@ -218,7 +218,12 @@ void wxVtkMPR3DView::Configure() if(_pointWidget==NULL){ _pointWidget = vtkPointWidget::New(); } +//EED 2017-01-01 Migration VTK7 +#if VTK_MAJOR_VERSION <= 5 _pointWidget->SetInput( imageData ); +#else + _pointWidget->SetInputData( imageData ); +#endif _myCallback->SetVtkPointWidget(_pointWidget); _pointWidget->SetInteractor( GetWxvtk3Dbaseview()->GetWxVTKRenderWindowInteractor() ); _pointWidget->AllOff(); @@ -230,7 +235,12 @@ void wxVtkMPR3DView::Configure() { _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); @@ -251,11 +261,17 @@ void wxVtkMPR3DView::Configure() _vtkplane = vtkPolyData::New(); _probe = vtkProbeFilter::New(); - _probe->SetInput(_vtkplane); - _contourMapper = vtkPolyDataMapper::New(); + +//EED 2017-01-01 Migration VTK7 +#if VTK_MAJOR_VERSION <= 5 + _probe->SetInput(_vtkplane); _contourMapper->SetInput( _probe->GetPolyDataOutput() ); +#else + _probe->SetInputData(_vtkplane); + _contourMapper->SetInputData( _probe->GetPolyDataOutput() ); +#endif _contourPlaneActor = vtkActor::New(); _contourPlaneActor->SetMapper(_contourMapper); @@ -271,7 +287,13 @@ void wxVtkMPR3DView::Configure() } _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(); @@ -349,11 +371,21 @@ void wxVtkMPR3DView::SetImage() { vtkImageData *imageData = GetVtkMPR3DDataViewer()->GetVtkMPRBaseData()->GetImageData(); // Orthogonal planes B&W +//EED 2017-01-01 Migration VTK7 +#if VTK_MAJOR_VERSION <= 5 _planeWidgetX->SetInput( imageData ); _planeWidgetY->SetInput( imageData ); _planeWidgetZ->SetInput( imageData ); // -- Plane widget _probe->SetSource( imageData ); +#else + _planeWidgetX->SetInputData( imageData ); + _planeWidgetY->SetInputData( imageData ); + _planeWidgetZ->SetInputData( imageData ); + // -- Plane widget + _probe->SetSourceData( imageData ); +#endif + _vtkmpr3Ddataviewer->SetImage(); } @@ -370,7 +402,13 @@ vtkImagePlaneWidget* wxVtkMPR3DView::GetPlaneWidget(unsigned char activationkey, double xSpacing = 0, ySpacing = 0, zSpacing = 0; if(image) { + +//EED 2017-01-01 Migration VTK7 +#if VTK_MAJOR_VERSION <= 5 planeWidget->SetInput( image ); +#else + planeWidget->SetInputData( image ); +#endif image->GetExtent(xMin, xMax, yMin, yMax, zMin, zMax); image->GetSpacing(xSpacing, ySpacing, zSpacing); } @@ -555,7 +593,12 @@ void wxVtkMPR3DView::RefreshView() // virtual if(_pointWidget) { +//EED 2017-01-01 Migration VTK7 +#if VTK_MAJOR_VERSION <= 5 _pointWidget->SetInput( image ); +#else + _pointWidget->SetInputData( image ); +#endif _pointWidget->PlaceWidget(); _pointWidget->SetPosition( x,y,z ); @@ -737,7 +780,12 @@ void wxVtkMPR3DView::TestLoic1() double spc[3]; vtkimagedata->GetSpacing(spc); +//EED 2017-01-01 Migration VTK7 +#if VTK_MAJOR_VERSION <= 5 vtkimagedata->Update(); +#else + // .. +#endif double p[3], n[3]; @@ -757,20 +805,41 @@ void wxVtkMPR3DView::TestLoic1() pSource->Update( ); vtkProbeFilter* slices = vtkProbeFilter::New(); + +//EED 2017-01-01 Migration VTK7 +#if VTK_MAJOR_VERSION <= 5 slices->SetInput( ( vtkDataSet* )pSource->GetOutput( ) ); slices->SetSource( vtkimagedata ); slices->Update( ); pSource->Delete( ); +#else + slices->SetInputData( ( vtkDataSet* )pSource->GetOutput( ) ); + slices->SetSourceData( vtkimagedata ); +#endif vtkStructuredPoints *stPoints = vtkStructuredPoints::New(); stPoints -> GetPointData( )->SetScalars( slices->GetOutput()->GetPointData()->GetScalars() ); stPoints -> SetDimensions( sizeIma, sizeIma, 1 ); + +//EED 2017-01-01 Migration VTK7 +#if VTK_MAJOR_VERSION <= 5 stPoints -> SetScalarType( vtkimagedata->GetScalarType() ); stPoints -> SetScalarTypeToShort(); stPoints -> Update(); +#else + vtkInformation* info=stPoints->GetInformation(); + vtkDataObject::SetPointDataActiveScalarInfo(info, VTK_SHORT, 1); +#endif + + vtkImageChangeInformation *change = vtkImageChangeInformation ::New(); +//EED 2017-01-01 Migration VTK7 +#if VTK_MAJOR_VERSION <= 5 change -> SetInput( stPoints ); +#else + change -> SetInputData( stPoints ); +#endif change -> Update(); //important double _range[2]; @@ -794,7 +863,12 @@ void wxVtkMPR3DView::TestLoic1() vtkMetaImageWriter *writer = vtkMetaImageWriter::New( ); +//EED 2017-01-01 Migration VTK7 +#if VTK_MAJOR_VERSION <= 5 writer->SetInput( stPoints ); +#else + writer->SetInputData( stPoints ); +#endif writer->SetFileName( "C:/Users/Images/temp_EED/image.mhd" ); writer->SetFileDimensionality( 2 ); writer->Write( ); @@ -802,7 +876,14 @@ void wxVtkMPR3DView::TestLoic1() vtkDataSetMapper *_3DSliceMapper = vtkDataSetMapper::New( ); + +//EED 2017-01-01 Migration VTK7 +#if VTK_MAJOR_VERSION <= 5 _3DSliceMapper->SetInput(change->GetOutput( ) ); +#else + _3DSliceMapper->SetInputData(change->GetOutput( ) ); +#endif + _3DSliceMapper->SetLookupTable( _bwlookup ); _3DSliceMapper->SetScalarRange( _range ); _3DSliceMapper->ImmediateModeRenderingOn( ); @@ -855,14 +936,24 @@ void wxVtkMPR3DView::TestLoic2() vtkCutter* sliceCutter = vtkCutter::New(); vtkImageData *vtkimagedata = this->GetVtkMPR3DDataViewer()->GetVtkMPRBaseData()->GetImageData(); +//EED 2017-01-01 Migration VTK7 +#if VTK_MAJOR_VERSION <= 5 sliceCutter->SetInput( vtkimagedata ); +#else + sliceCutter->SetInputData( vtkimagedata ); +#endif sliceCutter->SetCutFunction( slicePlane ); //EED // vtkLookupTable *lut = BuildHueWeightBaseMap(); vtkPolyDataMapper *slice = vtkPolyDataMapper::New(); - slice->SetInput( sliceCutter->GetOutput() ); +//EED 2017-01-01 Migration VTK7 +#if VTK_MAJOR_VERSION <= 5 + slice->SetInput( sliceCutter->GetOutput() ); +#else + slice->SetInputData( sliceCutter->GetOutput() ); +#endif double range[2]; // EED // slice->Update(); @@ -876,7 +967,14 @@ void wxVtkMPR3DView::TestLoic2() // sliceActor->SetMapper( slice ); vtkPolyDataMapper *contourMapper = vtkPolyDataMapper::New(); + +//EED 2017-01-01 Migration VTK7 +#if VTK_MAJOR_VERSION <= 5 contourMapper->SetInput( sliceCutter->GetOutput() ); +#else + contourMapper->SetInputData( sliceCutter->GetOutput() ); +#endif + contourMapper->SetScalarRange( range ); // contourMapper->SetLookupTable( lut ); diff --git a/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxWidgetMesure2D_Plane.cxx b/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxWidgetMesure2D_Plane.cxx index 6ffd82d..5445592 100644 --- a/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxWidgetMesure2D_Plane.cxx +++ b/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxWidgetMesure2D_Plane.cxx @@ -226,7 +226,13 @@ void wxWidgetMesure2D_Plane::CircleLine() lines->Delete(); //do not delete lines ?? _circle1Actor = vtkActor::New(); _circle1Mapper = vtkPolyDataMapper::New(); + +//EED 2017-01-01 Migration VTK7 +#if VTK_MAJOR_VERSION <= 5 _circle1Mapper->SetInput(_pdCircle1); +#else + _circle1Mapper->SetInputData(_pdCircle1); +#endif _circle1Mapper->ImmediateModeRenderingOn(); _circle1Actor->SetMapper(_circle1Mapper); _circle1Actor->GetProperty()->BackfaceCullingOn(); @@ -253,7 +259,12 @@ void wxWidgetMesure2D_Plane::CircleLine() lines->Delete(); //do not delete lines ?? _circle2Actor = vtkActor::New(); _circle2Mapper = vtkPolyDataMapper::New(); +//EED 2017-01-01 Migration VTK7 +#if VTK_MAJOR_VERSION <= 5 _circle2Mapper->SetInput(_pdCircle2); +#else + _circle2Mapper->SetInputData(_pdCircle2); +#endif _circle2Mapper->ImmediateModeRenderingOn(); _circle2Actor->SetMapper(_circle2Mapper); _circle2Actor->GetProperty()->BackfaceCullingOn(); @@ -277,7 +288,14 @@ void wxWidgetMesure2D_Plane::CircleLine() lines->Delete(); //do not delete lines ?? _lineRef1Actor = vtkActor::New(); _lineRef1Mapper = vtkPolyDataMapper::New(); + +//EED 2017-01-01 Migration VTK7 +#if VTK_MAJOR_VERSION <= 5 _lineRef1Mapper->SetInput(_pdLineRef1); +#else + _lineRef1Mapper->SetInputData(_pdLineRef1); +#endif + _lineRef1Mapper->ImmediateModeRenderingOn(); _lineRef1Actor->SetMapper(_lineRef1Mapper); _lineRef1Actor->GetProperty()->BackfaceCullingOn(); @@ -301,7 +319,14 @@ void wxWidgetMesure2D_Plane::CircleLine() lines->Delete(); //do not delete lines ?? _lineRef2Actor = vtkActor::New(); _lineRef2Mapper = vtkPolyDataMapper::New(); + +//EED 2017-01-01 Migration VTK7 +#if VTK_MAJOR_VERSION <= 5 _lineRef2Mapper->SetInput(_pdLineRef2); +#else + _lineRef2Mapper->SetInputData(_pdLineRef2); +#endif + _lineRef2Mapper->ImmediateModeRenderingOn(); _lineRef2Actor->SetMapper(_lineRef2Mapper); _lineRef2Actor->GetProperty()->BackfaceCullingOn(); diff --git a/lib/maracasVisuLib/src/kernel/PlaneDirectionManagerData.cxx b/lib/maracasVisuLib/src/kernel/PlaneDirectionManagerData.cxx index 22e4915..a42b0e5 100644 --- a/lib/maracasVisuLib/src/kernel/PlaneDirectionManagerData.cxx +++ b/lib/maracasVisuLib/src/kernel/PlaneDirectionManagerData.cxx @@ -34,33 +34,40 @@ PlaneDirectionManagerData::PlaneDirectionManagerData(int radio, double colour[3] :PlanesOperations(){ _vtkarrow = vtkArrowSource::New(); _arrowMapper = vtkPolyDataMapper::New(); - _arrowActor = vtkActor::New(); + _arrowActor = vtkActor::New(); _vtkarrow->SetTipResolution(30); _vtkarrow->SetShaftResolution( 30 ); + +//EED 2017-01-01 Migration VTK7 +#if VTK_MAJOR_VERSION <= 5 _arrowMapper->SetInput( _vtkarrow->GetOutput() ); +#else + _arrowMapper->SetInputData( _vtkarrow->GetOutput() ); +#endif + _arrowActor->SetMapper(_arrowMapper); - _radio = radio; - _colour = colour; - _opacity = opacity; - - p0 = new double[3]; - p0[0] = 0; - p0[1] = 0; - p0[2] = 0; - p1 = new double[3]; - p1[0] = 0; - p1[1] = 0; - p1[2] = 0; - p2 = new double[3]; - p2[0] = 1; - p2[1] = 1; - p2[2] = 1; - _dir = new double[3]; - _dir[0] = 0; - _dir[1] = 0; - _dir[2] = 0; + _radio = radio; + _colour = colour; + _opacity = opacity; + + p0 = new double[3]; + p0[0] = 0; + p0[1] = 0; + p0[2] = 0; + p1 = new double[3]; + p1[0] = 0; + p1[1] = 0; + p1[2] = 0; + p2 = new double[3]; + p2[0] = 1; + p2[1] = 1; + p2[2] = 1; + _dir = new double[3]; + _dir[0] = 0; + _dir[1] = 0; + _dir[2] = 0; } diff --git a/lib/maracasVisuLib/src/kernel/marDicomBase.cpp b/lib/maracasVisuLib/src/kernel/marDicomBase.cpp index 6d0bb37..9d376c0 100644 --- a/lib/maracasVisuLib/src/kernel/marDicomBase.cpp +++ b/lib/maracasVisuLib/src/kernel/marDicomBase.cpp @@ -633,7 +633,12 @@ void marRAW2Files::loadActualSerie(wxGauge* gauge ) void marRAW2Files::FlipY(vtkImageData *imagedata) { vtkImageData *vtkimagedata = imagedata; +//EED 2017-01-01 Migration VTK7 +#if VTK_MAJOR_VERSION <= 5 vtkimagedata->Update(); +#else + //... +#endif int dim[3]; vtkimagedata->GetDimensions(dim); unsigned short tmp; @@ -662,7 +667,12 @@ void marRAW2Files::FlipY(vtkImageData *imagedata) } } } +//EED 2017-01-01 Migration VTK7 +#if VTK_MAJOR_VERSION <= 5 vtkimagedata->Update(); +#else + vtkimagedata->Modified(); +#endif } // ------------------------------------------------------------------------- @@ -675,7 +685,13 @@ void marRAW2Files::saveVolume( std::string directory, std::string name, vtkImage // Crop vtkExtractVOI *crop = vtkExtractVOI::New(); + +//EED 2017-01-01 Migration VTK7 +#if VTK_MAJOR_VERSION <= 5 crop->SetInput( imagedata ); +#else + crop->SetInputData( imagedata ); +#endif crop->SetVOI( voi ); crop->Update(); @@ -688,7 +704,12 @@ void marRAW2Files::saveVolume( std::string directory, std::string name, vtkImage vtkImageChangeInformation* change = vtkImageChangeInformation::New(); +//EED 2017-01-01 Migration VTK7 +#if VTK_MAJOR_VERSION <= 5 change->SetInput( crop->GetOutput() ); +#else + change->SetInputData( crop->GetOutput() ); +#endif // change->SetExtentTranslation( -ext[0], -ext[2], -ext[4] ); @@ -705,7 +726,14 @@ void marRAW2Files::saveVolume( std::string directory, std::string name, vtkImage std::string nameMW = filename+".mhd"; vtkMetaImageWriter *writer = vtkMetaImageWriter::New( ); + +//EED 2017-01-01 Migration VTK7 +#if VTK_MAJOR_VERSION <= 5 writer->SetInput( change->GetOutput() ); +#else + writer->SetInputData( change->GetOutput() ); +#endif + writer->SetFileName( nameMW.c_str() ); writer->SetFileDimensionality( 3 ); writer->Write( ); diff --git a/lib/maracasVisuLib/src/kernel/volume.cxx b/lib/maracasVisuLib/src/kernel/volume.cxx index c70a31b..9bdafc3 100644 --- a/lib/maracasVisuLib/src/kernel/volume.cxx +++ b/lib/maracasVisuLib/src/kernel/volume.cxx @@ -724,14 +724,14 @@ void kVolume::buildIndex( ) #ifdef KGFO_USE_VTK - vtkCharArray* carray; - vtkDoubleArray* darray; - vtkFloatArray* farray; - vtkIntArray* iarray; - vtkShortArray* sarray; - vtkUnsignedCharArray* ucarray; - vtkUnsignedIntArray* uiarray; - vtkUnsignedShortArray* usarray; + vtkCharArray *carray; + vtkDoubleArray *darray; + vtkFloatArray *farray; + vtkIntArray *iarray; + vtkShortArray *sarray; + vtkUnsignedCharArray *ucarray; + vtkUnsignedIntArray *uiarray; + vtkUnsignedShortArray *usarray; size = _dims[ CX ] * _dims[ CY ] * _dims[ CZ ]; @@ -741,82 +741,279 @@ void kVolume::buildIndex( ) _vtk->SetDimensions( _dims[ CX ], _dims[ CY ], _dims[ CZ ] ); _vtk->SetSpacing( _sizes[ CX ], _sizes[ CY ], _sizes[ CZ ] ); + if (_type==CHAR) + { + carray = vtkCharArray::New( ); + carray->SetArray( ( char* )( _raw ), size, 1 ); +//EED 2017-01-01 Migration VTK7 +#if VTK_MAJOR_VERSION <= 5 + carray->SetNumberOfComponents( 1 ); + _vtk->SetScalarType( VTK_CHAR ); +#else + vtkInformation* infoC=_vtk->GetInformation(); + vtkDataObject::SetPointDataActiveScalarInfo(infoC, VTK_CHAR, 1); +#endif + _vtk->GetPointData( )->SetScalars( carray ); + carray->Delete( ); + } + + if (_type==UCHAR) + { + ucarray = vtkUnsignedCharArray::New( ); + ucarray->SetArray( ( uint8_t* )( _raw ), size, 1 ); +//EED 2017-01-01 Migration VTK7 +#if VTK_MAJOR_VERSION <= 5 + ucarray->SetNumberOfComponents( 1 ); + _vtk->SetScalarType( VTK_UNSIGNED_CHAR ); +#else + vtkInformation* infoUC=_vtk->GetInformation(); + vtkDataObject::SetPointDataActiveScalarInfo(infoUC, VTK_UNSIGNED_CHAR, 1); +#endif + _vtk->GetPointData( )->SetScalars( ucarray ); + ucarray->Delete( ); + } + + + + + + if (_type==SHORT) + { + sarray = vtkShortArray::New( ); + sarray->SetArray( ( int16_t* )( _raw ), size, 1 ); +//EED 2017-01-01 Migration VTK7 +#if VTK_MAJOR_VERSION <= 5 + sarray->SetNumberOfComponents( 1 ); + _vtk->SetScalarType( VTK_SHORT ); +#else + vtkInformation* infoS=_vtk->GetInformation(); + vtkDataObject::SetPointDataActiveScalarInfo(infoS, VTK_SHORT, 1); +#endif + _vtk->GetPointData( )->SetScalars( sarray ); + sarray->Delete( ); +} + + if (_type==INT) + { + iarray = vtkIntArray::New( ); + iarray->SetArray( ( int32_t* )( _raw ), size, 1 ); +//EED 2017-01-01 Migration VTK7 +#if VTK_MAJOR_VERSION <= 5 + iarray->SetNumberOfComponents( 1 ); + _vtk->SetScalarType( VTK_INT ); +#else + vtkInformation* infoI=_vtk->GetInformation(); + vtkDataObject::SetPointDataActiveScalarInfo(infoI, VTK_INT, 1); +#endif + _vtk->GetPointData( )->SetScalars( iarray ); + iarray->Delete( ); + } + + + if (_type==USHORT) + { + usarray = vtkUnsignedShortArray::New( ); + usarray->SetArray( ( uint16_t* )( _raw ), size, 1 ); +//EED 2017-01-01 Migration VTK7 +#if VTK_MAJOR_VERSION <= 5 + usarray->SetNumberOfComponents( 1 ); + _vtk->SetScalarType( VTK_UNSIGNED_SHORT ); +#else + vtkInformation* infoUS=_vtk->GetInformation(); + vtkDataObject::SetPointDataActiveScalarInfo(infoUS, VTK_UNSIGNED_SHORT, 1); +#endif + _vtk->GetPointData( )->SetScalars( usarray ); + usarray->Delete( ); + } + + + if (_type==UINT) + { + uiarray = vtkUnsignedIntArray::New( ); + uiarray->SetArray( ( uint32_t* )( _raw ), size, 1 ); +//EED 2017-01-01 Migration VTK7 +#if VTK_MAJOR_VERSION <= 5 + uiarray->SetNumberOfComponents( 1 ); + _vtk->SetScalarType( VTK_UNSIGNED_INT ); +#else + vtkInformation* infoUI=_vtk->GetInformation(); + vtkDataObject::SetPointDataActiveScalarInfo(infoUI, VTK_UNSIGNED_INT, 1); +#endif + _vtk->GetPointData( )->SetScalars( uiarray ); + uiarray->Delete( ); + } + + + if (_type==FLOAT) + { + farray = vtkFloatArray::New( ); + farray->SetArray( ( float* )( _raw ), size, 1 ); +//EED 2017-01-01 Migration VTK7 +#if VTK_MAJOR_VERSION <= 5 + farray->SetNumberOfComponents( 1 ); + _vtk->SetScalarType( VTK_FLOAT ); +#else + vtkInformation* infoF=_vtk->GetInformation(); + vtkDataObject::SetPointDataActiveScalarInfo(infoF, VTK_FLOAT, 1); +#endif + _vtk->GetPointData( )->SetScalars( farray ); + farray->Delete( ); + } + + + if (_type==DOUBLE) + { + darray = vtkDoubleArray::New( ); + darray->SetArray( ( double* )( _raw ), size, 1 ); +//EED 2017-01-01 Migration VTK7 +#if VTK_MAJOR_VERSION <= 5 + darray->SetNumberOfComponents( 1 ); + _vtk->SetScalarType( VTK_DOUBLE ); +#else + vtkInformation* infoD=_vtk->GetInformation(); + vtkDataObject::SetPointDataActiveScalarInfo(infoD, VTK_DOUBLE, 1); +#endif + + + _vtk->GetPointData( )->SetScalars( darray ); + darray->Delete( ); + } + + + + + + +/* switch( _type ) { case CHAR: carray = vtkCharArray::New( ); - carray->SetNumberOfComponents( 1 ); carray->SetArray( ( char* )( _raw ), size, 1 ); + +//EED 2017-01-01 Migration VTK7 +//#if VTK_MAJOR_VERSION <= 5 + carray->SetNumberOfComponents( 1 ); _vtk->SetScalarType( VTK_CHAR ); +#else + vtkInformation* infoC=_vtk->GetInformation(); + vtkDataObject::SetPointDataActiveScalarInfo(infoC, VTK_CHAR, 1); +#endif + _vtk->GetPointData( )->SetScalars( carray ); carray->Delete( ); break; case UCHAR: ucarray = vtkUnsignedCharArray::New( ); - ucarray->SetNumberOfComponents( 1 ); ucarray->SetArray( ( uint8_t* )( _raw ), size, 1 ); +//EED 2017-01-01 Migration VTK7 +#if VTK_MAJOR_VERSION <= 5 + ucarray->SetNumberOfComponents( 1 ); _vtk->SetScalarType( VTK_UNSIGNED_CHAR ); +#else + vtkInformation* infoUC=_vtk->GetInformation(); + vtkDataObject::SetPointDataActiveScalarInfo(infoUC, VTK_UNSIGNED_CHAR, 1); +#endif _vtk->GetPointData( )->SetScalars( ucarray ); ucarray->Delete( ); break; case SHORT: sarray = vtkShortArray::New( ); - sarray->SetNumberOfComponents( 1 ); sarray->SetArray( ( int16_t* )( _raw ), size, 1 ); +//EED 2017-01-01 Migration VTK7 +#if VTK_MAJOR_VERSION <= 5 + sarray->SetNumberOfComponents( 1 ); _vtk->SetScalarType( VTK_SHORT ); +#else + vtkInformation* infoS=_vtk->GetInformation(); + vtkDataObject::SetPointDataActiveScalarInfo(infoS, VTK_SHORT, 1); +#endif _vtk->GetPointData( )->SetScalars( sarray ); sarray->Delete( ); break; case INT: iarray = vtkIntArray::New( ); - iarray->SetNumberOfComponents( 1 ); iarray->SetArray( ( int32_t* )( _raw ), size, 1 ); +//EED 2017-01-01 Migration VTK7 +#if VTK_MAJOR_VERSION <= 5 + iarray->SetNumberOfComponents( 1 ); _vtk->SetScalarType( VTK_INT ); +#else + vtkInformation* infoI=_vtk->GetInformation(); + vtkDataObject::SetPointDataActiveScalarInfo(infoI, VTK_INT, 1); +#endif _vtk->GetPointData( )->SetScalars( iarray ); iarray->Delete( ); break; case USHORT: usarray = vtkUnsignedShortArray::New( ); - usarray->SetNumberOfComponents( 1 ); usarray->SetArray( ( uint16_t* )( _raw ), size, 1 ); +//EED 2017-01-01 Migration VTK7 +#if VTK_MAJOR_VERSION <= 5 + usarray->SetNumberOfComponents( 1 ); _vtk->SetScalarType( VTK_UNSIGNED_SHORT ); +#else + vtkInformation* infoUS=_vtk->GetInformation(); + vtkDataObject::SetPointDataActiveScalarInfo(infoUS, VTK_UNSIGNED_SHORT, 1); +#endif _vtk->GetPointData( )->SetScalars( usarray ); usarray->Delete( ); break; case UINT: uiarray = vtkUnsignedIntArray::New( ); - uiarray->SetNumberOfComponents( 1 ); uiarray->SetArray( ( uint32_t* )( _raw ), size, 1 ); +//EED 2017-01-01 Migration VTK7 +#if VTK_MAJOR_VERSION <= 5 + uiarray->SetNumberOfComponents( 1 ); _vtk->SetScalarType( VTK_UNSIGNED_INT ); +#else + vtkInformation* infoUI=_vtk->GetInformation(); + vtkDataObject::SetPointDataActiveScalarInfo(infoUI, VTK_UNSIGNED_INT, 1); +#endif _vtk->GetPointData( )->SetScalars( uiarray ); uiarray->Delete( ); break; case FLOAT: farray = vtkFloatArray::New( ); - farray->SetNumberOfComponents( 1 ); farray->SetArray( ( float* )( _raw ), size, 1 ); +//EED 2017-01-01 Migration VTK7 +#if VTK_MAJOR_VERSION <= 5 + farray->SetNumberOfComponents( 1 ); _vtk->SetScalarType( VTK_FLOAT ); +#else + vtkInformation* infoF=_vtk->GetInformation(); + vtkDataObject::SetPointDataActiveScalarInfo(infoF, VTK_FLOAT, 1); +#endif _vtk->GetPointData( )->SetScalars( farray ); farray->Delete( ); break; case DOUBLE: darray = vtkDoubleArray::New( ); - darray->SetNumberOfComponents( 1 ); darray->SetArray( ( double* )( _raw ), size, 1 ); +//EED 2017-01-01 Migration VTK7 +#if VTK_MAJOR_VERSION <= 5 + darray->SetNumberOfComponents( 1 ); _vtk->SetScalarType( VTK_DOUBLE ); +#else + vtkInformation* infoD=_vtk->GetInformation(); + vtkDataObject::SetPointDataActiveScalarInfo(infoD, VTK_DOUBLE, 1); +#endif + + _vtk->GetPointData( )->SetScalars( darray ); darray->Delete( ); break; } // fswitch - +*/ + } // fi #endif // KGFO_USE_VTK -- 2.47.1