DMRITool  v0.1.1-139-g860d86b4
Diffusion MRI Tool
SamplingSchemeQSpace1OptEstimation.cxx
Go to the documentation of this file.
1 
13 #include "utl.h"
16 
17 #include "SamplingSchemeQSpace1OptEstimationCLP.h"
18 
23 int
24 main (int argc, char const* argv[])
25 {
26 
27  PARSE_ARGS;
28 
29  utl::LogLevel = _Verbose;
30 
31  typedef itk::SamplingSchemeQSpace<double> SamplingType;
32  typedef SamplingType::Pointer SamplingPointer;
34  EstimationType::Pointer estimator = EstimationType::New();
35 
36  utlGlobalException(_InitialOrientations.size()==0, "need to set --initial");
37  SamplingPointer initialSamples = SamplingType::New();
38  initialSamples->ReadOrientationFileList(_InitialOrientations, DIRECTION_NODUPLICATE);
39 
40  EstimationType::MatrixPointer fineOrientations(new EstimationType::MatrixType());
41 
42  estimator->SetDebug(_Verbose>=LOG_DEBUG);
43  // estimator->SetNumbersInShell(numbers);
44  estimator->SetTessellationOrder(_Order);
45  if (_Criteria=="DISTANCE")
46  estimator->SetCriteriaType(EstimationType::DISTANCE);
47  else if (_Criteria=="ELECTROSTATIC")
48  estimator->SetCriteriaType(EstimationType::ELECTROSTATIC);
49  if(_FineOrientationsArg.isSet())
50  {
51  fineOrientations = utl::ReadGrad<double>(_FineOrientations, DIRECTION_NODUPLICATE, CARTESIAN_TO_CARTESIAN);
52  estimator->SetFineOrientations(fineOrientations);
53  }
54  estimator->SetInitialOrientations(initialSamples);
55  estimator->SetWeightForSingleShell(_Weight);
56 
57  itk::TimeProbe clock;
58  clock.Start();
59  estimator->UpdateOutputData();
60  clock.Stop();
61  std::cout << "Elapsed time : " << clock.GetTotal() << std::endl;
62 
63  SamplingPointer output = estimator->GetOutputOrientations();
64  // output->Print(std::cout<<"output");
65  // output->RemoveSamplesNotIndexed();
66 
68  WriterType::Pointer writer = WriterType::New();
69  writer->SetSampling(output);
70  writer->SetOrientationFile(_OutputOrientations);
71  writer->SaveSingleShellOn();
72  writer->SaveAllShellsInOneFileOff();
73  writer->Update();
74 
75  return 0;
76 }
helper functions specifically used in dmritool
used for debug information. this->GetDebug()
Definition: utlCoreMacro.h:193
incremental estimation of single/multi-shell orientations
#define utlGlobalException(cond, expout)
Definition: utlCoreMacro.h:372
this class describes sampling in Q space.
static int LogLevel
Definition: utlCoreMacro.h:203
int main(int argc, char const *argv[])
incrementatl estimation for single and multiple shell sampling scheme
write orientations and b values (single/multiple shells) into text files