ANIMA  4.0
animaMCMScalarMaps.cxx
Go to the documentation of this file.
1 #include <animaMCMFileReader.h>
4 
5 #include <itkTimeProbe.h>
6 #include <tclap/CmdLine.h>
7 
8 int main(int argc, char **argv)
9 {
10  TCLAP::CmdLine cmd("INRIA / IRISA - VisAGeS Team", ' ',ANIMA_VERSION);
11 
12  TCLAP::ValueArg<std::string> inArg("i","mcm","MCM volume",true,"","MCM volume",cmd);
13  TCLAP::ValueArg<std::string> outFAArg("f","out-fa","Result FA image",true,"","result FA image",cmd);
14  TCLAP::ValueArg<std::string> outMDArg("m","out-md","Result MD image",true,"","result MD image",cmd);
15  TCLAP::ValueArg<std::string> outParDiffArg("p","out-par","Apparent parallel diffusivity image",false,"","apparent parallel diffusivity",cmd);
16  TCLAP::ValueArg<std::string> outPerpDiffArg("P","out-perp","Apparent perpendicular diffusivity image",false,"","apparent perpendicular diffusivity",cmd);
17 
18  TCLAP::ValueArg<std::string> outIsoRWArg("r","out-iso-r-w","Result iso restricted weight image",false,"","result iso R image",cmd);
19  TCLAP::ValueArg<std::string> outAnisoRWArg("a","out-aniso-r-w","Result anisotropic weight image",false,"","result anisotropic image",cmd);
20  TCLAP::ValueArg<std::string> outFWArg("F","out-fw","Result free water weight image",false,"","result FW image",cmd);
21 
22  TCLAP::SwitchArg includeIsoArg("I", "inc-iso", "Include isotropic contributions in FA and MD?", cmd, false);
23 
24  TCLAP::ValueArg<unsigned int> nbThreadsArg("T", "nb-threads", "Number of threads to run on (default: all cores)", false, itk::MultiThreaderBase::GetGlobalDefaultNumberOfThreads(), "number of threads", cmd);
25 
26  try
27  {
28  cmd.parse(argc,argv);
29  }
30  catch (TCLAP::ArgException& e)
31  {
32  std::cerr << "Error: " << e.error() << "for argument " << e.argId() << std::endl;
33  return EXIT_FAILURE;
34  }
35 
36  typedef double ScalarType;
37  typedef anima::MCMScalarMapsImageFilter <ScalarType> MainFilterType;
38 
39  MainFilterType::Pointer mainFilter = MainFilterType::New();
40 
42  mcmReader.SetFileName(inArg.getValue());
43  mcmReader.Update();
44 
45  mainFilter->SetInput(mcmReader.GetModelVectorImage());
46  mainFilter->SetIncludeIsotropicWeights(includeIsoArg.isSet());
47  mainFilter->SetNumberOfWorkUnits(nbThreadsArg.getValue());
48  mainFilter->Update();
49 
50  anima::writeImage <MainFilterType::OutputImageType> (outFAArg.getValue(),mainFilter->GetOutput(3));
51  anima::writeImage <MainFilterType::OutputImageType> (outMDArg.getValue(),mainFilter->GetOutput(4));
52 
53  if (outParDiffArg.getValue() != "")
54  anima::writeImage <MainFilterType::OutputImageType> (outParDiffArg.getValue(),mainFilter->GetOutput(5));
55 
56  if (outPerpDiffArg.getValue() != "")
57  anima::writeImage <MainFilterType::OutputImageType> (outPerpDiffArg.getValue(),mainFilter->GetOutput(6));
58 
59  if (outFWArg.getValue() != "")
60  anima::writeImage <MainFilterType::OutputImageType> (outFWArg.getValue(),mainFilter->GetOutput(0));
61 
62  if (outIsoRWArg.getValue() != "")
63  anima::writeImage <MainFilterType::OutputImageType> (outIsoRWArg.getValue(),mainFilter->GetOutput(1));
64 
65  if (outAnisoRWArg.getValue() != "")
66  anima::writeImage <MainFilterType::OutputImageType> (outAnisoRWArg.getValue(),mainFilter->GetOutput(2));
67 
68  return EXIT_SUCCESS;
69 }
int main(int argc, char **argv)
OutputImagePointer & GetModelVectorImage()
void SetFileName(std::string fileName)