=========================================================================*/
#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);
append->AddInput( input );
append->AddInput( triangle->GetOutput());
triangle->Delete();
-
+ vtkInformation
vtkCleanPolyData *clean = vtkCleanPolyData::New();
clean->SetInput( append->GetOutput());
append->Delete();
}
#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
#ifndef __vtkClosePolyData_h
#define __vtkClosePolyData_h
+#include "vtkObjectFactory.h"
+
//EED 2017-01-01 Migration VTK7
#if VTK_MAJOR_VERSION <= 5
#include "vtkPolyDataToPolyDataFilter.h"
#if VTK_MAJOR_VERSION <= 5
vtkTypeRevisionMacro(vtkClosePolyData,vtkPolyDataToPolyDataFilter);
#else
- vtkTypeMacro(vtkClosePolyData,vtkPolyDataToPolyDataFilter);
+ vtkTypeMacro(vtkClosePolyData,vtkPolyDataAlgorithm);
#endif
void PrintSelf(ostream& os, vtkIndent indent);
// 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
//-------------------------------------------------------------------
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
}
//-------------------------------------------------------------------
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];
_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);
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();
}
_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();
_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
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();
{
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();
}
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 );
_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;
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
}
//-------------------------------------------------------------------
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();