int
main(int argc, char * argv[])
{
if (argc < 3)
{
std::cerr << "Usage: " << std::endl;
std::cerr << argv[0] << " fixedImage movingImage" << std::endl;
return EXIT_FAILURE;
}
using PixelType = float;
fixedReader->SetFileName(argv[1]);
movingReader->SetFileName(argv[2]);
try
{
fixedReader->Update();
movingReader->Update();
}
{
std::cerr << "Exception caught !" << std::endl;
std::cerr << excep << std::endl;
}
using MetricType =
using InterpolatorType =
transform->SetIdentity();
metric->SetTransform(transform);
metric->SetMovingInterpolator(interpolator);
metric->SetFixedImage(fixedImage);
metric->SetMovingImage(movingImage);
metric->SetVirtualDomainFromImage(fixedImage);
try
{
metric->Initialize();
}
{
std::cerr << "Exception caught !" << std::endl;
std::cerr << excep << std::endl;
return EXIT_FAILURE;
}
MetricType::MovingTransformParametersType displacement(
Dimension);
constexpr int rangex = 50;
constexpr int rangey = 50;
for (int dx = -rangex; dx <= rangex; ++dx)
{
for (int dy = -rangey; dy <= rangey; ++dy)
{
displacement[0] = dx;
displacement[1] = dy;
metric->SetParameters(displacement);
const double value = metric->GetValue();
std::cout << dx << " " << dy << " " << value << std::endl;
}
}
return EXIT_SUCCESS;
}