3 #include <tclap/CmdLine.h> 6 #include <itkCommand.h> 11 void eventCallback (itk::Object* caller,
const itk::EventObject& event,
void* clientData)
13 itk::ProcessObject * processObject = (itk::ProcessObject*) caller;
14 std::cout<<
"\033[K\rProgression: "<<(int)(processObject->GetProgress() * 100)<<
"%"<<std::flush;
18 int main(
int ac,
const char** av)
21 TCLAP::CmdLine cmd(
"Compute an ADC, FA, axial Diffusivity, radial diffuisivity image from a DTI volume.\nINRIA / IRISA - VisAGeS/Empenn Team",
' ',ANIMA_VERSION);
23 TCLAP::ValueArg<std::string> tensorArg(
"i",
31 TCLAP::ValueArg<std::string> adcArg(
"a",
39 TCLAP::ValueArg<std::string> faArg(
"f",
47 TCLAP::ValueArg<std::string> axArg(
"x",
49 "Axial diffusivity image",
52 "Axial diffusivity image",
55 TCLAP::ValueArg<std::string> radArg(
"r",
57 "Radial diffusivity image",
60 "Radial diffusivity image",
63 TCLAP::ValueArg<unsigned int> nbpArg(
"p",
65 "Number of thread to use",
68 "Number of thread to use",
75 catch (TCLAP::ArgException& e)
77 std::cerr <<
"Error: " << e.error() <<
"for argument " << e.argId() << std::endl;
81 itk::CStyleCommand::Pointer callback = itk::CStyleCommand::New();
84 typedef itk::VectorImage<double, 3> TensorImageType;
85 typedef itk::Image<double, 3> OutputsImageType;
89 FilterType::Pointer filter = FilterType::New();
90 filter->SetInput(anima::readImage<TensorImageType>(tensorArg.getValue()));
93 filter->SetNumberOfWorkUnits(nbpArg.getValue());
95 filter->AddObserver(itk::ProgressEvent(), callback );
98 std::cout << std::endl;
102 if(adcArg.getValue() !=
"")
103 anima::writeImage<OutputsImageType>(adcArg.getValue(), filter->GetADCImage());
104 if(faArg.getValue() !=
"")
105 anima::writeImage<OutputsImageType>(faArg.getValue(), filter->GetFAImage());
106 if(axArg.getValue() !=
"")
107 anima::writeImage<OutputsImageType>(axArg.getValue(), filter->GetAxialDiffusivityImage());
108 if(radArg.getValue() !=
"")
109 anima::writeImage<OutputsImageType>(radArg.getValue(), filter->GetRadialDiffusivityImage());
111 catch( itk::ExceptionObject & err )
113 std::cerr <<
"Itk cannot write output, be sure to use a valid extension..." << std::endl;
114 std::cerr << err << std::endl;
void eventCallback(itk::Object *caller, const itk::EventObject &event, void *clientData)
int main(int ac, const char **av)
Applies an variance filter to an image.