#include <itkVTKImageToImageFilter.h>
 
 // gdcm
+#include <vtkRTStructSetProperties.h>
+#include <vtkGDCMPolyDataReader.h>
 #include <vtkGDCMPolyDataWriter.h>
 
 //--------------------------------------------------------------------
     
   // 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);
 
   // 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);
 
   
   // Get extend
   vtkSmartPointer<vtkImageClip> clipper = vtkSmartPointer<vtkImageClip>::New();
+#if VTK_MAJOR_VERSION <= 5
   clipper->SetInput(input_vtk);
+#else
+  clipper->SetInputData(input_vtk);
+#endif
   int* extent = input_vtk->GetExtent();
 
   // Loop on slices
   // std::vector<vtkSmartPointer<vtkPolyData> > contours;
   for(uint i=0; i<n; i++) {
     vtkSmartPointer<vtkMarchingSquares> squares = vtkSmartPointer<vtkMarchingSquares>::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);
 
     // Strip (needed)
     vtkSmartPointer<vtkStripper> vs = vtkSmartPointer<vtkStripper>::New();
+#if VTK_MAJOR_VERSION <= 5
     vs->SetInput(squares->GetOutput());
+#else
+    vs->SetInputData(squares->GetOutput());
+#endif
     vs->Update();
     m = vs->GetOutput();
 
 
     // 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();