19 #include "SPFToProfileCLP.h" 30 main (
int argc,
char const* argv[])
36 typedef double PrecisionType;
38 typedef itk::Image<PrecisionType, 3> ScalarImageType;
40 VectorImageType::Pointer spf=0;
41 ScalarImageType::Pointer maskImage=0;
42 itk::ReadImage<VectorImageType>(_InputSPFFile, spf);
43 if (_MaskFileArg.isSet())
44 itk::ReadImage<ScalarImageType>(_MaskFile, maskImage);
46 ScalarImageType::Pointer mdImage=0, scaleImage=0;
47 if (_MDImageFileArg.isSet())
49 itk::ReadImage<ScalarImageType>(_MDImageFile, mdImage);
52 ScaleFromMDfilterType::Pointer scaleFromMDfilter = ScaleFromMDfilterType::New();
53 scaleFromMDfilter->SetMD0(_MD0);
54 scaleFromMDfilter->SetTau(_Tau);
55 scaleFromMDfilter->SetIsOriginalBasis(
true);
56 scaleFromMDfilter->SetInput(mdImage);
57 scaleFromMDfilter->Update();
58 scaleImage = scaleFromMDfilter->GetOutput();
65 ProfileFromSPFFilterType::Pointer featureFromSPFFilter = ProfileFromSPFFilterType::New();
67 if (_MaskFileArg.isSet())
68 featureFromSPFFilter->SetMaskImage(maskImage);
69 featureFromSPFFilter->SetSHRank(_SHRank);
70 featureFromSPFFilter->SetRadialRank(_RadialRank);
71 featureFromSPFFilter->SetMD0(_MD0);
72 featureFromSPFFilter->SetTau(_Tau);
73 featureFromSPFFilter->SetBasisScale(_Scale);
74 featureFromSPFFilter->SetBasisType(FeaturesFromSPFFilterType::SPF);
75 if (_MDImageFileArg.isSet())
77 featureFromSPFFilter->SetScaleImage(scaleImage);
79 featureFromSPFFilter->SetIsInQSpace(!_rSpaceArg.isSet());
80 if (_OrientationsFileArg.isSet())
83 featureFromSPFFilter->SetOrientations(grad);
85 if (_RadiusVectorFileArg.isSet())
87 ProfileFromSPFFilterType::STDVectorPointer radiusVec(
new ProfileFromSPFFilterType::STDVectorType());
89 featureFromSPFFilter->SetRadiusVector(radiusVec);
91 if (_NumberOfThreads>0)
92 featureFromSPFFilter->SetNumberOfThreads(_NumberOfThreads);
93 if (_DebugArg.isSet())
94 featureFromSPFFilter->DebugOn();
95 featureFromSPFFilter->SetInput(spf);
96 featureFromSPFFilter->SetRadius(_Radius);
97 featureFromSPFFilter->SetIsFourier(_IsFourier);
98 std::cout <<
"EAP profile estimation starts" << std::endl << std::flush;
99 featureFromSPFFilter->Update();
100 std::cout <<
"EAP profile estimation ends" << std::endl << std::flush;
101 VectorImageType::Pointer eap = featureFromSPFFilter->GetOutput();
102 itk::SaveImage<VectorImageType>(eap, _OutputFile);
helper functions specifically used in dmritool
Calculate DWI/EAP profile from SPF coefficients.
Compute SPF scale from mean diffusivity.
void ReadVector(const std::string &vectorStr, std::vector< T > &vec, const char *cc=" ")
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.