ANIMA  4.0
animaLowMemPatientToGroupComparison.cxx
Go to the documentation of this file.
1 #include <iostream>
2 #include <tclap/CmdLine.h>
3 
5 
6 using namespace std;
7 
8 int main(int argc, char **argv)
9 {
10  TCLAP::CmdLine cmd("INRIA / IRISA - VisAGeS/Empenn Team", ' ',ANIMA_VERSION);
11 
12  TCLAP::ValueArg<std::string> refLTArg("i","inputlogtens","Log-Tensor Test Image",true,"","log-tensor test image",cmd);
13  TCLAP::ValueArg<std::string> dataLTArg("I","databaselogtens","Log-Tensor Database Image List",true,"","log-tensor database image list",cmd);
14 
15  TCLAP::ValueArg<std::string> maskArg("m","maskname","Computation mask",true,"","computation mask",cmd);
16  TCLAP::ValueArg<std::string> resArg("o","outputname","output image prefix",true,"","output image prefix",cmd);
17  TCLAP::ValueArg<std::string> resPValArg("O","outpvalname","P-value output image",true,"","P-Value output image",cmd);
18 
19  TCLAP::ValueArg<std::string> statTestArg("t","stat-test","Statistical test to use ([fisher],chi)",false,"fisher","statistical test",cmd);
20  TCLAP::ValueArg<double> expVarArg("e","expvar","PCA threshold: threshold on eigenvalues to compute the new basis (default: 0.9)",false,0.9,"PCA threshold",cmd);
21  TCLAP::ValueArg<unsigned int> numEigenArg("E","numeigenpca","Number of eigenvalues to keep (default: 6)",false,6,"Number of PCA eigen values",cmd);
22 
23  TCLAP::ValueArg<unsigned int> nbpArg("p","numberofthreads","Number of threads to run on (default : all cores)",false,itk::MultiThreaderBase::GetGlobalDefaultNumberOfThreads(),"number of threads",cmd);
24 
25  TCLAP::ValueArg<unsigned int> splitsArg("s","split","Split image for low memory (default: 2)",false,2,"Number of splits",cmd);
26  TCLAP::ValueArg<int> specSplitArg("S","splittoprocess","Specific split to process (use to run on cluster (default: -1 = all)",false,-1,"Split to process",cmd);
27  TCLAP::SwitchArg genOutputDescroArg("G","generateouputdescription","Generate ouptut description data",cmd,false);
28 
29  try
30  {
31  cmd.parse(argc,argv);
32  }
33  catch (TCLAP::ArgException& e)
34  {
35  std::cerr << "Error: " << e.error() << "for argument " << e.argId() << std::endl;
36  return(1);
37  }
38 
39  string dataLTName, maskName;
40  dataLTName = dataLTArg.getValue();
41  maskName = maskArg.getValue();
42 
43  typedef anima::LowMemoryPatientToGroupComparisonBridge MultiAtlasZScoreBridgeType;
44 
45  MultiAtlasZScoreBridgeType *mainFilter = new MultiAtlasZScoreBridgeType;
46  mainFilter->SetComputationMask(maskName);
47  mainFilter->SetNumberOfWorkUnits(nbpArg.getValue());
48 
49  mainFilter->SetNumEigenValuesPCA(numEigenArg.getValue());
50  mainFilter->SetExplainedRatio(expVarArg.getValue());
51 
52  mainFilter->SetDataLTFileNames(dataLTName);
53  mainFilter->SetTestLTFileName(refLTArg.getValue());
54 
55  mainFilter->SetOutputName(resArg.getValue());
56  mainFilter->SetOutputPValName(resPValArg.getValue());
57 
58  mainFilter->SetNbSplits(splitsArg.getValue());
59 
60  if (statTestArg.getValue() == "chi")
61  mainFilter->SetStatisticalTestType(MultiAtlasZScoreBridgeType::MainFilterType::CHI_SQUARE);
62  else
63  mainFilter->SetStatisticalTestType(MultiAtlasZScoreBridgeType::MainFilterType::FISHER);
64 
65  try
66  {
67  mainFilter->Update(specSplitArg.getValue(),genOutputDescroArg.getValue());
68  }
69  catch(itk::ExceptionObject &e)
70  {
71  std::cerr << e << std::endl;
72  return 1;
73  }
74 
75  delete mainFilter;
76 
77  return 0;
78 }
int main(int argc, char **argv)
STL namespace.