DMRITool  v0.1.1-139-g860d86b4
Diffusion MRI Tool
SPFToScalarMap.cxx
Go to the documentation of this file.
1 
11 #include "SPFToScalarMapCLP.h"
13 
15 
19 int
20 main (int argc, char const* argv[])
21 {
22  // GenerateCLP
23  PARSE_ARGS;
24 
25  typedef double PrecisionType;
26  typedef itk::VectorImage<PrecisionType, 3> VectorImageType;
27  typedef itk::Image<PrecisionType, 3> ScalarImageType;
28 
29  VectorImageType::Pointer spf=NULL;
30  ScalarImageType::Pointer maskImage=NULL;
31  itk::ReadImage<VectorImageType>(_InputSPFFile, spf);
32  if (_MaskFileArg.isSet())
33  itk::ReadImage<ScalarImageType>(_MaskFile, maskImage);
34 
35  ScalarImageType::Pointer mdImage= ScalarImageType::New();
36  ScalarImageType::Pointer scaleImage= ScalarImageType::New();
37  if (_MDImageFileArg.isSet())
38  {
39  itk::ReadImage<ScalarImageType>(_MDImageFile, mdImage);
40 
42  ScaleFromMDfilterType::Pointer scaleFromMDfilter = ScaleFromMDfilterType::New();
43  scaleFromMDfilter->SetMD0(_MD0);
44  scaleFromMDfilter->SetTau(_Tau);
45  scaleFromMDfilter->SetIsOriginalBasis(true);
46  scaleFromMDfilter->SetInput(mdImage);
47  scaleFromMDfilter->Update();
48  scaleImage = scaleFromMDfilter->GetOutput();
49  }
50 
52 
54  FilterType::Pointer featureFromSPFFilter = FilterType::New();
55  if (_MaskFileArg.isSet())
56  featureFromSPFFilter->SetMaskImage(maskImage);
57  featureFromSPFFilter->SetSHRank(_SHRank);
58  featureFromSPFFilter->SetRadialRank(_RadialRank);
59  featureFromSPFFilter->SetMD0(_MD0);
60  featureFromSPFFilter->SetTau(_Tau);
61  featureFromSPFFilter->SetBasisScale(_Scale);
62  featureFromSPFFilter->SetBasisType(FeaturesFromSPFFilterType::SPF);
63  if (_MDImageFileArg.isSet())
64  {
65  featureFromSPFFilter->SetScaleImage(scaleImage);
66  }
67  if (_MapType=="RTO")
68  featureFromSPFFilter->SetMapType(FilterType::RTO);
69  else if(_MapType=="MSD")
70  featureFromSPFFilter->SetMapType(FilterType::MSD);
71  else if(_MapType=="PFA")
72  featureFromSPFFilter->SetMapType(FilterType::PFA);
73  if (_Debug)
74  featureFromSPFFilter->DebugOn();
75  featureFromSPFFilter->SetInput(spf);
76  if (_NumberOfThreads>0)
77  featureFromSPFFilter->SetNumberOfThreads(_NumberOfThreads);
78 
80  if (_ShowProgressArg.isSet())
81  featureFromSPFFilter->AddObserver( itk::ProgressEvent(), observer );
82 
83  std::cout << "Scalar map estimation starts" << std::endl << std::flush;
84  featureFromSPFFilter->Update();
85  std::cout << "Scalar map estimation ends" << std::endl << std::flush;
86 
87  ScalarImageType::Pointer p0 = featureFromSPFFilter->GetOutput();
88  itk::SaveImage<ScalarImageType>(p0, _OutputFile);
89 
90  return 0;
91 }
calculate ODFs from SPF coefficients
int main(int argc, char const *argv[])
calculate RTO map from SPF coefficients
itk::VectorImage< ScalarType, 3 > VectorImageType
Definition: 4DImageMath.cxx:30
Compute some features (DWI/EAP profile, ODFs, scalar indices) from SPF coefficients.