VMTK
Loading...
Searching...
No Matches
vtkvmtkPolyDataHarmonicMappingFilter Class Reference

Construct a harmonic function over each vascular surface segment used during mapping order to stretch the longitudinal metric to correctly account for the presence of insertion regions at bifurcations. More...

#include <vtkvmtkPolyDataHarmonicMappingFilter.h>

Inheritance diagram for vtkvmtkPolyDataHarmonicMappingFilter:
[legend]
Collaboration diagram for vtkvmtkPolyDataHarmonicMappingFilter:
[legend]

Public Types

enum  { VTK_VMTK_ASSEMBLY_STENCILS , VTK_VMTK_ASSEMBLY_FINITEELEMENTS }
typedef vtkPolyDataAlgorithm Superclass

Public Member Functions

virtual int IsA (const char *type)
vtkvmtkPolyDataHarmonicMappingFilter * NewInstance () const
virtual void SetBoundaryPointIds (vtkIdList *)
virtual vtkIdList * GetBoundaryPointIds ()
virtual void SetBoundaryValues (vtkDoubleArray *)
virtual vtkDoubleArray * GetBoundaryValues ()
virtual void SetHarmonicMappingArrayName (const char *)
virtual char * GetHarmonicMappingArrayName ()
virtual void SetConvergenceTolerance (double)
virtual double GetConvergenceTolerance ()
virtual void SetAssemblyMode (int)
virtual int GetAssemblyMode ()
void SetAssemblyModeToStencils ()
void SetAssemblyModeToFiniteElements ()
virtual void SetQuadratureOrder (int)
virtual int GetQuadratureOrder ()

Static Public Member Functions

static vtkvmtkPolyDataHarmonicMappingFilter * New ()
static int IsTypeOf (const char *type)
static vtkvmtkPolyDataHarmonicMappingFilter * SafeDownCast (vtkObjectBase *o)

Protected Member Functions

virtual vtkObjectBase * NewInstanceInternal () const
 vtkvmtkPolyDataHarmonicMappingFilter ()
 ~vtkvmtkPolyDataHarmonicMappingFilter ()
virtual int RequestData (vtkInformation *, vtkInformationVector **, vtkInformationVector *) override

Protected Attributes

vtkIdList * BoundaryPointIds
vtkDoubleArray * BoundaryValues
char * HarmonicMappingArrayName
double ConvergenceTolerance
int AssemblyMode
int QuadratureOrder

Detailed Description

Construct a harmonic function over each vascular surface segment used during mapping order to stretch the longitudinal metric to correctly account for the presence of insertion regions at bifurcations.

vtkvmtkPolyDataHarmonicMappingFilter solves a discrete Laplace (harmonic) boundary value problem on the input surface: the linear system (either assembled with stencils, via vtkvmtkStencils using the finite-element Laplace-Beltrami stencil, or with true piecewise-linear finite elements, via vtkvmtkPolyDataFELaplaceAssembler, according to AssemblyMode) is subjected to Dirichlet boundary conditions (vtkvmtkDirichletBoundaryConditions) that pin the points listed in BoundaryPointIds to the corresponding values in BoundaryValues, then solved with vtkvmtkOpenNLLinearSystemSolver (conjugate gradient, tolerance ConvergenceTolerance). The resulting harmonic scalar field is written to the output as a point data array named HarmonicMappingArrayName. This is the core computation behind vtkvmtkPolyDataCylinderHarmonicMappingFilter, and more generally is used to build smooth surface parameterizations (e.g. longitudinal position along a vessel segment) that remain well behaved near non-planar boundaries such as bifurcation insertion regions.

See also
vtkvmtkPolyDataCylinderHarmonicMappingFilter, vtkvmtkPolyDataFELaplaceAssembler, vtkvmtkOpenNLLinearSystemSolver, vtkvmtkStencils

Definition at line 47 of file vtkvmtkPolyDataHarmonicMappingFilter.h.

Member Typedef Documentation

◆ Superclass

Definition at line 51 of file vtkvmtkPolyDataHarmonicMappingFilter.h.

Member Enumeration Documentation

◆ anonymous enum

anonymous enum
Enumerator
VTK_VMTK_ASSEMBLY_STENCILS 
VTK_VMTK_ASSEMBLY_FINITEELEMENTS 

Definition at line 117 of file vtkvmtkPolyDataHarmonicMappingFilter.h.

Constructor & Destructor Documentation

◆ vtkvmtkPolyDataHarmonicMappingFilter()

◆ ~vtkvmtkPolyDataHarmonicMappingFilter()

vtkvmtkPolyDataHarmonicMappingFilter::~vtkvmtkPolyDataHarmonicMappingFilter ( )
protected

Definition at line 53 of file vtkvmtkPolyDataHarmonicMappingFilter.cxx.

54{
55 if (this->BoundaryPointIds)
56 {
57 this->BoundaryPointIds->Delete();
58 this->BoundaryPointIds = NULL;
59 }
60
61 if (this->BoundaryValues)
62 {
63 this->BoundaryValues->Delete();
64 this->BoundaryValues = NULL;
65 }
66
68 {
69 delete[] this->HarmonicMappingArrayName;
70 this->HarmonicMappingArrayName = NULL;
71 }
72}

Member Function Documentation

◆ New()

vtkvmtkPolyDataHarmonicMappingFilter * vtkvmtkPolyDataHarmonicMappingFilter::New ( )
static

◆ IsTypeOf()

int vtkvmtkPolyDataHarmonicMappingFilter::IsTypeOf ( const char * type)
static

◆ IsA()

virtual int vtkvmtkPolyDataHarmonicMappingFilter::IsA ( const char * type)
virtual

◆ SafeDownCast()

vtkvmtkPolyDataHarmonicMappingFilter * vtkvmtkPolyDataHarmonicMappingFilter::SafeDownCast ( vtkObjectBase * o)
static

◆ NewInstanceInternal()

virtual vtkObjectBase * vtkvmtkPolyDataHarmonicMappingFilter::NewInstanceInternal ( ) const
protectedvirtual

◆ NewInstance()

vtkvmtkPolyDataHarmonicMappingFilter * vtkvmtkPolyDataHarmonicMappingFilter::NewInstance ( ) const

◆ SetBoundaryPointIds()

virtual void vtkvmtkPolyDataHarmonicMappingFilter::SetBoundaryPointIds ( vtkIdList * )
virtual

Set/get the ids, into the input poly data, of the points on which a Dirichlet boundary condition is imposed (the corresponding values are taken from BoundaryValues, matched by index). Must be set, together with BoundaryValues, before Update() is called.

◆ GetBoundaryPointIds()

virtual vtkIdList * vtkvmtkPolyDataHarmonicMappingFilter::GetBoundaryPointIds ( )
virtual

Set/get the ids, into the input poly data, of the points on which a Dirichlet boundary condition is imposed (the corresponding values are taken from BoundaryValues, matched by index). Must be set, together with BoundaryValues, before Update() is called.

◆ SetBoundaryValues()

virtual void vtkvmtkPolyDataHarmonicMappingFilter::SetBoundaryValues ( vtkDoubleArray * )
virtual

Set/get the harmonic function value imposed at each point listed in BoundaryPointIds (matched by index). Must be set, together with BoundaryPointIds, before Update() is called.

◆ GetBoundaryValues()

virtual vtkDoubleArray * vtkvmtkPolyDataHarmonicMappingFilter::GetBoundaryValues ( )
virtual

Set/get the harmonic function value imposed at each point listed in BoundaryPointIds (matched by index). Must be set, together with BoundaryPointIds, before Update() is called.

◆ SetHarmonicMappingArrayName()

virtual void vtkvmtkPolyDataHarmonicMappingFilter::SetHarmonicMappingArrayName ( const char * )
virtual

Set/get the name of the point data array where the computed harmonic scalar field is stored on the output. Must be set before Update() is called. Commonly named "HarmonicMapping".

◆ GetHarmonicMappingArrayName()

virtual char * vtkvmtkPolyDataHarmonicMappingFilter::GetHarmonicMappingArrayName ( )
virtual

Set/get the name of the point data array where the computed harmonic scalar field is stored on the output. Must be set before Update() is called. Commonly named "HarmonicMapping".

◆ SetConvergenceTolerance()

virtual void vtkvmtkPolyDataHarmonicMappingFilter::SetConvergenceTolerance ( double )
virtual

Set/get the convergence tolerance of the iterative linear solver (see vtkvmtkOpenNLLinearSystemSolver) used to solve the harmonic problem. Default: 1E-6.

◆ GetConvergenceTolerance()

virtual double vtkvmtkPolyDataHarmonicMappingFilter::GetConvergenceTolerance ( )
virtual

Set/get the convergence tolerance of the iterative linear solver (see vtkvmtkOpenNLLinearSystemSolver) used to solve the harmonic problem. Default: 1E-6.

◆ SetAssemblyMode()

virtual void vtkvmtkPolyDataHarmonicMappingFilter::SetAssemblyMode ( int )
virtual

Set/get how the discrete Laplace system is assembled: VTK_VMTK_ASSEMBLY_STENCILS uses the finite-element Laplace-Beltrami stencil (via vtkvmtkStencils); VTK_VMTK_ASSEMBLY_FINITEELEMENTS (the default) uses true piecewise-linear finite elements (via vtkvmtkPolyDataFELaplaceAssembler, with quadrature order QuadratureOrder).

◆ GetAssemblyMode()

virtual int vtkvmtkPolyDataHarmonicMappingFilter::GetAssemblyMode ( )
virtual

Set/get how the discrete Laplace system is assembled: VTK_VMTK_ASSEMBLY_STENCILS uses the finite-element Laplace-Beltrami stencil (via vtkvmtkStencils); VTK_VMTK_ASSEMBLY_FINITEELEMENTS (the default) uses true piecewise-linear finite elements (via vtkvmtkPolyDataFELaplaceAssembler, with quadrature order QuadratureOrder).

◆ SetAssemblyModeToStencils()

void vtkvmtkPolyDataHarmonicMappingFilter::SetAssemblyModeToStencils ( )
inline

Set/get how the discrete Laplace system is assembled: VTK_VMTK_ASSEMBLY_STENCILS uses the finite-element Laplace-Beltrami stencil (via vtkvmtkStencils); VTK_VMTK_ASSEMBLY_FINITEELEMENTS (the default) uses true piecewise-linear finite elements (via vtkvmtkPolyDataFELaplaceAssembler, with quadrature order QuadratureOrder).

Definition at line 100 of file vtkvmtkPolyDataHarmonicMappingFilter.h.

◆ SetAssemblyModeToFiniteElements()

void vtkvmtkPolyDataHarmonicMappingFilter::SetAssemblyModeToFiniteElements ( )
inline

Set/get how the discrete Laplace system is assembled: VTK_VMTK_ASSEMBLY_STENCILS uses the finite-element Laplace-Beltrami stencil (via vtkvmtkStencils); VTK_VMTK_ASSEMBLY_FINITEELEMENTS (the default) uses true piecewise-linear finite elements (via vtkvmtkPolyDataFELaplaceAssembler, with quadrature order QuadratureOrder).

Definition at line 102 of file vtkvmtkPolyDataHarmonicMappingFilter.h.

◆ SetQuadratureOrder()

virtual void vtkvmtkPolyDataHarmonicMappingFilter::SetQuadratureOrder ( int )
virtual

Set/get the order of the Gauss quadrature rule used to integrate the finite-element matrix when AssemblyMode is VTK_VMTK_ASSEMBLY_FINITEELEMENTS. Default: 1.

◆ GetQuadratureOrder()

virtual int vtkvmtkPolyDataHarmonicMappingFilter::GetQuadratureOrder ( )
virtual

Set/get the order of the Gauss quadrature rule used to integrate the finite-element matrix when AssemblyMode is VTK_VMTK_ASSEMBLY_FINITEELEMENTS. Default: 1.

◆ RequestData()

int vtkvmtkPolyDataHarmonicMappingFilter::RequestData ( vtkInformation * ,
vtkInformationVector ** ,
vtkInformationVector *  )
overrideprotectedvirtual

Reimplemented in vtkvmtkPolyDataCylinderHarmonicMappingFilter.

Definition at line 74 of file vtkvmtkPolyDataHarmonicMappingFilter.cxx.

78{
79 vtkInformation *inInfo = inputVector[0]->GetInformationObject(0);
80 vtkInformation *outInfo = outputVector->GetInformationObject(0);
81
82 vtkPolyData *input = vtkPolyData::SafeDownCast(
83 inInfo->Get(vtkDataObject::DATA_OBJECT()));
84 vtkPolyData *output = vtkPolyData::SafeDownCast(
85 outInfo->Get(vtkDataObject::DATA_OBJECT()));
86
87 if (!this->BoundaryPointIds)
88 {
89 vtkErrorMacro(<<"BoundaryPointIds not set.");
90 return 1;
91 }
92
93 if (!this->BoundaryValues)
94 {
95 vtkErrorMacro(<<"BoundaryValues not set.");
96 return 1;
97 }
98
99 if (!this->HarmonicMappingArrayName)
100 {
101 vtkErrorMacro(<<"HarmonicMappingArrayName not set.");
102 return 1;
103 }
104
105 int numberOfInputPoints = input->GetNumberOfPoints();
106
107 vtkvmtkSparseMatrix* sparseMatrix = vtkvmtkSparseMatrix::New();
108
109 vtkvmtkDoubleVector* rhsVector = vtkvmtkDoubleVector::New();
110 rhsVector->SetNormTypeToLInf();
111
112 vtkvmtkDoubleVector* solutionVector = vtkvmtkDoubleVector::New();
113 solutionVector->SetNormTypeToLInf();
114
116 {
117 vtkvmtkStencils* stencils = vtkvmtkStencils::New();
119 stencils->WeightScalingOff();
120 stencils->NegateWeightsOn();
121 stencils->SetDataSet(input);
122 stencils->Build();
123
124 sparseMatrix->CopyRowsFromStencils(stencils);
125 rhsVector->Allocate(numberOfInputPoints);
126 rhsVector->Fill(0.0);
127 solutionVector->Allocate(numberOfInputPoints);
128 solutionVector->Fill(0.0);
129
130 stencils->Delete();
131 }
133 {
134 vtkvmtkPolyDataFELaplaceAssembler* assembler = vtkvmtkPolyDataFELaplaceAssembler::New();
135 assembler->SetDataSet(input);
136 assembler->SetMatrix(sparseMatrix);
137 assembler->SetRHSVector(rhsVector);
138 assembler->SetSolutionVector(solutionVector);
139 assembler->SetQuadratureOrder(this->QuadratureOrder);
140 assembler->Build();
141 assembler->Delete();
142 }
143
144 vtkvmtkLinearSystem* linearSystem = vtkvmtkLinearSystem::New();
145 linearSystem->SetA(sparseMatrix);
146 linearSystem->SetB(rhsVector);
147 linearSystem->SetX(solutionVector);
148
149 //TODO: deal with NumberOfVariables > 1
150 vtkvmtkDirichletBoundaryConditions* dirichetBoundaryConditions = vtkvmtkDirichletBoundaryConditions::New();
151 dirichetBoundaryConditions->SetLinearSystem(linearSystem);
152 dirichetBoundaryConditions->SetBoundaryNodes(this->BoundaryPointIds);
153 dirichetBoundaryConditions->SetBoundaryValues(this->BoundaryValues);
154 dirichetBoundaryConditions->Apply();
155
156 vtkvmtkOpenNLLinearSystemSolver* solver = vtkvmtkOpenNLLinearSystemSolver::New();
157 solver->SetLinearSystem(linearSystem);
159 solver->SetMaximumNumberOfIterations(numberOfInputPoints);
160 solver->SetSolverTypeToCG();
162 solver->Solve();
163
164 vtkDoubleArray* harmonicMappingArray = vtkDoubleArray::New();
165 harmonicMappingArray->SetName(this->HarmonicMappingArrayName);
166 harmonicMappingArray->SetNumberOfComponents(1);
167 harmonicMappingArray->SetNumberOfTuples(numberOfInputPoints);
168
169 solutionVector->CopyIntoArrayComponent(harmonicMappingArray,0);
170
171 output->DeepCopy(input);
172
173 output->GetPointData()->AddArray(harmonicMappingArray);
174
175 solver->Delete();
176 harmonicMappingArray->Delete();
177 sparseMatrix->Delete();
178 rhsVector->Delete();
179 solutionVector->Delete();
180 linearSystem->Delete();
181 dirichetBoundaryConditions->Delete();
182
183 return 1;
184}
virtual void SetBoundaryValues(vtkDoubleArray *)
virtual void SetBoundaryNodes(vtkIdList *)
virtual void SetLinearSystem(vtkvmtkLinearSystem *)
void SetDataSet(vtkDataSet *dataSet)
static vtkvmtkDirichletBoundaryConditions * New()
static vtkvmtkDoubleVector * New()
void CopyIntoArrayComponent(vtkDataArray *array, int component)
void Fill(double value)
void Allocate(vtkIdType numberOfElementsPerVariable, vtkIdType numberOfVariables=1)
virtual void SetSolutionVector(vtkvmtkDoubleVector *)
virtual void SetDataSet(vtkDataSet *)
virtual void SetRHSVector(vtkvmtkDoubleVector *)
virtual void SetMatrix(vtkvmtkSparseMatrix *)
virtual void SetQuadratureOrder(int)
virtual void SetConvergenceTolerance(double)
virtual void SetMaximumNumberOfIterations(int)
virtual void SetLinearSystem(vtkvmtkLinearSystem *)
virtual void SetX(vtkvmtkDoubleVector *)
virtual void SetA(vtkvmtkSparseMatrix *)
virtual void SetB(vtkvmtkDoubleVector *)
static vtkvmtkLinearSystem * New()
static vtkvmtkOpenNLLinearSystemSolver * New()
static vtkvmtkPolyDataFELaplaceAssembler * New()
static vtkvmtkSparseMatrix * New()
void CopyRowsFromStencils(vtkvmtkStencils *stencils)
void SetStencilTypeToFELaplaceBeltramiStencil()
virtual void WeightScalingOff()
virtual void NegateWeightsOn()
static vtkvmtkStencils * New()

Member Data Documentation

◆ BoundaryPointIds

vtkIdList* vtkvmtkPolyDataHarmonicMappingFilter::BoundaryPointIds
protected

Definition at line 130 of file vtkvmtkPolyDataHarmonicMappingFilter.h.

◆ BoundaryValues

vtkDoubleArray* vtkvmtkPolyDataHarmonicMappingFilter::BoundaryValues
protected

Definition at line 131 of file vtkvmtkPolyDataHarmonicMappingFilter.h.

◆ HarmonicMappingArrayName

char* vtkvmtkPolyDataHarmonicMappingFilter::HarmonicMappingArrayName
protected

Definition at line 133 of file vtkvmtkPolyDataHarmonicMappingFilter.h.

◆ ConvergenceTolerance

double vtkvmtkPolyDataHarmonicMappingFilter::ConvergenceTolerance
protected

Definition at line 134 of file vtkvmtkPolyDataHarmonicMappingFilter.h.

◆ AssemblyMode

int vtkvmtkPolyDataHarmonicMappingFilter::AssemblyMode
protected

Definition at line 135 of file vtkvmtkPolyDataHarmonicMappingFilter.h.

◆ QuadratureOrder

int vtkvmtkPolyDataHarmonicMappingFilter::QuadratureOrder
protected

Definition at line 136 of file vtkvmtkPolyDataHarmonicMappingFilter.h.


The documentation for this class was generated from the following files: