From dca456c52728e92190a48a2823c4bb9d7738c8d5 Mon Sep 17 00:00:00 2001 From: tbaudier Date: Fri, 17 Jun 2016 15:45:40 +0200 Subject: [PATCH] Ensure compatibility with VTK6 for Image2DicomRTStruct tool --- common/clitkImage2DicomRTStructFilter.txx | 10 ++++++++++ itk/clitkBinaryImageToMeshFilter.txx | 16 ++++++++++++++++ 2 files changed, 26 insertions(+) diff --git a/common/clitkImage2DicomRTStructFilter.txx b/common/clitkImage2DicomRTStructFilter.txx index 77c5e07..9ebde04 100644 --- a/common/clitkImage2DicomRTStructFilter.txx +++ b/common/clitkImage2DicomRTStructFilter.txx @@ -52,6 +52,8 @@ #include // gdcm +#include +#include #include //-------------------------------------------------------------------- @@ -178,7 +180,11 @@ void clitk::Image2DicomRTStructFilter::Update() // Copy previous contours for (unsigned int i = 0; i < numMasks-m; ++i) { +#if VTK_MAJOR_VERSION <= 5 writer->SetInput(i, reader->GetOutput(i)); +#else + writer->SetInputData(i, reader->GetOutput(i)); +#endif std::string theString = reader->GetRTStructSetProperties()->GetStructureSetROIName(i); roiNames->InsertValue(i, theString); theString = reader->GetRTStructSetProperties()->GetStructureSetROIGenerationAlgorithm(i); @@ -189,7 +195,11 @@ void clitk::Image2DicomRTStructFilter::Update() // Add new ones for (unsigned int i = numMasks-m; i < numMasks; ++i) { +#if VTK_MAJOR_VERSION <= 5 writer->SetInput(i, meshes[i-numMasks+m]); +#else + writer->SetInputData(i, meshes[i-numMasks+m]); +#endif roiNames->InsertValue(i, m_ROINames[i-numMasks+m]); roiAlgorithms->InsertValue(i, "CLITK_CREATED"); roiTypes->InsertValue(i, m_ROIType); diff --git a/itk/clitkBinaryImageToMeshFilter.txx b/itk/clitkBinaryImageToMeshFilter.txx index 8a14edc..b242dcf 100644 --- a/itk/clitkBinaryImageToMeshFilter.txx +++ b/itk/clitkBinaryImageToMeshFilter.txx @@ -43,7 +43,11 @@ Update() // Get extend vtkSmartPointer clipper = vtkSmartPointer::New(); +#if VTK_MAJOR_VERSION <= 5 clipper->SetInput(input_vtk); +#else + clipper->SetInputData(input_vtk); +#endif int* extent = input_vtk->GetExtent(); // Loop on slices @@ -52,7 +56,11 @@ Update() // std::vector > contours; for(uint i=0; i squares = vtkSmartPointer::New(); +#if VTK_MAJOR_VERSION <= 5 squares->SetInput(input_vtk); +#else + squares->SetInputData(input_vtk); +#endif squares->SetImageRange(extent[0], extent[1], extent[2], extent[3], i, i); squares->SetNumberOfContours(1); squares->SetValue(0, m_ThresholdValue); @@ -61,7 +69,11 @@ Update() // Strip (needed) vtkSmartPointer vs = vtkSmartPointer::New(); +#if VTK_MAJOR_VERSION <= 5 vs->SetInput(squares->GetOutput()); +#else + vs->SetInputData(squares->GetOutput()); +#endif vs->Update(); m = vs->GetOutput(); @@ -76,7 +88,11 @@ Update() // only add if lines>0 if (m->GetNumberOfLines() > 0) { +#if VTK_MAJOR_VERSION <= 5 append->AddInput(m);//contours[i]); +#else + append->AddInputData(m);//contours[i]); +#endif } } append->Update(); -- 2.47.1