18 #ifndef __itkSphericalPolarFourierGenerator_hxx 19 #define __itkSphericalPolarFourierGenerator_hxx 24 #include <gsl/gsl_sf_expint.h> 33 template <
class PreciseType >
43 template <
class PreciseType >
56 first_temp = std::sqrt(first_temp);
64 else if (m_SPFType==DSPF)
76 else if (m_SPFType==SHORE)
81 first_temp = std::sqrt(first_temp);
87 radial_dual->
SetNLSPF(m_N,m_L,SHORE);
89 PreciseType
sign = (m_N)%2==0 ? 1 : -1;
97 template <
class PreciseType >
100 ::Evaluate (
const PreciseType qrValue,
const bool isFourier)
const 110 first_temp = std::sqrt(first_temp);
111 if (this->GetDebug())
113 std::cout <<
"radial order = " << m_N << std::endl;
114 std::cout <<
"utl::Factorial("<<m_N<<
") = " <<
utl::Factorial(m_N) << std::endl;
115 std::cout <<
"std::pow(m_Scale,1.5) = " << std::pow((
double)this->m_Scale,(
double)1.5) << std::endl;
117 std::cout <<
"first_temp = " << first_temp << std::endl;
119 PreciseType result = first_temp * std::exp( -1.0*qrValue*qrValue / (2*this->m_Scale) )
120 *
utl::Lagurre(m_N, 0.5, qrValue*qrValue/this->m_Scale);
126 radial_dual->SetNLSPF(m_N,m_L,DSPF);
127 radial_dual->SetScale(m_Scale);
128 return radial_dual->Evaluate(qrValue,
false);
131 else if (m_SPFType==DSPF)
138 if (this->GetDebug())
140 std::cout <<
"radial order = " << m_N << std::endl;
141 std::cout <<
"utl::Factorial("<<m_N<<
") = " <<
utl::Factorial(m_N) << std::endl;
142 std::cout <<
"std::pow(m_Scale,1.5) = " << std::pow((
double)this->m_Scale,1.5) << std::endl;
144 std::cout <<
"first_temp = " << first_temp << std::endl;
146 PreciseType rr = qrValue*std::sqrt(this->m_Scale);
147 if (this->GetDebug())
148 std::cout <<
"qrValue = " << qrValue <<
", relative qrvalue = " << rr << std::endl;
149 PreciseType
sign = 4.0;
150 if ( (m_L/2) % 2 == 1)
153 PreciseType integral = 0;
154 for (
int i = 0; i <= m_N; i += 1 )
158 double a = double(i+0.5*m_L+1.5);
159 double b = double(m_L+1.5);
160 double c = double(-2*
M_PI*
M_PI*rr*rr);
167 integral += coef_laguerre[i]* first_C;
171 PreciseType result = sign * first_temp * integral;
177 radial_dual->SetNLSPF(m_N,m_L,SPF);
178 radial_dual->SetScale(m_Scale);
179 return radial_dual->Evaluate(qrValue,
false);
182 else if (m_SPFType==SHORE)
187 first_temp = std::sqrt(first_temp);
188 PreciseType x2_temp = qrValue*qrValue / this->m_Scale;
190 if (this->GetDebug())
193 PreciseType exp_temp = std::exp( -1.0*x2_temp / 2 );
194 PreciseType lagurre_temp =
utl::Lagurre(m_N-m_L/2, m_L+0.5, x2_temp);
196 utlPrintVar4(this->GetDebug(),m_N,m_L, std::sqrt(x2_temp), qrValue);
197 utlPrintVar5(this->GetDebug(), first_temp, exp_temp, lagurre_temp, pow_temp, result);
204 radial_dual->SetNLSPF(m_N,m_L,SHORE);
205 radial_dual->SetScale( 1.0/(4*
M_PI*
M_PI*m_Scale) );
206 PreciseType
sign = (m_N)%2==0 ? 1 : -1;
207 return sign*radial_dual->Evaluate(qrValue,
false);
215 template <
class PreciseType >
218 ::Evaluate (
const PreciseType qrValue,
const PreciseType theta,
const PreciseType phi,
const bool isFourier)
const 222 PreciseType radial_value = m_Radial->Evaluate(qrValue, isFourier);
224 utlPrintVar2(this->GetDebug(), radial_value, spherical_value);
225 return radial_value*spherical_value;
228 template <
class PreciseType >
233 return m_Radial->Evaluate(qrValue, isFourier);
236 template <
class PreciseType>
241 Superclass::PrintSelf(os, indent);
245 os << indent <<
"SPFType: SPF basis" << std::endl;
246 else if (spfType==DSPF)
247 os << indent <<
"SPFType: Dual SPF basis" << std::endl;
248 else if (spfType==SHORE)
249 os << indent <<
"SPFType: SHORE basis" << std::endl;
static PreciseType RealSH(const int l, const int m, const PreciseType theta, const PreciseType phi)
PreciseType Evaluate(const PreciseType qrValue, const PreciseType theta, const PreciseType phi, const bool isFourier=false) const
void PrintSelf(std::ostream &os, Indent indent) const
radial part of general SPF basis
PreciseType EvaluateRadial(const PreciseType qrValue, const bool isFourier=false) const
helper functions specifically used in dmritool
#define utlPrintVar3(cond, var1, var2, var3)
virtual void SetScale(double _arg)
void SetNLSPF(const int n, const int l, const SPFType spf)
#define utlException(cond, expout)
#define utlPrintVar4(cond, var1, var2, var3, var4)
SphericalPolarFourierRadialGenerator()
unsigned long Factorial(const int n)
double Hyperg1F1(double a, double b, double x)
#define utlPrintVar2(cond, var1, var2)
T Lagurre(const int n, const double a, const T x)
PreciseType Evaluate(const PreciseType qrValue, const bool isFourier=false) const
std::vector< double > GetCoefLaguerre(const int n, const double a=0.5)
#define utlPrintVar5(cond, var1, var2, var3, var4, var5)
double GammaHalfInteger(const double x)
#define utlShowPosition(cond)
PreciseType GetNormalizeFacotr(const bool isFourier=false) const
int sign(const T &x)
Return the sign of x.
double PowHalfInteger(const double a, const double b)
SmartPointer< Self > Pointer