COMP: Harden streaming-equivalence tests with upstream CastImageFilter#6195
COMP: Harden streaming-equivalence tests with upstream CastImageFilter#6195hjmjohnson wants to merge 1 commit intoInsightSoftwareConsortium:mainfrom
Conversation
This comment was marked as resolved.
This comment was marked as resolved.
|
I would add the PipelineMonitorImageFilter to genially check that the filter was streaming as expected. Again we have longer commit message that the amount of code changed. |
46e5d71 to
5534e19
Compare
|
@blowekamp If you are satisfied with this version and approve, I'll monitor and merge as soon as the dashboards are green. Good catch — your first suggestion (PipelineMonitorImageFilter) was the more important one, and I missed it on the first pass. Now addressed in 5534e19. Each test now reads: After the streamed Update with N divisions, the test asserts
Locally: 3/3 tests still pass. Title and commit message also tightened on the same push. |
e1b8d52 to
9fe055d
Compare
Insert PipelineMonitorImageFilter on each test's streamable input path (image for Resample, displacement field for Warp/WarpVector) and assert VerifyInputFilterExecutedStreaming(N) after the streamed Update.
9fe055d to
b436bb0
Compare
|
/azp run ITK.macOS.Python |
Hardens three streaming-equivalence tests in
Modules/Filtering/ImageGrid/test/that were silently weak: their input was an in-memoryImagewhoseBufferedRegionalways equalsLargestPossibleRegion, so the filter under test never saw a chunked input under streaming. Inserts aCastImageFilterbetween the image and the filter so streaming actually exercises chunked input.All four affected tests continue to pass — this is pure test hardening, no library changes.
Why the tests were weak
Each test ran the same pipeline twice (e.g., 1 vs 8 stream divisions) and compared outputs pixel-by-pixel. The intent was to verify that the filter under test produces identical output regardless of streaming.
But because the input was a hand-allocated
Image::New(), itsBufferedRegionis fixed at allocation and never shrinks under streaming. The downstreamStreamingImageFilterchunks the output, ITK's pipeline propagatesRequestedRegionupstream, but a rawImageignoresRequestedRegionpropagation — its buffered data is fixed. So the filter under test always saw the full input regardless of stream-division count, and any bug specific to chunked-input handling slipped through.Inserting a
CastImageFilter(a streaming-aware no-op) propagates the chunkedRequestedRegionand produces a per-chunkBufferedRegiondownstream, putting the filter under test in a real streaming pipeline.The warper tests already had this pattern on the displacement-field input (
vcaster); this PR adds the same pattern on the image input.itkResampleImageTest7had no upstream cast at all and gets one added.How this was discovered
While diagnosing PR #1012 (a 7-year-old draft regression test for issue #1011 / fix #1202, dealing with
GaussianInterpolateImageFunction+ streaming), the same in-memory-Image topology turned out to silently mask the bug. After insertingCastImageFilterupstream, locally reverting #1202's fix produced 28 672 / 32 768 NaN-or-divergent pixels — strong regression guard. Without the cast, 0 / 32 768 pixel diffs even with the bug reverted.That triggered an audit of other streaming-equivalence tests in the codebase. The three tests in this PR are the ones that match the same blind spot.
Files changed
itkResampleImageTest7.cxx#include "itkCastImageFilter.h"; routeimage → resampleviaCastImageFilter<ImageType,ImageType>; updateITK_TEST_SET_GET_VALUEaccordinglyitkWarpImageFilterTest.cxxCastImageFilter<ImageType,ImageType>namedicasternext to the existingvcaster; wireicaster->GetOutput()intowarper2->SetInputitkWarpVectorImageFilterTest.cxx