X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=common%2FclitkDicomRTStruct2ImageFilter.cxx;h=fcc9e2be26da9c02cfdcb1a94f10e5ff67874745;hb=01ea93b48bce2e9e9a27c487e1b097a4d9f37547;hp=e52fc0f17be8a3e16acee8517409b5b224205615;hpb=6986b996d66273ab7818c12f51cbf5ae049ac04e;p=clitk.git diff --git a/common/clitkDicomRTStruct2ImageFilter.cxx b/common/clitkDicomRTStruct2ImageFilter.cxx index e52fc0f..fcc9e2b 100644 --- a/common/clitkDicomRTStruct2ImageFilter.cxx +++ b/common/clitkDicomRTStruct2ImageFilter.cxx @@ -25,6 +25,7 @@ #include "clitkImageCommon.h" // vtk +#include #include #include #include @@ -160,7 +161,6 @@ void clitk::DicomRTStruct2ImageFilter::SetOutputSize(const unsigned long* size) //-------------------------------------------------------------------- void clitk::DicomRTStruct2ImageFilter::Update() { - DD("DicomRTStruct2ImageFilter::Update"); if (!mROI) { std::cerr << "Error. No ROI set, please use SetROI." << std::endl; exit(0); @@ -175,9 +175,6 @@ void clitk::DicomRTStruct2ImageFilter::Update() // Get bounds double *bounds=mesh->GetBounds(); - // for(int i=0; i<6; i++){ -// DD(bounds[i]); -// } // Compute origin std::vector origin; @@ -203,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]); @@ -231,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();