|
19 | 19 | #include <iostream> |
20 | 20 |
|
21 | 21 | #include "itkAffineTransform.h" |
| 22 | +#include "itkCastImageFilter.h" |
| 23 | +#include "itkPipelineMonitorImageFilter.h" |
22 | 24 | #include "itkResampleImageFilter.h" |
23 | 25 | #include "itkStreamingImageFilter.h" |
24 | 26 | #include "itkTestingMacros.h" |
@@ -79,8 +81,13 @@ itkResampleImageTest7(int, char *[]) |
79 | 81 | ITK_EXERCISE_BASIC_OBJECT_METHODS(resample, ResampleImageFilter, ImageToImageFilter); |
80 | 82 | resample->SetInterpolator(interp); |
81 | 83 |
|
82 | | - resample->SetInput(image); |
83 | | - ITK_TEST_SET_GET_VALUE(image.GetPointer(), resample->GetInput()); |
| 84 | + const auto upstream = itk::CastImageFilter<ImageType, ImageType>::New(); |
| 85 | + upstream->SetInput(image); |
| 86 | + using MonitorType = itk::PipelineMonitorImageFilter<ImageType>; |
| 87 | + const auto monitor = MonitorType::New(); |
| 88 | + monitor->SetInput(upstream->GetOutput()); |
| 89 | + resample->SetInput(monitor->GetOutput()); |
| 90 | + ITK_TEST_SET_GET_VALUE(monitor->GetOutput(), resample->GetInput()); |
84 | 91 |
|
85 | 92 | resample->SetSize(size); |
86 | 93 | ITK_TEST_SET_GET_VALUE(size, resample->GetSize()); |
@@ -109,12 +116,20 @@ itkResampleImageTest7(int, char *[]) |
109 | 116 | const ImagePointerType outputNoSDI = streamer->GetOutput(); // save output for later comparison |
110 | 117 | outputNoSDI->DisconnectPipeline(); // disconnect to create new output |
111 | 118 |
|
112 | | - // Run the resampling filter with streaming |
| 119 | + monitor->ClearPipelineSavedInformation(); |
| 120 | + |
113 | 121 | image->Modified(); |
114 | | - numStreamDiv = 8; // split into numStream pieces for streaming. |
| 122 | + numStreamDiv = 8; |
115 | 123 | streamer->SetNumberOfStreamDivisions(numStreamDiv); |
116 | 124 | ITK_TRY_EXPECT_NO_EXCEPTION(streamer->UpdateLargestPossibleRegion()); |
117 | 125 |
|
| 126 | + if (!monitor->VerifyInputFilterExecutedStreaming(static_cast<int>(numStreamDiv))) |
| 127 | + { |
| 128 | + std::cerr << "Streaming did not chunk the input as expected." << std::endl; |
| 129 | + std::cerr << monitor; |
| 130 | + return EXIT_FAILURE; |
| 131 | + } |
| 132 | + |
118 | 133 | // Verify that we only requested a smaller chunk when streaming |
119 | 134 | const ImageRegionType finalRequestedRegion(image->GetRequestedRegion()); |
120 | 135 | ITK_TEST_SET_GET_VALUE(0, finalRequestedRegion.GetIndex(0)); |
|
0 commit comments