#ifdef ENABLE_QUICKVIEW
#endif
#include <iostream>
#include <string>
int
main(int argc, char * argv[])
{
if (argc < 2)
{
std::cerr << "Required: filename" << std::endl;
return EXIT_FAILURE;
}
const auto input = itk::ReadImage<FloatImageType>(argv[1]);
extractFilter->SetRegionOfInterest(desiredRegion);
extractFilter->SetInput(input);
extractFilter->Update();
radius[0] = (radius[0] - 1) / 2;
radius[1] = (radius[1] - 1) / 2;
correlationFilter->SetInput(input);
correlationFilter->SetTemplate(kernelOperator);
correlationFilter->Update();
minimumMaximumImageCalculatorFilter->SetImage(correlationFilter->GetOutput());
minimumMaximumImageCalculatorFilter->Compute();
itk::Index<2> maximumCorrelationPatchCenter = minimumMaximumImageCalculatorFilter->GetIndexOfMaximum();
std::cout << "Maximum: " << maximumCorrelationPatchCenter << std::endl;
{
rescaleFilter->SetInput(correlationFilter->GetOutput());
rescaleFilter->SetOutputMinimum(0);
rescaleFilter->SetOutputMaximum(255);
rescaleFilter->Update();
}
{
rescaleFilter->SetInput(extractFilter->GetOutput());
rescaleFilter->SetOutputMinimum(0);
rescaleFilter->SetOutputMaximum(255);
rescaleFilter->Update();
}
bestPatchStart[0] = maximumCorrelationPatchCenter[0] - radius[0];
bestPatchStart[1] = maximumCorrelationPatchCenter[1] - radius[1];
bestPatchExtractFilter->SetRegionOfInterest(bestPatchRegion);
bestPatchExtractFilter->SetInput(input);
bestPatchExtractFilter->Update();
#ifdef ENABLE_QUICKVIEW
viewer.
AddImage(extractFilter->GetOutput());
viewer.
AddImage(correlationFilter->GetOutput());
viewer.
AddImage(bestPatchExtractFilter->GetOutput());
#endif
return EXIT_SUCCESS;
}