int
main(int argc, char * argv[])
{
if (argc != 6)
{
std::cerr << "Usage: " << argv[0];
std::cerr << " <SourceLandmarks>";
std::cerr << " <TargetLandmarks>";
std::cerr << " <InputImage>";
std::cerr << " <DeformedImage>";
std::cerr << " <CheckerBoardImage>";
std::cerr << std::endl;
return EXIT_FAILURE;
}
const char * sourceLandmarksFile = argv[1];
const char * targetLandmarksFile = argv[2];
const char * inputImageFile = argv[3];
const char * deformedImageFile = argv[4];
const char * checkerboardImageFile = argv[5];
using CoordinateRepType = double;
using PointSetType = TransformType::PointSetType;
using PixelType = unsigned char;
try
{
auto sourceLandmarksMesh = itk::ReadMesh<MeshType>(sourceLandmarksFile);
sourceLandmarks->SetPoints(sourceLandmarksMesh->GetPoints());
auto targetLandmarksMesh = itk::ReadMesh<MeshType>(targetLandmarksFile);
targetLandmarks->SetPoints(targetLandmarksMesh->GetPoints());
inputImage = itk::ReadImage<ImageType>(inputImageFile);
}
{
std::cerr << "Error: " << error << std::endl;
return EXIT_FAILURE;
}
thinPlateSpline->SetSourceLandmarks(sourceLandmarks);
thinPlateSpline->SetTargetLandmarks(targetLandmarks);
thinPlateSpline->ComputeWMatrix();
resampler->SetInput(inputImage);
resampler->SetInterpolator(interpolator);
resampler->SetUseReferenceImage(true);
resampler->SetReferenceImage(inputImage);
resampler->SetTransform(thinPlateSpline);
checkerboardFilter->SetInput1(inputImage);
checkerboardFilter->SetInput2(resampler->GetOutput());
try
{
resampler->Update();
checkerboardFilter->Update();
}
{
std::cerr << "Error: " << error << std::endl;
return EXIT_FAILURE;
}
return EXIT_SUCCESS;
}