ANIMA  4.0
animaLogTensors.cxx
Go to the documentation of this file.
3 
4 #include <tclap/CmdLine.h>
5 
6 int main(int argc, char **argv)
7 {
8  TCLAP::CmdLine cmd("INRIA / IRISA - VisAGeS/Empenn Team", ' ',ANIMA_VERSION);
9 
10  TCLAP::ValueArg<std::string> inArg("i","inputlist","Tensors image",true,"","input tensor image",cmd);
11  TCLAP::ValueArg<std::string> resArg("o","outputfile","Result log-tensor image",true,"","result log-tensor image",cmd);
12 
13  TCLAP::ValueArg<unsigned int> nbpArg("T","nb-threads","Number of threads (default: all cores)",false,itk::MultiThreaderBase::GetGlobalDefaultNumberOfThreads(),"Number of threads",cmd);
14  TCLAP::SwitchArg scaleArg("S","scale","Scale the output log-tensors non diagonal terms",cmd,false);
15 
16  try
17  {
18  cmd.parse(argc,argv);
19  }
20  catch (TCLAP::ArgException& e)
21  {
22  std::cerr << "Error: " << e.error() << "for argument " << e.argId() << std::endl;
23  return EXIT_FAILURE;
24  }
25 
26  typedef anima::LogTensorImageFilter <double> MainFilterType;
27 
28  MainFilterType::Pointer mainFilter = MainFilterType::New();
29 
30  mainFilter->SetNumberOfWorkUnits(nbpArg.getValue());
31  mainFilter->SetScaleNonDiagonal(scaleArg.isSet());
32 
33  mainFilter->SetInput(anima::readImage <MainFilterType::TInputImage> (inArg.getValue()));
34 
35  mainFilter->Update();
36 
37  std::cout << "Writing result to : " << resArg.getValue() << std::endl;
38 
39  anima::writeImage <MainFilterType::TOutputImage> (resArg.getValue(),mainFilter->GetOutput());
40 
41  return EXIT_SUCCESS;
42 }
int main(int argc, char **argv)