ANIMA  4.0
animaFDRCorrectPValues.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","input","Non corrected P-value image",true,"","Non corrected P-value image",cmd);
11  TCLAP::ValueArg<std::string> resArg("o","output","FDR thresholded output image at q",true,"","FDR corrected output image at q",cmd);
12  TCLAP::ValueArg<double> qArg("q","q-val","FDR q value",true,0.05,"FDR q value",cmd);
13  TCLAP::SwitchArg byCorrArg("Y", "by-corr", "Use BY correction (if not set, BH correction is used)", cmd, false);
14  TCLAP::ValueArg<std::string> maskArg("m","mask","Mask image (default: all pixels are in mask)",false,"","Mask image",cmd);
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(1);
24  }
25 
26  typedef anima::FDRCorrectImageFilter<double> MainFilterType;
27 
28  MainFilterType::Pointer mainFilter = MainFilterType::New();
29 
30  mainFilter->SetInput(anima::readImage<MainFilterType::TInputImage> (inArg.getValue()));
31  mainFilter->SetQValue(qArg.getValue());
32  mainFilter->SetBYCorrection(byCorrArg.isSet());
33 
34  if (maskArg.getValue() != "")
35  mainFilter->SetMaskImage(anima::readImage <MainFilterType::MaskImageType> (maskArg.getValue()));
36 
37  mainFilter->Update();
38 
39  std::cout << "Writing result to : " << resArg.getValue() << std::endl;
40 
41  anima::writeImage<MainFilterType::TOutputImage>(resArg.getValue(), mainFilter->GetOutput());
42 
43  return 0;
44 }
int main(int argc, char **argv)