X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=common%2FclitkDicomRTStruct2ImageFilter.cxx;h=fcc9e2be26da9c02cfdcb1a94f10e5ff67874745;hb=c99295881254fc9245d4ee2a4cf940cf87ca2d7f;hp=fa66cfb31361de6d96bea75d01676c0295901b67;hpb=957a4c21ae6aa291c6ad57a45e35c14f5c5d05bb;p=clitk.git diff --git a/common/clitkDicomRTStruct2ImageFilter.cxx b/common/clitkDicomRTStruct2ImageFilter.cxx index fa66cfb..fcc9e2b 100644 --- a/common/clitkDicomRTStruct2ImageFilter.cxx +++ b/common/clitkDicomRTStruct2ImageFilter.cxx @@ -25,6 +25,7 @@ #include "clitkImageCommon.h" // vtk +#include #include #include #include @@ -170,13 +171,10 @@ void clitk::DicomRTStruct2ImageFilter::Update() } // Get Mesh - vtkPolyData * mesh = mROI->GetMesh(); + vtkPolyData * mesh = mROI->GetMesh(); // Get bounds double *bounds=mesh->GetBounds(); - // for(int i=0; i<6; i++){ -// DD(bounds[i]); -// } // Compute origin std::vector origin; @@ -202,25 +200,30 @@ void clitk::DicomRTStruct2ImageFilter::Update() // Create new output image mBinaryImage = vtkSmartPointer::New(); +#if VTK_MAJOR_VERSION <= 5 mBinaryImage->SetScalarTypeToUnsignedChar(); +#endif mBinaryImage->SetOrigin(&origin[0]); mBinaryImage->SetSpacing(&mSpacing[0]); mBinaryImage->SetExtent(0, extend[0], 0, extend[1], 0, extend[2]); +#if VTK_MAJOR_VERSION <= 5 mBinaryImage->AllocateScalars(); +#else + mBinaryImage->AllocateScalars(VTK_UNSIGNED_CHAR, 1); +#endif - // for(int i=0; i<3; i++){ - // DD(origin[i]); - // DD(extend[i]); - // DD(mBinaryImage->GetDimensions()[i]); - // } memset(mBinaryImage->GetScalarPointer(), 0, mBinaryImage->GetDimensions()[0]*mBinaryImage->GetDimensions()[1]*mBinaryImage->GetDimensions()[2]*sizeof(unsigned char)); // Extrude vtkSmartPointer extrude=vtkSmartPointer::New(); +#if VTK_MAJOR_VERSION <= 5 extrude->SetInput(mesh); +#else + extrude->SetInputData(mesh); +#endif ///We extrude in the -slice_spacing direction to respect the FOCAL convention (NEEDED !) extrude->SetVector(0, 0, -mSpacing[2]); @@ -230,12 +233,24 @@ void clitk::DicomRTStruct2ImageFilter::Update() //http://www.nabble.com/Bug-in-vtkPolyDataToImageStencil--td23368312.html#a23370933 sts->SetTolerance(0); sts->SetInformationInput(mBinaryImage); +#if VTK_MAJOR_VERSION <= 5 sts->SetInput(extrude->GetOutput()); +#else + sts->SetInputConnection(extrude->GetOutputPort(0)); +#endif //sts->SetInput(mesh); vtkSmartPointer stencil=vtkSmartPointer::New(); +#if VTK_MAJOR_VERSION <= 5 stencil->SetStencil(sts->GetOutput()); +#else + stencil->SetStencilConnection(sts->GetOutputPort(0)); +#endif +#if VTK_MAJOR_VERSION <= 5 stencil->SetInput(mBinaryImage); +#else + stencil->SetInputData(mBinaryImage); +#endif stencil->ReverseStencilOn(); stencil->Update();