From c2c2f3b2f175836c776edfa62bb9c68aa51c4fa8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?D=C5=BEenan=20Zuki=C4=87?= Date: Thu, 13 Jul 2023 12:38:01 -0400 Subject: [PATCH] ENH: Update test to use metadata in the image --- .../ScanConvertSliceSeriesTestOutput.mha.sha512 | 1 + ...esSpecialCoordinatesImageTestPython.mha.sha512 | 1 - wrapping/test/CMakeLists.txt | 2 +- wrapping/test/PythonSliceSeriesResample.py | 15 ++++----------- 4 files changed, 6 insertions(+), 13 deletions(-) create mode 100644 test/Baseline/ScanConvertSliceSeriesTestOutput.mha.sha512 delete mode 100644 test/Baseline/itkSliceSeriesSpecialCoordinatesImageTestPython.mha.sha512 diff --git a/test/Baseline/ScanConvertSliceSeriesTestOutput.mha.sha512 b/test/Baseline/ScanConvertSliceSeriesTestOutput.mha.sha512 new file mode 100644 index 0000000..eeebb5e --- /dev/null +++ b/test/Baseline/ScanConvertSliceSeriesTestOutput.mha.sha512 @@ -0,0 +1 @@ +517f382d498571f325ac804602aa373fd6db0786d25cd9e38c6097dd8251ea17f735b28670036bfab26cdddc94312486ef48899d089c8f4314baa41a6645b1ff diff --git a/test/Baseline/itkSliceSeriesSpecialCoordinatesImageTestPython.mha.sha512 b/test/Baseline/itkSliceSeriesSpecialCoordinatesImageTestPython.mha.sha512 deleted file mode 100644 index 5f4a68d..0000000 --- a/test/Baseline/itkSliceSeriesSpecialCoordinatesImageTestPython.mha.sha512 +++ /dev/null @@ -1 +0,0 @@ -ee322ad1e126dfd8660ad8d550f5203e48b83a88cd4767b52ff4224259dd6b13b63984382dd2971a2a8c95381d491a2cfb519918075efed76e7e09955de0fc7e diff --git a/wrapping/test/CMakeLists.txt b/wrapping/test/CMakeLists.txt index 62a27e2..07e853a 100644 --- a/wrapping/test/CMakeLists.txt +++ b/wrapping/test/CMakeLists.txt @@ -66,7 +66,7 @@ itk_python_add_test(NAME PythonSliceSeriesResampleTest TEST_DRIVER_ARGS --compareIntensityTolerance 1 --compare - DATA{${test_baseline_dir}/itkSliceSeriesSpecialCoordinatesImageTestPython.mha} + DATA{${test_baseline_dir}/ScanConvertSliceSeriesTestOutput.mha} ${ITK_TEST_OUTPUT_DIR}/itkSliceSeriesSpecialCoordinatesImageTestPython.mha COMMAND PythonSliceSeriesResample.py -i DATA{${test_input_dir}/bmode_p59.hdf5} diff --git a/wrapping/test/PythonSliceSeriesResample.py b/wrapping/test/PythonSliceSeriesResample.py index ef78c76..2ab23de 100644 --- a/wrapping/test/PythonSliceSeriesResample.py +++ b/wrapping/test/PythonSliceSeriesResample.py @@ -35,23 +35,16 @@ image_type = itk.SliceSeriesSpecialCoordinatesImage[slice_type, transform_type] # read the image -reader = itk.ImageFileReader[image_type].New() -reader.SetImageIO(itk.HDF5UltrasoundImageIO.New()) +reader = itk.UltrasoundImageFileReader[image_type].New() reader.SetFileName(args.input_image) reader.Update() image = reader.GetOutput() - -# add transforms with monotonic translation image.DisconnectPipeline() -for k in range(image.GetBufferedRegion().GetSize()[2]): - transform = transform_type.New() - transform.Translate([0, 0, k]) - image.SetSliceTransform(k, transform) print("Verify resampling works with SliceSeriesSpecialCoordinatesImage input") -output_size = [128, 150, 100] -output_spacing = [2.0] * dimension -output_origin = [0.0] * dimension +output_size = [46, 55, 82] +output_spacing = [1.0] * dimension +output_origin = [0.0, -27.2693, -40.6222] result = itk.resample_image_filter(image, size=output_size, output_spacing=output_spacing, output_origin=output_origin) itk.imwrite(result, args.output_image) print(f"Image written to {args.output_image}")