From 2def6646809f4f5969e4c81747abeacbb545d1ba Mon Sep 17 00:00:00 2001 From: Nicole Aucoin Date: Wed, 6 Aug 2014 16:21:09 -0400 Subject: [PATCH] BUG: fix python tests for VTK6 Same fix as compiling for VTK6, SetImage -> SetImageData Fixes: py_ReportingSelfTest py_LabelToDICOMSEGConverterSelfTest --- Testing/Python/ReportingSelfTest.py | 5 ++++- .../Testing/Python/LabelToDICOMSEGConverterSelfTest.py | 10 ++++++++-- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/Testing/Python/ReportingSelfTest.py b/Testing/Python/ReportingSelfTest.py index 67ff633..ac78d87 100644 --- a/Testing/Python/ReportingSelfTest.py +++ b/Testing/Python/ReportingSelfTest.py @@ -386,7 +386,10 @@ def test_ReportingAIMRoundTrip(self): labelDisplayNode.SetAndObserveColorNodeID('vtkMRMLColorTableNodeFileGenericAnatomyColors.txt') image = volume.GetImageData() thresh = vtk.vtkImageThreshold() - thresh.SetInput(image) + if vtk.vtkVersion().GetVTKMajorVersion() < 6: + thresh.SetInput(image) + else: + thresh.SetInputData(image) thresh.ThresholdBetween(10,400) thresh.SetInValue(report.GetFindingLabel()) thresh.SetOutValue(0) diff --git a/Util/LabelToDICOMSEGConverter/Testing/Python/LabelToDICOMSEGConverterSelfTest.py b/Util/LabelToDICOMSEGConverter/Testing/Python/LabelToDICOMSEGConverterSelfTest.py index 27ce82d..9065a4b 100644 --- a/Util/LabelToDICOMSEGConverter/Testing/Python/LabelToDICOMSEGConverterSelfTest.py +++ b/Util/LabelToDICOMSEGConverter/Testing/Python/LabelToDICOMSEGConverterSelfTest.py @@ -336,7 +336,10 @@ def test_LabelToDICOMSEGConverterRoundTrip(self): labelDisplayNode.SetAndObserveColorNodeID('vtkMRMLColorTableNodeFileGenericAnatomyColors.txt') image = volume.GetImageData() thresh = vtk.vtkImageThreshold() - thresh.SetInput(image) + if vtk.vtkVersion().GetVTKMajorVersion() < 6: + thresh.SetInput(image) + else: + thresh.SetInputData(image) thresh.ThresholdBetween(10,400) thresh.SetInValue(10) thresh.SetOutValue(0) @@ -384,7 +387,10 @@ def test_LabelToDICOMSEGConverterRoundTrip(self): image = volume.GetImageData() previousImage = thresh.GetOutput() diff = vtk.vtkImageDifference() - diff.SetInput(thresh.GetOutput()) + if vtk.vtkVersion().GetVTKMajorVersion() < 6: + diff.SetInput(thresh.GetOutput()) + else: + diff.SetInputData(thresh.GetOutput()) diff.SetImage(image) diff.Update() if diff.GetThresholdedError() > 1: