Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,10 @@
*/
template <typename TImage, typename TInterpolator>
int
TestMattesMetricWithAffineTransform(TInterpolator * const interpolator, const bool useSampling, const size_t imageSize)
TestMattesMetricWithAffineTransform(TInterpolator * const interpolator,
const bool useSampling,
const size_t imageSize,
const bool initializeFixedImage = true)
{

//------------------------------------------------------------
Expand Down Expand Up @@ -84,7 +87,7 @@ TestMattesMetricWithAffineTransform(TInterpolator * const interpolator, const bo

auto imgFixed = FixedImageType::New();
imgFixed->SetRegions(region);
imgFixed->Allocate();
imgFixed->Allocate(true);
imgFixed->SetSpacing(imgSpacing);
imgFixed->SetOrigin(imgOrigin);

Expand Down Expand Up @@ -120,6 +123,7 @@ TestMattesMetricWithAffineTransform(TInterpolator * const interpolator, const bo
++ri;
}
}
if (initializeFixedImage)
{
TargetIteratorType ti(imgFixed, region);
ti.GoToBegin();
Expand Down Expand Up @@ -462,6 +466,14 @@ itkMattesMutualInformationImageToImageMetricv4Test(int, char *[])
std::cout << "Test failed when using all the pixels instead of sampling" << std::endl;
return EXIT_FAILURE;
}
bool initializeFixedImage = false;
failed = TestMattesMetricWithAffineTransform<ImageType, LinearInterpolatorType>(
linearInterpolator, useSampling, imageSize, initializeFixedImage);
if (failed)
{
std::cout << "Test failed when all fixed image pixels have the same value" << std::endl;
return EXIT_FAILURE;
}
useSampling = true;
failed =
TestMattesMetricWithAffineTransform<ImageType, LinearInterpolatorType>(linearInterpolator, useSampling, imageSize);
Expand Down
Loading