18 #ifndef __itkSphericalHarmonicsGenerator_h 19 #define __itkSphericalHarmonicsGenerator_h 22 #include <itkObject.h> 23 #include <itkObjectFactory.h> 53 template<
class PreciseType =
double>
70 static std::complex<PreciseType> ComplexSH(
const int l,
const int m,
const PreciseType theta,
const PreciseType phi);
72 static PreciseType RealSH(
const int l,
const int m,
const PreciseType theta,
const PreciseType phi);
75 static PreciseType ComplexTripleIntegration(
const int l1,
const int m1,
const int l2,
const int m2,
const int l3,
const int m3);
77 static PreciseType RealTripleIntegration(
const int l1,
const int m1,
const int l2,
const int m2,
const int l3,
const int m3,
const bool is_precalculated=
true);
80 static std::complex<double> ComplexDerivativeOfTheta (
const int l,
const int m,
const double theta,
const double phi);
82 static std::complex<double> ComplexDerivativeOfPhi (
const int l,
const int m,
const double theta,
const double phi);
85 static double RealDerivativeOfTheta (
const int l,
const int m,
const double theta,
const double phi);
87 static double RealDerivativeOfPhi (
const int l,
const int m,
const double theta,
const double phi);
93 void PrintSelf(std::ostream & os, Indent indent)
const ITK_OVERRIDE;
97 void operator=(
const Self&);
121 if (!useExactSize &&
SH3IntegralTable->Size()>0 && dim[0]<=shapeOld[0] && dim[1]<=shapeOld[1] && dim[2]<=shapeOld[2])
125 if (
SH3IntegralTable->Size()>0 && dim[0]==shapeOld[0] && dim[1]==shapeOld[1] && dim[2]==shapeOld[2])
128 typedef itk::Image<double,3> ImageType;
129 static ImageType::Pointer image = ImageType::New();
132 ImageType::RegionType region = image->GetLargestPossibleRegion();
133 ImageType::SizeType size = region.GetSize();
134 ImageType::IndexType pixelIndex;
137 for (
int i = 0; i < 3; ++i )
138 shape[i] = useExactSize? dim[i] : utl::max<int>(dim[i], size[i]);
147 for (
int i = 0; i < shape[0]; ++i )
148 for (
int j = 0; j < shape[1]; ++j )
149 for (
int k = 0; k < shape[2]; ++k )
151 index[0]=i, index[1]=j, index[2]=k;
152 if (i<size[0] && j<size[1] && k<size[2] )
154 pixelIndex[0]=i, pixelIndex[1]=j, pixelIndex[2]=k;
155 (*SH3IntegralTable)(index) = image->GetPixel(pixelIndex);
159 std::vector<int> v1, v2, v3;
172 #define ITK_TEMPLATE_SphericalHarmonicsGenerator(_, EXPORT, x, y) namespace itk { \ 173 _(2(class EXPORT SphericalHarmonicsGenerator< ITK_TEMPLATE_2 x >)) \ 174 namespace Templates { typedef SphericalHarmonicsGenerator< ITK_TEMPLATE_2 x > SphericalHarmonicsGenerator##y; } \ 177 #if ITK_TEMPLATE_EXPLICIT 178 # include "Templates/itkSphericalHarmonicsGenerator+-.h" 181 #if !defined(ITK_MANUAL_INSTANTIATION) && !defined(__itkSphericalHarmonicsGenerator_hxx)
void InitializeSHTripleIntegrationTable(const int rank0=-1, const int rank1=-1, const int rank2=-1, const bool useExactSize=false)
static std::shared_ptr< NDArray< double, 3 > > SH3IntegralTable(new NDArray< double, 3 >)
bool IsImageEmpty(const SmartPointer< ImageType > &image)
std::vector< int > GetIndexSHlm(const int j)
SmartPointer< Self > Pointer
Generate complex and real Spherical Harmonic Basis.
static const std::string SH3Itegralhdr
int RankToDimSH(const int shRank)
SphericalHarmonicsGenerator Self
SmartPointer< const Self > ConstPointer