4 #include <itkTimeProbe.h> 5 #include <tclap/CmdLine.h> 7 int main(
int ac,
const char** av)
9 TCLAP::CmdLine cmd(
"INRIA / IRISA - VisAGeS/Empenn Team",
' ',ANIMA_VERSION);
11 TCLAP::ValueArg<std::string> inputArg(
"i",
"ref-image",
"image",
true,
"",
"image",cmd);
12 TCLAP::ValueArg<std::string> outArg(
"o",
"out-image",
"Output (registered) image",
true,
"",
"output image",cmd);
14 TCLAP::ValueArg<std::string> outputRealignTransformArg(
"",
"out-realign-trsf",
"Output transformation to realign on symmetry plane",
false,
"",
"output realign transform",cmd);
15 TCLAP::ValueArg<std::string> outputTransformArg(
"O",
"out-trsf",
"Output transformation",
false,
"",
"output transform",cmd);
17 TCLAP::ValueArg<unsigned int> metricArg(
"",
"metric",
"Similarity metric (0: mutual information, 1: mean squares, default: 1)",
false,1,
"similarity metric",cmd);
19 TCLAP::ValueArg<unsigned int> optimizerMaxIterationsArg(
"",
"oi",
"Maximum iterations for local optimizer (default: 100)",
false,100,
"maximum local optimizer iterations",cmd);
20 TCLAP::ValueArg<unsigned int> histoSizeArg(
"",
"hs",
"Histogram size for mutual information (default: 128)",
false,128,
"histogram size",cmd);
22 TCLAP::ValueArg<double> translateUpperBoundArg(
"",
"tub",
"Upper bound on translation for bobyqa (in voxels, default: 6)",
false,6,
"Bobyqa translate upper bound",cmd);
23 TCLAP::ValueArg<double> angleUpperBoundArg(
"",
"aub",
"Upper bound on angles for bobyqa (in degrees, default: 180)",
false,180,
"Bobyqa angle upper bound",cmd);
25 TCLAP::ValueArg<unsigned int> numPyramidLevelsArg(
"p",
"pyr",
"Number of pyramid levels (default: 3)",
false,3,
"number of pyramid levels",cmd);
26 TCLAP::ValueArg<unsigned int> numThreadsArg(
"T",
"threads",
"Number of execution threads (default: 0 = all cores)",
false,0,
"number of threads",cmd);
32 catch (TCLAP::ArgException& e)
34 std::cerr <<
"Error: " << e.error() <<
"for argument " << e.argId() << std::endl;
39 typedef itk::Image <double,3> InputImageType;
41 PyramidSymType::Pointer matcher = PyramidSymType::New();
43 matcher->SetReferenceImage(anima::readImage <InputImageType> (inputArg.getValue()));
44 matcher->SetFloatingImage(anima::readImage <InputImageType> (inputArg.getValue()));
47 matcher->SetMetric((
Metric)metricArg.getValue());
48 matcher->SetOptimizerMaxIterations(optimizerMaxIterationsArg.getValue());
49 matcher->SetHistogramSize(histoSizeArg.getValue());
50 matcher->SetUpperBoundDistance(translateUpperBoundArg.getValue());
51 matcher->SetUpperBoundAngle(angleUpperBoundArg.getValue() * M_PI / 180.0);
52 matcher->SetNumberOfPyramidLevels(numPyramidLevelsArg.getValue());
54 if (numThreadsArg.getValue() != 0)
55 matcher->SetNumberOfWorkUnits(numThreadsArg.getValue());
57 matcher->SetResultFile(outArg.getValue());
58 matcher->SetOutputRealignTransformFile(outputRealignTransformArg.getValue());
59 matcher->SetOutputTransformFile(outputTransformArg.getValue());
66 matcher->WriteOutputs();
70 std::cout <<
"Elapsed Time: " << timer.GetTotal() << timer.GetUnit() << std::endl;
int main(int ac, const char **av)