19 #include "SPFToODFCLP.h" 31 main (
int argc,
char const* argv[])
37 typedef double PrecisionType;
39 typedef itk::Image<PrecisionType, 3> ScalarImageType;
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);
47 ScalarImageType::Pointer mdImage= ScalarImageType::New();
48 ScalarImageType::Pointer scaleImage= ScalarImageType::New();
49 if (_MDImageFileArg.isSet())
51 itk::ReadImage<ScalarImageType>(_MDImageFile, mdImage);
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();
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())
79 featureFromSPFFilter->SetScaleImage(scaleImage);
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);
helper functions specifically used in dmritool
Compute SPF scale from mean diffusivity.
calculate ODFs from SPF coefficients
int main(int argc, char const *argv[])
DWI/EAP profile (represented by SH basis) converted from SPF coefficients.
itk::VectorImage< ScalarType, 3 > VectorImageType
Compute some features (DWI/EAP profile, ODFs, scalar indices) from SPF coefficients.