X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=common%2FclitkDicomRTStruct2ImageFilter.cxx;h=96fdea75ed2415c7b2d699e6ce7dfd620f1cdd80;hb=5ee60b899362a5e87914ae9a46a7c8ea4116219b;hp=ad90bef4d56220dfff44e3f7dda190c75a0f9e87;hpb=2b5b3e906ee95519169e9b6d4bb2da9d2e00d8b3;p=clitk.git diff --git a/common/clitkDicomRTStruct2ImageFilter.cxx b/common/clitkDicomRTStruct2ImageFilter.cxx index ad90bef..96fdea7 100644 --- a/common/clitkDicomRTStruct2ImageFilter.cxx +++ b/common/clitkDicomRTStruct2ImageFilter.cxx @@ -25,6 +25,7 @@ #include "clitkImageCommon.h" // vtk +#include #include #include #include @@ -199,22 +200,34 @@ 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 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); ///We extrude in the -slice_spacing direction to respect the FOCAL convention (NEEDED !) - extrude->SetVector(0, 0, -mSpacing[2]); + extrude->SetVector(0, 0, -0.5*mSpacing[2]); +#else + extrude->SetInputData(mesh); + ///We extrude in the -slice_spacing direction to respect the FOCAL convention (NEEDED !) + extrude->SetVector(0, 0, 0.5*mSpacing[2]); +#endif // Binarization vtkSmartPointer sts=vtkSmartPointer::New(); @@ -222,12 +235,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();