Skip to content

Commit e8817df

Browse files
COMP: Skip non-comparable Python baseline test for ConvolveImageWithKernel
The Python example emits the raw convolved image (512x342, grayscale), while the shared C++ baseline is a QuickView render-window screenshot (602x302, RGB). The auto-generated ConvolveImageWithKernelTestBaseline- ComparisonPython test compared these and failed on the size mismatch. Add a NO_PYTHON_COMPARISON option to compare_to_baseline() and use it for ConvolveImageWithKernel so only the run-only Python test remains. Co-Authored-By: Pranjal Sahu <23420081+PranjalSahu@users.noreply.github.com>
1 parent 242b5d1 commit e8817df

2 files changed

Lines changed: 9 additions & 1 deletion

File tree

CMake/ITKSphinxExamplesMacros.cmake

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,10 @@ endmacro()
100100
#
101101
# [OPTIONS myListOfOptions] // Options to pass to ImageCompareCommand.
102102
#
103+
# [NO_PYTHON_COMPARISON] // Skip the auto-added Python baseline comparison
104+
# // when the Python output is not pixel-comparable
105+
# // to the C++ baseline (e.g. a Matplotlib figure).
106+
#
103107
# [DEPENDS myListOfDependencies] // Other tests that the comparison test will
104108
# // depend on. By default, the dependency is assumed
105109
# // to be ${EXAMPLE_NAME}Test. For Python, the comparison
@@ -110,6 +114,7 @@ endmacro()
110114
function(compare_to_baseline)
111115
set(options
112116
PYTHON_ONLY
117+
NO_PYTHON_COMPARISON
113118
)
114119

115120
set(oneValueArgs
@@ -174,7 +179,7 @@ function(compare_to_baseline)
174179
)
175180
endif()
176181

177-
if(ITK_WRAP_PYTHON AND EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/${LOCAL_COMPARISON_EXAMPLE_NAME}/Code.py")
182+
if(ITK_WRAP_PYTHON AND NOT LOCAL_COMPARISON_NO_PYTHON_COMPARISON AND EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/${LOCAL_COMPARISON_EXAMPLE_NAME}/Code.py")
178183
set(python_test_name ${test_name}Python)
179184
get_filename_component(test_image_we "${test_image}" NAME_WE)
180185
get_filename_component(test_image_dir "${test_image}" DIRECTORY)

src/Filtering/Convolution/CMakeLists.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,9 @@ compare_to_baseline(EXAMPLE_NAME NormalizedCorrelationUsingFFTWithMaskImages
1616
add_example(ConvolveImageWithKernel)
1717
compare_to_baseline(EXAMPLE_NAME ConvolveImageWithKernel
1818
BASELINE_PREFIX ConvolveImageWithKernel
19+
# The Python example emits a raw convolved image, not the C++ QuickView
20+
# screenshot, so the two are not pixel-comparable.
21+
NO_PYTHON_COMPARISON
1922
)
2023

2124
# TODO: Fix building of ColorNormalizedCorrelation example

0 commit comments

Comments
 (0)