18 #ifndef __itkMultivariateLegendrePolynomial_h
19 #define __itkMultivariateLegendrePolynomial_h
104 {
return m_Dimension; }
107 unsigned int GetDegree(
void)
const
116 unsigned int GetNumberOfCoefficients(
void)
const
117 {
return m_NumberOfCoefficients; }
121 {
return m_DomainSize; }
132 m_Required = required;
157 if ( m_Dimension == 2 )
159 if ( index[1] != m_PrevY )
162 double norm_y = m_NormFactor[1]
163 *
static_cast< double >( index[1] - 1 );
164 this->CalculateXCoef(norm_y, m_CoefficientArray);
170 double norm_x = m_NormFactor[0]
171 *
static_cast< double >( index[0] - 1 );
173 return LegendreSum(norm_x, m_Degree, m_CachedXCoef);
175 else if ( m_Dimension == 3 )
177 if ( index[2] != m_PrevZ )
180 double norm_z = m_NormFactor[2]
181 *
static_cast< double >( index[2] - 1 );
182 this->CalculateYCoef(norm_z, m_CoefficientArray);
186 if ( index[1] != m_PrevY )
189 double norm_y = m_NormFactor[1]
190 *
static_cast< double >( index[1] - 1 );
191 this->CalculateXCoef(norm_y, m_CachedYCoef);
196 double norm_x = m_NormFactor[0]
197 *
static_cast< double >( index[0] - 1 );
198 return this->LegendreSum(norm_x, m_Degree, m_CachedXCoef);
204 unsigned int GetNumberOfCoefficients();
207 unsigned int GetNumberOfCoefficients(
unsigned int dimension,
unsigned int degree);
220 m_MultivariateLegendrePolynomial = polynomial;
221 m_Dimension = m_MultivariateLegendrePolynomial->
GetDimension();
222 m_DomainSize = m_MultivariateLegendrePolynomial->GetDomainSize();
223 m_Index.resize(m_Dimension);
224 std::fill(m_Index.begin(), m_Index.end(), 0);
230 for (
unsigned int dim = 0; dim < m_Dimension; dim++ )
237 {
return m_IsAtEnd; }
241 for (
unsigned int dim = 0; dim < m_Dimension; dim++ )
243 if ( m_Index[dim] < static_cast< int >( m_DomainSize[dim] - 1 ) )
250 if ( dim == m_Dimension - 1 )
265 {
return m_MultivariateLegendrePolynomial->Evaluate(m_Index); }
274 void Print(std::ostream & os);
277 void PrintSelf(std::ostream & os,
Indent indent)
const;
279 double LegendreSum(
const double x,
int n,
303 ITK_EXPORT std::ostream &
operator<<(std::ostream & os,