void SurfaceRenderingImageStencilExport::Execute(vtkImageData *data){
- vtkPolyData* polydata = (vtkPolyData*)this->GetInput();
-
vtkSmartPointer<vtkPolyDataToImageStencil> polytostencil = vtkSmartPointer<vtkPolyDataToImageStencil>::New();
+
+//EED 2017-01-01 Migration VTK7
+#if VTK_MAJOR_VERSION <= 5
+ vtkPolyData* polydata = (vtkPolyData*)this->GetInput();
polytostencil->SetInput(polydata);
+#else
+ vtkPolyData* polydata = (vtkPolyData*)this->GetInput();
+ polytostencil->SetInputData(polydata);
+#endif
polytostencil->Update();
double *bounds = polydata->GetBounds();
vtkSmartPointer<vtkImageData> imagein = vtkSmartPointer<vtkImageData>::New();
imagein->SetExtent(bounds[0] - 1, bounds[1] + 1, bounds[2] - 1, bounds[3] + 1, bounds[4] - 1, bounds[5] + 1);
+//EED 2017-01-01 Migration VTK7
+#if VTK_MAJOR_VERSION <= 5
imagein->SetScalarTypeToUnsignedShort();
imagein->AllocateScalars();
+#else
+ imagein->AllocateScalars(VTK_UNSIGNED_SHORT,1);
+#endif
int* extent = imagein->GetExtent();
}
vtkSmartPointer<vtkImageStencil> stencil = vtkSmartPointer<vtkImageStencil>::New();
+
+//EED 2017-01-01 Migration VTK7
+#if VTK_MAJOR_VERSION <= 5
stencil->SetInput(imagein);
stencil->SetStencil(polytostencil->GetOutput());
+#else
+ stencil->SetInputData(imagein);
+ stencil->SetStencilData(polytostencil->GetOutput());
+#endif
+
stencil->ReverseStencilOn();
stencil->SetBackgroundValue(128);
stencil->Update();
#ifndef SURFACERENDERINGIMAGESTENCILEXPORT_H
#define SURFACERENDERINGIMAGESTENCILEXPORT_H
-#include <vtkDataSetToImageFilter.h>
+
+#include <vtkImageData.h>
+//EED 2017-01-01 Migration VTK7
+#if VTK_MAJOR_VERSION <= 5
+ #include <vtkDataSetToImageFilter.h>
+#else
+ // ..
+#endif
+
#include <vtkSmartPointer.h>
#include <vtkPolyDataToImageStencil.h>
#include <vtkImageStencil.h>
-#include <vtkImageData.h>
#include <vtkPolyData.h>
class SurfaceRenderingImageStencilExport : public vtkDataSetToImageFilter
}
_dataMapper = vtkPolyDataMapper::New();
+
+//EED 2017-01-01 Migration VTK7
+#if VTK_MAJOR_VERSION <= 5
_dataMapper->SetInput(polydata);
+#else
+ _dataMapper->SetInputData(polydata);
+#endif
vtkActor* dataActor = vtkActor::New();
dataActor->SetMapper(_dataMapper);
vtkSmartPointer<vtkPLYWriter> plywriter =
vtkSmartPointer<vtkPLYWriter>::New();
plywriter->SetFileName(filename);
+//EED 2017-01-01 Migration VTK7
+#if VTK_MAJOR_VERSION <= 5
plywriter->SetInput(_dataMapper->GetInput());
+#else
+ plywriter->SetInputData(_dataMapper->GetInput());
+#endif
plywriter->Write();
}else if(ext.compare(STL) == 0){
vtkSmartPointer<vtkSTLWriter> stlWriter =
vtkSmartPointer<vtkSTLWriter>::New();
stlWriter->SetFileName(filename);
+//EED 2017-01-01 Migration VTK7
+#if VTK_MAJOR_VERSION <= 5
stlWriter->SetInput(_dataMapper->GetInput());
+#else
+ stlWriter->SetInputData(_dataMapper->GetInput());
+#endif
stlWriter->SetFileTypeToBinary();
stlWriter->Write();
}else if(ext.compare(VTK) == 0){
vtkSmartPointer<vtkPolyDataWriter> polydataWriter =
vtkSmartPointer<vtkPolyDataWriter>::New();
polydataWriter->SetFileName(filename);
+//EED 2017-01-01 Migration VTK7
+#if VTK_MAJOR_VERSION <= 5
polydataWriter->SetInput(_dataMapper->GetInput());
+#else
+ polydataWriter->SetInputData(_dataMapper->GetInput());
+#endif
polydataWriter->SetFileTypeToBinary();
polydataWriter->Write();
}else{
void wxMaracasSurfaceRenderingManagerData::exportImageStencil(const char* filename){
if(_dataMapper){
vtkSmartPointer< SurfaceRenderingImageStencilExport> stencilexport = vtkSmartPointer< SurfaceRenderingImageStencilExport >::New();
+//EED 2017-01-01 Migration VTK7
+#if VTK_MAJOR_VERSION <= 5
stencilexport->SetInput( _dataMapper->GetInput());
+#else
+ stencilexport->SetInputData( _dataMapper->GetInput());
+#endif
stencilexport->Update();
vtkImageData* imgstencil = stencilexport->GetOutput();
vtkSmartPointer<vtkMetaImageWriter> metawriter = vtkSmartPointer<vtkMetaImageWriter>::New();
metawriter->SetFileName(filename);
+//EED 2017-01-01 Migration VTK7
+#if VTK_MAJOR_VERSION <= 5
metawriter->SetInput(imgstencil);
+#else
+ metawriter->SetInputData(imgstencil);
+#endif
metawriter->Write();
}else{
cout<<"No poly data set to data mapper."<<endl;
_prop3D=NULL;
_tresholdFilter = vtkImageThreshold::New();
+//EED 2017-01-01 Migration VTK7
+#if VTK_MAJOR_VERSION <= 5
_tresholdFilter->SetInput(this->_imagedata);
+#else
+ _tresholdFilter->SetInputData(this->_imagedata);
+#endif
_tresholdFilter->SetInValue(255);
_tresholdFilter->SetOutValue(0);
_cubesFilter = vtkMarchingCubes::New();
+//EED 2017-01-01 Migration VTK7
+#if VTK_MAJOR_VERSION <= 5
_cubesFilter->SetInput(_tresholdFilter->GetOutput());
+#else
+ _cubesFilter->SetInputData(_tresholdFilter->GetOutput());
+#endif
//_cubesFilter->ComputeGradientsOn();
_cubesFilter->ComputeScalarsOn();
_cubesFilter->ComputeNormalsOn();
_cubesFilter->SetNumberOfContours( 1 );
_cleanFilter = vtkCleanPolyData::New();
- _cleanFilter->SetInput ( _cubesFilter->GetOutput() );
+//EED 2017-01-01 Migration VTK7
+#if VTK_MAJOR_VERSION <= 5
+ _cleanFilter->SetInput( _cubesFilter->GetOutput() );
+#else
+ _cleanFilter->SetInputData( _cubesFilter->GetOutput() );
+#endif
_smooth = vtkSmoothPolyDataFilter::New();
+//EED 2017-01-01 Migration VTK7
+#if VTK_MAJOR_VERSION <= 5
_smooth->SetInput(_cleanFilter->GetOutput());
+#else
+ _smooth->SetInputData(_cleanFilter->GetOutput());
+#endif
_smooth->SetNumberOfIterations(6);
_smooth->SetRelaxationFactor(0.3);
//_smooth->FeatureEdgeSmoothingOff();
_boxWidgetS1->SetInteractor( interactor );
_boxWidgetS1->SetPlaceFactor(1.25);
+//EED 2017-01-01 Migration VTK7
+#if VTK_MAJOR_VERSION <= 5
_boxWidgetS1->SetInput( this->_imagedata );
+#else
+ _boxWidgetS1->SetInputData( this->_imagedata );
+#endif
_boxWidgetS1->PlaceWidget();
boxSurfaceObserver* observer = boxSurfaceObserver::New();
vtkStripper* striper = vtkStripper::New();
+//EED 2017-01-01 Migration VTK7
+#if VTK_MAJOR_VERSION <= 5
striper->SetInput( _smooth->GetOutput() );
+#else
+ striper->SetInputData( _smooth->GetOutput() );
+#endif
//striper->SetInput( _cleanFilter->GetOutput() );
striper->Update();
+//EED 2017-01-01 Migration VTK7
+#if VTK_MAJOR_VERSION <= 5
_boxWidgetS1->SetInput(striper->GetOutput());
+#else
+ _boxWidgetS1->SetInputData(striper->GetOutput());
+#endif
//_boxWidgetS1->PlaceWidget();
_boxWidgetS1->GetPlanes( _tissuePlanes );
_tissueClipper = vtkClipPolyData::New();
+//EED 2017-01-01 Migration VTK7
+#if VTK_MAJOR_VERSION <= 5
_tissueClipper->SetInput( striper->GetOutput() );
+#else
+ _tissueClipper->SetInputData( striper->GetOutput() );
+#endif
_tissueClipper->SetClipFunction( _tissuePlanes );
_tissueClipper->InsideOutOn( );
+//EED 2017-01-01 Migration VTK7
+#if VTK_MAJOR_VERSION <= 5
_dataMapper->SetInput( _tissueClipper->GetOutput() );
+#else
+ _dataMapper->SetInputData( _tissueClipper->GetOutput() );
+#endif
observer->SetPlanes( _tissuePlanes );
observer->SetActor( dataActor );
_boxWidgetS1->AddObserver( vtkCommand::InteractionEvent , observer );
_boxWidgetS1->EnabledOff();
}else{
//_dataMapper->SetInput(_cleanFilter->GetOutput());
+//EED 2017-01-01 Migration VTK7
+#if VTK_MAJOR_VERSION <= 5
_dataMapper->SetInput(_smooth->GetOutput());
+#else
+ _dataMapper->SetInputData(_smooth->GetOutput());
+#endif
}
dataActor->SetMapper(_dataMapper);
#include <vtkProperty2D.h>
#include <vtkCamera.h>
+//EED 2017-01-01 Migration VTK7
+#if VTK_MAJOR_VERSION <= 5
vtkCxxRevisionMacro(vtkInteractorStyleCutter, "$Revision: 1.2 $");
+#else
+// ..
+#endif
vtkStandardNewMacro(vtkInteractorStyleCutter);
//----------------------------------------------------------------------------
pd->SetLines( Lines );
vtkPolyDataMapper2D *bboxMapper = vtkPolyDataMapper2D::New();
+//EED 2017-01-01 Migration VTK7
+#if VTK_MAJOR_VERSION <= 5
bboxMapper->SetInput( pd );
+#else
+ bboxMapper->SetInputData( pd );
+#endif
this->BboxActor = vtkActor2D::New();
this->BboxActor->SetMapper( bboxMapper );
void CutModelData::ChangeShape(int selection)throw( CutModelException){
checkInvariant();
- if(selection == 0){
+ if(selection == 0)
+ {
+//EED 2017-01-01 Migration VTK7
+#if VTK_MAJOR_VERSION <= 5
_Mapper->SetInput(_spherefigure->getPolyData());
+#else
+ _Mapper->SetInputData(_spherefigure->getPolyData());
+#endif
}else if(selection == 1){
+
+#if VTK_MAJOR_VERSION <= 5
_Mapper->SetInput(_cylinderfigure->getPolyData());
+#else
+ _Mapper->SetInputData(_cylinderfigure->getPolyData());
+#endif
+
}else if(selection == 2){
+//EED 2017-01-01 Migration VTK7
+#if VTK_MAJOR_VERSION <= 5
_Mapper->SetInput(_cubefigure->getPolyData());
+#else
+ _Mapper->SetInputData(_cubefigure->getPolyData());
+#endif
}else{
throw CutModelException("Shape type not found");
}
_img2 = vtkImageData::New();
_img2->SetExtent(_img->GetExtent());
_img2->SetSpacing(_img->GetSpacing());
+//EED 2017-01-01 Migration VTK7
+#if VTK_MAJOR_VERSION <= 5
_img2->AllocateScalars();
-
+#else
+ //...
+#endif
_img2->DeepCopy(_img);
}
else
_img = vtkImageData::New();
_img->SetExtent(_img2->GetExtent());
_img->SetSpacing(_img2->GetSpacing());
+//EED 2017-01-01 Migration VTK7
+#if VTK_MAJOR_VERSION <= 5
_img->AllocateScalars();
+#else
+ //...
+#endif
_img->DeepCopy(_img2);
}
sample->CappingOn();
contour = vtkContourFilter::New();
+//EED 2017-01-01 Migration VTK7
+#if VTK_MAJOR_VERSION <= 5
contour->SetInput((vtkDataObject *)sample->GetOutput());
+#else
+ contour->SetInputData((vtkDataObject *)sample->GetOutput());
+#endif
contour->SetValue(0,1);
actor = contour->GetOutput();
actor3D = vtkActor::New();
+//EED 2017-01-01 Migration VTK7
+#if VTK_MAJOR_VERSION <= 5
mapper->SetInput(actor);
+#else
+ mapper->SetInputData(actor);
+#endif
mapper->SetScalarModeToUseCellData();
actor3D->SetMapper( mapper);
_render->AddActor(actor3D);
initializeOutputImage();
int ext[6];
+//EED 2017-01-01 Migration VTK7
+#if VTK_MAJOR_VERSION <= 5
_inImage->GetWholeExtent(ext);
+#else
+ _inImage->GetExtent(ext);
+#endif
int dimX=ext[1]-ext[0]+1;
int dimY=ext[3]-ext[2]+1;
int dimZ=ext[5]-ext[4]+1;
}// for i
_inImage->Modified();
+//EED 2017-01-01 Migration VTK7
+#if VTK_MAJOR_VERSION <= 5
_inImage->Update();
+#else
+ // ..
+#endif
}
void CutModelSaveBinInfo::savePolyData(vtkPolyData* polydata){
vtkPolyDataWriter * writer = vtkPolyDataWriter ::New();
writer->SetFileName(_stdFilename.c_str());
+
+//EED 2017-01-01 Migration VTK7
+#if VTK_MAJOR_VERSION <= 5
writer->SetInput(polydata);
+#else
+ writer->SetInputData(polydata);
+#endif
+
writer->SetFileTypeToBinary();
writer->Write();
writer->Delete();
vtkPolyData* poly = reader->GetOutput();
vtkPolyDataMapper* mapper = vtkPolyDataMapper::New();
+//EED 2017-01-01 Migration VTK7
+#if VTK_MAJOR_VERSION <= 5
mapper->SetInput(poly);
+#else
+ mapper->SetInputData(poly);
+#endif
vtkActor* actor = vtkActor::New();
actor->SetMapper(mapper);
vtkMatrix4x4* actmatrix = actor->GetMatrix();
VTKMetaImageReaderPointerType::New();
readerUndo->SetFileName(undoImagePath.c_str());
this->m_UndoImage = readerUndo->GetOutput();
+//EED 2017-01-01 Migration VTK7
+#if VTK_MAJOR_VERSION <= 5
this->m_UndoImage->Update();
+#else
+ // ..
+#endif
//Loading Redo Image
VTKMetaImageReaderPointerType readerRedo =
VTKMetaImageReaderPointerType::New();
readerRedo->SetFileName(redoImagePath.c_str());
+//EED 2017-01-01 Migration VTK7
+#if VTK_MAJOR_VERSION <= 5
+ // ..
+#else
+ readerRedo->Update();
+#endif
+
this->m_RedoImage = readerRedo->GetOutput();
+//EED 2017-01-01 Migration VTK7
+#if VTK_MAJOR_VERSION <= 5
this->m_RedoImage->Update();
+#else
+ // ...
+#endif
//Updating status
this->m_OnMemory = true;
}
void ImageInfoUR::SaveImageAsMHD(const StringType& filename,
VTKImageDataPointerType image) {
VTKMetaImageWriterPointerType w = VTKMetaImageWriterPointerType::New();
+//EED 2017-01-01 Migration VTK7
+#if VTK_MAJOR_VERSION <= 5
w->SetInput(image);
+#else
+ w->SetInputData(image);
+#endif
w->SetCompression(false);
w->SetFileDimensionality(image->GetDataDimension());
w->SetFileName(filename.c_str());
void ImageUndoRedo::SetImage( VTKImageDataPointerType image )
{
this->m_CurrentImage = image;
+
+//EED 2017-01-01 Migration VTK7
+#if VTK_MAJOR_VERSION <= 5
this->m_CurrentImage->Update( );
+#else
+ // ..
+#endif
+
this->UpdateUndoImage( );
}
// ----------------------------------------------------------------------------------
// ----------------------------------------------------------------------------------
void ImageUndoRedo::UpdateUndoImage( )
{
+//EED 2017-01-01 Migration VTK7
+#if VTK_MAJOR_VERSION <= 5
this->m_CurrentImage->Update( );
+#else
+ // ...
+#endif
this->m_UndoImage = VTKImageDataPointerType::New( );
this->m_UndoImage->DeepCopy( m_CurrentImage );
+//EED 2017-01-01 Migration VTK7
+#if VTK_MAJOR_VERSION <= 5
this->m_UndoImage->Update( );
+#else
+ // ..
+#endif
}
// ----------------------------------------------------------------------------------
ImageUndoRedo::VTKImageDataPointerType ImageUndoRedo::GetImageRegion(
extract->SetVOI( region.minX, region.maxX, region.minY, region.maxY,
region.minZ, region.maxZ );
extract->SetSampleRate( 1, 1, 1 );
+//EED 2017-01-01 Migration VTK7
+#if VTK_MAJOR_VERSION <= 5
extract->SetInput( img );
+#else
+ extract->SetInputData( img );
+#endif
VTKImageDataPointerType imgResult = extract->GetOutput( );
+
+//EED 2017-01-01 Migration VTK7
+#if VTK_MAJOR_VERSION <= 5
imgResult->Update( );
+#else
+ // ..
+#endif
+
return ( imgResult );
}
// ----------------------------------------------------------------------------------
reset( );
vtkExtractVOI *crop = vtkExtractVOI::New();
+//EED 2017-01-01 Migration VTK7
+#if VTK_MAJOR_VERSION <= 5
crop->SetInput( vol->castVtk( ) );
+#else
+ crop->SetInputData( vol->castVtk( ) );
+#endif
crop->SetVOI( voi );
//crop->SetSampleRate( getParameters( )->getVoxelSize( ), getParameters( )->getVoxelSize( ), getParameters( )->getVoxelSize( ));
// RescalaIntercept = 0;
vtkImageShiftScale *scale = vtkImageShiftScale::New();
+//EED 2017-01-01 Migration VTK7
+#if VTK_MAJOR_VERSION <= 5
scale->SetInput( crop->GetOutput( ) );
+#else
+ scale->SetInputData( crop->GetOutput( ) );
+#endif
scale->SetScale(RescalaSlope);
scale->SetShift(0);
scale->SetOutputScalarTypeToShort();
scale->Update();
vtkImageShiftScale *shift = vtkImageShiftScale::New();
+//EED 2017-01-01 Migration VTK7
+#if VTK_MAJOR_VERSION <= 5
shift->SetInput( scale->GetOutput( ) );
+#else
+ shift->SetInputData( scale->GetOutput( ) );
+#endif
shift->SetScale(1);
shift->SetShift(RescalaIntercept);
shift->SetOutputScalarTypeToShort();
vtkImageThreshold *threshold = vtkImageThreshold::New();
+//EED 2017-01-01 Migration VTK7
+#if VTK_MAJOR_VERSION <= 5
threshold->SetInput( shift->GetOutput( ) );
+#else
+ threshold->SetInputData( shift->GetOutput( ) );
+#endif
threshold->ThresholdByUpper (-10000);
threshold->ThresholdByLower (-1);
threshold->SetInValue(0);
threshold->SetOutputScalarTypeToUnsignedShort();
vtkImageResample* ir = vtkImageResample::New( );
+//EED 2017-01-01 Migration VTK7
+#if VTK_MAJOR_VERSION <= 5
ir->SetInput( threshold->GetOutput( ) );
+#else
+ ir->SetInputData( threshold->GetOutput( ) );
+#endif
ir->SetDimensionality( 3 );
double voxelSize= getParameters( )->getVoxelSize( );
ir->SetAxisOutputSpacing( 0, voxelSize );
* Before we were using kgfoCrop which assume extent start at 0,0,0
*/
vtkImageChangeInformation* change = vtkImageChangeInformation::New();
+//EED 2017-01-01 Migration VTK7
+#if VTK_MAJOR_VERSION <= 5
change->SetInput( ir->GetOutput() );
+#else
+ change->SetInputData( ir->GetOutput() );
+#endif
+
change->SetExtentTranslation( -ext[0], -ext[2], -ext[4] );
change->SetOutputSpacing ( voxelSize , voxelSize , voxelSize );
change->Update(); //important
// 1. CALCULATING THE INNER SURFACE
// ------------------------------------------------------------------------
vtkImageGaussianSmooth *gaussFilter = vtkImageGaussianSmooth::New();
+//EED 2017-01-01 Migration VTK7
+#if VTK_MAJOR_VERSION <= 5
gaussFilter->SetInput(volume);
+#else
+ gaussFilter->SetInputData(volume);
+#endif
gaussFilter->SetDimensionality(3);
gaussFilter->SetStandardDeviation(sigmaLevel);
vtkMarchingCubes *cubesFilter = vtkMarchingCubes::New();
+//EED 2017-01-01 Migration VTK7
+#if VTK_MAJOR_VERSION <= 5
cubesFilter->SetInput(gaussFilter->GetOutput());
+#else
+ cubesFilter->SetInputData(gaussFilter->GetOutput());
+#endif
cubesFilter->SetValue(0,marchingCubesLevel);
cubesFilter->ComputeGradientsOn ();
cubesFilter->ComputeScalarsOn ();
// Unir puntos duplicados y remover primitivas degeneradas
vtkCleanPolyData *cleanFilter = vtkCleanPolyData::New();
- cleanFilter->SetInput ( cubesFilter->GetOutput() );
+//EED 2017-01-01 Migration VTK7
+#if VTK_MAJOR_VERSION <= 5
+ cleanFilter->SetInput( cubesFilter->GetOutput() );
+#else
+ cleanFilter->SetInputData( cubesFilter->GetOutput() );
+#endif
// crea poligonos triangulares
vtkTriangleFilter *triangleFilter = vtkTriangleFilter::New();
+//EED 2017-01-01 Migration VTK7
+#if VTK_MAJOR_VERSION <= 5
triangleFilter->SetInput( cleanFilter->GetOutput() );
+#else
+ triangleFilter->SetInputData( cleanFilter->GetOutput() );
+#endif
triangleFilter->Update();
innerSurface->DeepCopy(triangleFilter->GetOutput());
// 2. CALCULATING THE OUTER SURFACE
// ------------------------------------------------------------------------
vtkImageContinuousDilate3D *dilateFilter = vtkImageContinuousDilate3D ::New();
- dilateFilter->SetInput (volume);
+//EED 2017-01-01 Migration VTK7
+#if VTK_MAJOR_VERSION <= 5
+ dilateFilter->SetInput(volume);
+#else
+ dilateFilter->SetInputData(volume);
+#endif
dilateFilter->SetKernelSize (3, 3, 3);
+//EED 2017-01-01 Migration VTK7
+#if VTK_MAJOR_VERSION <= 5
gaussFilter->SetInput( dilateFilter->GetOutput());
+#else
+ gaussFilter->SetInputData( dilateFilter->GetOutput());
+#endif
triangleFilter->Update();
outerSurface->DeepCopy(triangleFilter->GetOutput());