18 #ifndef __itkMeshFromSphericalFunctionTessellatedSamplesImageFilter_h 19 #define __itkMeshFromSphericalFunctionTessellatedSamplesImageFilter_h 34 template <
class TInputImage,
class TOutputMesh=vtkPolyData>
86 itkSetMacro(DataOrientations, MatrixPointer);
87 itkGetMacro(DataOrientations, MatrixPointer);
93 InputImageConstPointer inputPtr = this->GetInput();
94 int numberOfSamples = this->m_Orientations->Rows();
95 int inputDimension = inputPtr->GetNumberOfComponentsPerPixel();
98 (m_DataOrientations->Rows())(inputDimension).msg(
"inconsistent size between input orientations and input image with spherical samples (whole sphere or hemisphere).");
100 (numberOfSamples)(inputDimension).msg(
"inconsistent size between tessellation and input image with spherical samples (whole sphere or hemisphere).");
103 *this->m_BasisMatrix = (*this->m_Orientations) * orientationsFliped.GetTranspose();
107 for (
int j = 0; j < this->m_BasisMatrix->Columns(); j += 1 )
110 for (
int i = 0; i < this->m_BasisMatrix->Rows(); i += 1 )
112 if ( std::fabs((*this->m_BasisMatrix)(i,j)-1.0) < 1e-8 || std::fabs((*this->m_BasisMatrix)(i,j)+1.0)<1e-8 )
114 (*this->m_BasisMatrix)(i,j) = 1.0;
118 (*this->m_BasisMatrix)(i,j) = 0;
120 utlGlobalException(inputDimension==numberOfSamples && num!=1,
"input orientation is different from the stored one.");
121 utlGlobalException(inputDimension==2*numberOfSamples && num!=2,
"input orientation is different from the stored one.");
124 return this->m_BasisMatrix;
129 VectorType result(x);
130 if (x.GetTwoNorm()>0)
132 double normFactor = 4.0*
M_PI/x.Size() * x.GetSum();
134 result /= normFactor;
142 m_DataOrientations (new MatrixType())
150 Superclass::PrintSelf(os, indent);
159 void operator=(
const Self&);
MeshFromSphericalFunctionTessellatedSamplesImageFilter Self
Superclass::OutputMeshScalarType OutputMeshScalarType
Superclass::OutputMeshScalarType OutputMeshScalarType
Compute mesh from spherical samples in the pre-stored tessellated vertices.
Superclass::VectorType VectorType
SphereTessellatorType::BasicShapeType BasicShapeType
InputImageType::SizeValueType InputImageSizeValueType
InputImageType::RegionType InputImageRegionType
Superclass::OutputMeshPointsType OutputMeshPointsType
Superclass::MatrixPointer MatrixPointer
TOutputMesh OutputMeshPolyDataType
Superclass::STDVectorPointer STDVectorPointer
void PrintUtlMatrix(const NDArray< T, 2 > &mat, const std::string &str="", const char *separate=" ", std::ostream &os=std::cout)
Superclass::OutputMeshPointsType OutputMeshPointsType
Superclass::OutputMeshRGBType OutputMeshRGBType
VectorType NormalizeUnitIntegral(const VectorType &x) const ITK_OVERRIDE
#define utlSAGlobalException(expr)
Superclass::OutputMeshCellArrayType OutputMeshCellArrayType
MeshFromContinuousSphericalFunctionImageFilter< TInputImage, TOutputMesh > Superclass
SmartPointer< const Self > ConstPointer
Superclass::OutputMeshCellArrayType OutputMeshCellArrayType
Superclass::VectorPointer VectorPointer
TInputImage InputImageType
NDArray< T, 2 > FlipOrientations(const NDArray< T, 2 > &in, const std::vector< int > &flip)
SphereTessellator< double > SphereTessellatorType
Superclass::VectorPointer VectorPointer
Superclass::STDVectorType STDVectorType
Superclass::MatrixType MatrixType
MatrixPointer m_DataOrientations
void PrintSelf(std::ostream &os, Indent indent) const ITK_OVERRIDE
InputImageType::PointType InputImagePointType
InputImageType::Pointer InputImagePointer
#define utlGlobalException(cond, expout)
MatrixPointer ComputeBasisMatrix() ITK_OVERRIDE
~MeshFromSphericalFunctionTessellatedSamplesImageFilter()
Superclass::OutputMeshPolyDataPointer OutputMeshPolyDataPointer
InputImageType::SpacingType InputImageSpacingType
MeshFromSphericalFunctionTessellatedSamplesImageFilter()
Superclass::VectorType VectorType
Compute mesh from continuous spherical function linearly represented by a set of bases.
Superclass::OutputMeshRGBType OutputMeshRGBType
#define utlShowPosition(cond)
Superclass::STDVectorPointer STDVectorPointer
Superclass::MatrixPointer MatrixPointer
InputImageType::SizeType InputImageSizeType
Superclass::OutputMeshPolyDataPointer OutputMeshPolyDataPointer
SmartPointer< Self > Pointer
SmartPointer< Self > Pointer
InputImageType::ConstPointer InputImageConstPointer
InputImageType::IndexType InputImageIndexType
Tesselates a sphere via subdivision of tetrahedron, octahedron, or icosahedron.
Superclass::MatrixType MatrixType
Superclass::STDVectorType STDVectorType
InputImageType::PixelType InputImagePixelType
SphereTessellatorType::Pointer SphereTessellatorPointer