12 #ifndef __itkSHCoefficientsFit_h 13 #define __itkSHCoefficientsFit_h 33 template <
class T =
double >
52 m_Orientations(new MatrixType()),
53 m_BasisSHMatrix(new MatrixType()),
54 m_BasisSHMatrixPInv(new MatrixType())
62 {
return ! (*
this==other); }
72 Superclass::operator=(other);
97 Superclass::VerifyInputParameters();
104 (m_Orientations->Rows())(inputVecSize).msg(
"need to set orientations correctly");
111 VerifyInputParameters();
114 int J = m_BasisSHMatrix->Cols();
115 int N = m_BasisSHMatrix->Rows();
117 MatrixType shT = m_BasisSHMatrix->GetTranspose();
121 MatrixType regMat(J, J, 0.0);
122 for (
int i = 0; i < J; ++i )
125 regMat(i,i) = m_Lambda*lm[0]*lm[0]*(lm[0]+1.)*(lm[0]+1.);
143 if (std::fabs(m_Power-1.0)>1e-8)
145 VectorType sf_power =
utl::Pow(sf, m_Power);
146 return (*m_BasisSHMatrixPInv) * sf_power;
149 return (*m_BasisSHMatrixPInv) * sf;
158 void Print(std::ostream & os=std::cout)
const MatrixPointer m_Orientations
NDArray is a N-Dimensional array class (row-major, c version)
utl::NDArray< double, 2 > MatrixType
helper functions specifically used in dmritool
utl_shared_ptr< MatrixType > MatrixPointer
MatrixPointer m_BasisSHMatrixPInv
auto Pow(const TLeft &lhs, const TRight &rhs) -> decltype(utl::F< utl::Functor::Pow< Expr2ValueType< TLeft, TRight >> >(lhs, rhs))
#define utlLogOSVar(os,...)
SmartPointer< Self > Pointer
void PrintUtlMatrix(const NDArray< T, 2 > &mat, const std::string &str="", const char *separate=" ", std::ostream &os=std::cout)
SHCoefficientsFit(const Self &other)
used for debug information. this->GetDebug()
std::vector< int > GetIndexSHlm(const int j)
#define utlSAGlobalException(expr)
utl::NDArray< double, 1 > VectorType
void VerifyInputParameters(const int inputVecSize=-1) const
#define utlGetMacro(name, type)
fit SH coefficients from spherical function samples.
MatrixPointer m_BasisSHMatrix
std::shared_ptr< NDArray< T, 2 > > ComputeSHMatrix(const unsigned int rank, const NDArray< T, 2 > &grad, const int mode)
SmartPointer< const Self > ConstPointer
bool IsLogDebug(const int level=utl::LogLevel)
#define utlSetGetMacro(name, type)
#define utlGlobalException(cond, expout)
Self & operator=(const Self &other)
int GetOutputDimension(const int) const
bool operator!=(const Self &other) const
utl::Functor::VectorFunctorBase< utl::Vector< T > > Superclass
#define utlSAException(expr)
int RankToDimSH(const int shRank)
#define utlVLogPosition(level)
NDArray< T, 2 > InverseSymmericMatrix(const NDArray< T, 2 > &mat, const double eps=1e-10)
bool operator==(const Self &other) const
void Print(std::ostream &os=std::cout) const
virtual ~SHCoefficientsFit()
VectorType operator()(const VectorType &sf) const