DMRITool  v0.1.1-139-g860d86b4
Diffusion MRI Tool
SPFToODF.cxx
Go to the documentation of this file.
1 
18 #include "utl.h"
19 #include "SPFToODFCLP.h"
22 
24 
25 #include "itkImage.h"
26 
30 int
31 main (int argc, char const* argv[])
32 {
33 
34  // GenerateCLP
35  PARSE_ARGS;
36 
37  typedef double PrecisionType;
38  typedef itk::VectorImage<PrecisionType, 3> VectorImageType;
39  typedef itk::Image<PrecisionType, 3> ScalarImageType;
40 
41  VectorImageType::Pointer spf=0;
42  ScalarImageType::Pointer maskImage=0;
43  itk::ReadImage<VectorImageType>(_InputSPFFile, spf);
44  if (_MaskFileArg.isSet())
45  itk::ReadImage<ScalarImageType>(_MaskFile, maskImage);
46 
47  ScalarImageType::Pointer mdImage= ScalarImageType::New();
48  ScalarImageType::Pointer scaleImage= ScalarImageType::New();
49  if (_MDImageFileArg.isSet())
50  {
51  itk::ReadImage<ScalarImageType>(_MDImageFile, mdImage);
52 
54  ScaleFromMDfilterType::Pointer scaleFromMDfilter = ScaleFromMDfilterType::New();
55  scaleFromMDfilter->SetMD0(_MD0);
56  scaleFromMDfilter->SetTau(_Tau);
57  scaleFromMDfilter->SetIsOriginalBasis(true);
58  scaleFromMDfilter->SetInput(mdImage);
59  scaleFromMDfilter->Update();
60  scaleImage = scaleFromMDfilter->GetOutput();
61  }
62 
64  // FeaturesFromSPFFilterType::Pointer featureFromSPFFilter=NULL;
65 
67  // ProfileFromSPFFilterType::Pointer featureFromSPFFilter = ProfileFromSPFFilterType::New();
68  ODFFromSPFFilterType::Pointer featureFromSPFFilter = ODFFromSPFFilterType::New();
69  if (_MaskFileArg.isSet())
70  featureFromSPFFilter->SetMaskImage(maskImage);
71  featureFromSPFFilter->SetSHRank(_SHRank);
72  featureFromSPFFilter->SetRadialRank(_RadialRank);
73  featureFromSPFFilter->SetMD0(_MD0);
74  featureFromSPFFilter->SetTau(_Tau);
75  featureFromSPFFilter->SetBasisScale(_Scale);
76  featureFromSPFFilter->SetBasisType(FeaturesFromSPFFilterType::SPF);
77  if (_MDImageFileArg.isSet())
78  {
79  featureFromSPFFilter->SetScaleImage(scaleImage);
80  }
81  if (_Debug)
82  featureFromSPFFilter->DebugOn();
83  featureFromSPFFilter->SetInput(spf);
84  featureFromSPFFilter->SetBMax(_BMax);
85  featureFromSPFFilter->SetODFOrder(_ODFOrder);
86  if (_NumberOfThreads>0)
87  featureFromSPFFilter->SetNumberOfThreads(_NumberOfThreads);
88  std::cout << "ODF estimation starts" << std::endl << std::flush;
89  featureFromSPFFilter->Update();
90  std::cout << "ODF estimation ends" << std::endl << std::flush;
91  VectorImageType::Pointer odf = featureFromSPFFilter->GetOutput();
92  itk::SaveImage<VectorImageType>(odf, _OutputFile);
93 
94  return 0;
95 }
96 
helper functions specifically used in dmritool
calculate ODFs from SPF coefficients
int main(int argc, char const *argv[])
DWI/EAP profile (represented by SH basis) converted from SPF coefficients.
Definition: SPFToODF.cxx:31
itk::VectorImage< ScalarType, 3 > VectorImageType
Definition: 4DImageMath.cxx:30
Compute some features (DWI/EAP profile, ODFs, scalar indices) from SPF coefficients.