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

Create an angular metric array on each branch of a split surface representing the periodic circumferential coordinate of mesh points around the centerlines. More...

#include <vtkvmtkPolyDataCenterlineAngularMetricFilter.h>

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

Public Types

typedef vtkvmtkPolyDataCenterlineMetricFilter Superclass
Public Types inherited from vtkvmtkPolyDataCenterlineMetricFilter
typedef vtkPolyDataAlgorithm Superclass

Public Member Functions

virtual int IsA (const char *type)
vtkvmtkPolyDataCenterlineAngularMetricFilter * NewInstance () const
virtual void SetCenterlineNormalsArrayName (const char *)
virtual char * GetCenterlineNormalsArrayName ()
Public Member Functions inherited from vtkvmtkPolyDataCenterlineMetricFilter
vtkvmtkPolyDataCenterlineMetricFilter * NewInstance () const
virtual void SetMetricArrayName (const char *)
virtual char * GetMetricArrayName ()
virtual void SetGroupIdsArrayName (const char *)
virtual char * GetGroupIdsArrayName ()
virtual void SetCenterlines (vtkPolyData *)
virtual vtkPolyData * GetCenterlines ()
virtual void SetUseRadiusInformation (int)
virtual int GetUseRadiusInformation ()
virtual void UseRadiusInformationOn ()
virtual void UseRadiusInformationOff ()
virtual void SetRadiusArrayName (const char *)
virtual char * GetRadiusArrayName ()
virtual void SetCenterlineGroupIdsArrayName (const char *)
virtual char * GetCenterlineGroupIdsArrayName ()
virtual void SetCenterlineIdsArrayName (const char *)
virtual char * GetCenterlineIdsArrayName ()
virtual void SetCenterlineTractIdsArrayName (const char *)
virtual char * GetCenterlineTractIdsArrayName ()
virtual void SetBlankingArrayName (const char *)
virtual char * GetBlankingArrayName ()
virtual void SetIncludeBifurcations (int)
virtual int GetIncludeBifurcations ()
virtual void IncludeBifurcationsOn ()
virtual void IncludeBifurcationsOff ()

Static Public Member Functions

static vtkvmtkPolyDataCenterlineAngularMetricFilter * New ()
static int IsTypeOf (const char *type)
static vtkvmtkPolyDataCenterlineAngularMetricFilter * SafeDownCast (vtkObjectBase *o)
Static Public Member Functions inherited from vtkvmtkPolyDataCenterlineMetricFilter
static int IsTypeOf (const char *type)
static vtkvmtkPolyDataCenterlineMetricFilter * SafeDownCast (vtkObjectBase *o)

Protected Member Functions

virtual vtkObjectBase * NewInstanceInternal () const
 vtkvmtkPolyDataCenterlineAngularMetricFilter ()
 ~vtkvmtkPolyDataCenterlineAngularMetricFilter ()
virtual void EvaluateMetric (vtkIdType pointId, double point[3], vtkIdType groupId, vtkDataArray *metricArray) override
Protected Member Functions inherited from vtkvmtkPolyDataCenterlineMetricFilter
 vtkvmtkPolyDataCenterlineMetricFilter ()
 ~vtkvmtkPolyDataCenterlineMetricFilter ()
virtual int RequestData (vtkInformation *, vtkInformationVector **, vtkInformationVector *) override

Protected Attributes

char * CenterlineNormalsArrayName
Protected Attributes inherited from vtkvmtkPolyDataCenterlineMetricFilter
char * MetricArrayName
char * BlankingArrayName
char * GroupIdsArrayName
vtkPolyData * Centerlines
char * RadiusArrayName
char * CenterlineGroupIdsArrayName
char * CenterlineIdsArrayName
char * CenterlineTractIdsArrayName
int UseRadiusInformation
int IncludeBifurcations

Detailed Description

Create an angular metric array on each branch of a split surface representing the periodic circumferential coordinate of mesh points around the centerlines.

Briefly, each segment of a vascular network is topologically equivalent to a cylinder and can consequently be mapped onto a rectangular parametric space that allows both easier investigations and comparisons between different models and datasets. The parameterization is performed longitudinally by means of the curvilinear abscissa computed over the model centerlines and circumferentially, by the angular position of each point on the surface mesh with respect to the centerlines.

Requires Centerlines to already carry a parallel transport normal point data array (see vtkvmtkCenterlineAttributesFilter), used as the zero-angle reference direction at each centerline point. This is the "circumferential" half of the vmtkbranchmetrics pype script.

See also
vtkvmtkPolyDataCenterlineMetricFilter, vtkvmtkPolyDataCenterlineAbscissaMetricFilter, vtkvmtkCenterlineAttributesFilter

Definition at line 42 of file vtkvmtkPolyDataCenterlineAngularMetricFilter.h.

Member Typedef Documentation

◆ Superclass

Constructor & Destructor Documentation

◆ vtkvmtkPolyDataCenterlineAngularMetricFilter()

vtkvmtkPolyDataCenterlineAngularMetricFilter::vtkvmtkPolyDataCenterlineAngularMetricFilter ( )
protected

◆ ~vtkvmtkPolyDataCenterlineAngularMetricFilter()

vtkvmtkPolyDataCenterlineAngularMetricFilter::~vtkvmtkPolyDataCenterlineAngularMetricFilter ( )
protected

Definition at line 45 of file vtkvmtkPolyDataCenterlineAngularMetricFilter.cxx.

46{
48 {
49 delete[] this->CenterlineNormalsArrayName;
50 this->CenterlineNormalsArrayName = NULL;
51 }
52}

Member Function Documentation

◆ New()

vtkvmtkPolyDataCenterlineAngularMetricFilter * vtkvmtkPolyDataCenterlineAngularMetricFilter::New ( )
static

◆ IsTypeOf()

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

◆ IsA()

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

◆ SafeDownCast()

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

◆ NewInstanceInternal()

virtual vtkObjectBase * vtkvmtkPolyDataCenterlineAngularMetricFilter::NewInstanceInternal ( ) const
protectedvirtual

◆ NewInstance()

vtkvmtkPolyDataCenterlineAngularMetricFilter * vtkvmtkPolyDataCenterlineAngularMetricFilter::NewInstance ( ) const

◆ SetCenterlineNormalsArrayName()

virtual void vtkvmtkPolyDataCenterlineAngularMetricFilter::SetCenterlineNormalsArrayName ( const char * )
virtual

Set/Get the name of the 3-component point data array of Centerlines holding the parallel transport normal used as the zero-angle reference direction. Required input; see vtkvmtkCenterlineAttributesFilter. Commonly named "ParallelTransportNormals".

◆ GetCenterlineNormalsArrayName()

virtual char * vtkvmtkPolyDataCenterlineAngularMetricFilter::GetCenterlineNormalsArrayName ( )
virtual

Set/Get the name of the 3-component point data array of Centerlines holding the parallel transport normal used as the zero-angle reference direction. Required input; see vtkvmtkCenterlineAttributesFilter. Commonly named "ParallelTransportNormals".

◆ EvaluateMetric()

void vtkvmtkPolyDataCenterlineAngularMetricFilter::EvaluateMetric ( vtkIdType pointId,
double point[3],
vtkIdType groupId,
vtkDataArray * metricArray )
overrideprotectedvirtual

Implements vtkvmtkPolyDataCenterlineMetricFilter.

Definition at line 54 of file vtkvmtkPolyDataCenterlineAngularMetricFilter.cxx.

55{
56 vtkDataArray* centerlineGroupIdsArray = this->Centerlines->GetCellData()->GetArray(this->CenterlineGroupIdsArrayName);
57 vtkDataArray* centerlineTractIdsArray = this->Centerlines->GetCellData()->GetArray(this->CenterlineTractIdsArrayName);
58 vtkDataArray* blankingArray = this->Centerlines->GetCellData()->GetArray(this->BlankingArrayName);
59 vtkDataArray* centerlineIdsArray = this->Centerlines->GetCellData()->GetArray(this->CenterlineIdsArrayName);
60
61 vtkvmtkPolyBallLine* tube = vtkvmtkPolyBallLine::New();
62 vtkIdList* centerlineGroupCellIds = vtkIdList::New();
63
64 tube->SetInput(this->Centerlines);
65 tube->SetInputCellIds(centerlineGroupCellIds);
68
69 double averagePoint[3];
70 averagePoint[0] = averagePoint[1] = averagePoint[2] = 0.0;
71 double averageNormal[3];
72 averageNormal[0] = averageNormal[1] = averageNormal[2] = 0.0;
73 double averageTangent[3];
74 averageTangent[0] = averageTangent[1] = averageTangent[2] = 0.0;
75 double weightSum = 0.0;
76
77 int numberOfCenterlineCells = this->Centerlines->GetNumberOfCells();
78 for (int i=0; i<numberOfCenterlineCells; i++)
79 {
80 int centerlineGroupId = static_cast<int>(centerlineGroupIdsArray->GetComponent(i,0));
81 if (centerlineGroupId != groupId)
82 {
83 continue;
84 }
85
86 centerlineGroupCellIds->Initialize();
87 centerlineGroupCellIds->InsertNextId(i);
88
89 if (this->IncludeBifurcations)
90 {
91 int centerlineId = static_cast<int>(centerlineIdsArray->GetComponent(i,0));
92 int centerlineTractId = static_cast<int>(centerlineTractIdsArray->GetComponent(i,0));
93
94 for (int j=0; j<numberOfCenterlineCells; j++)
95 {
96 if (j==i)
97 {
98 continue;
99 }
100
101 int adjacentCenterlineGroupId = static_cast<int>(centerlineGroupIdsArray->GetComponent(j,0));
102 int adjacentCenterlineId = static_cast<int>(centerlineIdsArray->GetComponent(j,0));
103 int adjacentCenterlineTractId = static_cast<int>(centerlineTractIdsArray->GetComponent(j,0));
104 int adjacentBlanking = static_cast<int>(blankingArray->GetComponent(j,0));
105
106 if (adjacentBlanking == 0)
107 {
108 continue;
109 }
110
111 if (adjacentCenterlineGroupId == centerlineGroupId)
112 {
113 continue;
114 }
115
116 if (adjacentCenterlineId != centerlineId)
117 {
118 continue;
119 }
120
121 if (!((adjacentCenterlineTractId == centerlineTractId - 1) ||
122 (adjacentCenterlineTractId == centerlineTractId + 1)))
123 {
124 continue;
125 }
126
127 centerlineGroupCellIds->InsertNextId(j);
128 }
129 }
130
131 tube->EvaluateFunction(point);
132
133 vtkIdType centerlineCellId = tube->GetLastPolyBallCellId();
134 vtkIdType centerlineSubId = tube->GetLastPolyBallCellSubId();
135 double centerlinePCoord = tube->GetLastPolyBallCellPCoord();
136
137 vtkCell* polyLine = this->Centerlines->GetCell(centerlineCellId);
138
139 if (polyLine->GetCellType() != VTK_LINE && polyLine->GetCellType() != VTK_POLY_LINE)
140 {
141 continue;
142 }
143
144 double radius = 0.0;
145 vtkvmtkCenterlineUtilities::InterpolateTuple1(this->Centerlines,this->RadiusArrayName,centerlineCellId,centerlineSubId,centerlinePCoord,radius);
146 double weight = radius * radius;
147 double centerlinePoint[3];
148 vtkvmtkCenterlineUtilities::InterpolatePoint(this->Centerlines,centerlineCellId,centerlineSubId,centerlinePCoord,centerlinePoint);
149
150 averagePoint[0] += weight * centerlinePoint[0];
151 averagePoint[1] += weight * centerlinePoint[1];
152 averagePoint[2] += weight * centerlinePoint[2];
153
154 double centerlinePoint0[3], centerlinePoint1[3];
155 polyLine->GetPoints()->GetPoint(centerlineSubId,centerlinePoint0);
156 polyLine->GetPoints()->GetPoint(centerlineSubId+1,centerlinePoint1);
157
158 if (vtkMath::Distance2BetweenPoints(centerlinePoint0,centerlinePoint1) < VTK_VMTK_DOUBLE_TOL)
159 {
160 if (centerlineSubId > 0)
161 {
162 polyLine->GetPoints()->GetPoint(centerlineSubId-1,centerlinePoint0);
163 }
164 else if (centerlineSubId+1 < polyLine->GetNumberOfPoints()-1)
165 {
166 polyLine->GetPoints()->GetPoint(centerlineSubId+2,centerlinePoint1);
167 }
168 }
169
170 double tangent[3];
171 tangent[0] = centerlinePoint1[0] - centerlinePoint0[0];
172 tangent[1] = centerlinePoint1[1] - centerlinePoint0[1];
173 tangent[2] = centerlinePoint1[2] - centerlinePoint0[2];
174
175 averageTangent[0] += weight * tangent[0];
176 averageTangent[1] += weight * tangent[1];
177 averageTangent[2] += weight * tangent[2];
178 double normal[3];
179 vtkvmtkCenterlineUtilities::InterpolateTuple3(this->Centerlines,this->CenterlineNormalsArrayName,centerlineCellId,centerlineSubId,centerlinePCoord,normal);
180
181 averageNormal[0] += weight * normal[0];
182 averageNormal[1] += weight * normal[1];
183 averageNormal[2] += weight * normal[2];
184
185 weightSum += weight;
186 }
187
188 averagePoint[0] /= weightSum;
189 averagePoint[1] /= weightSum;
190 averagePoint[2] /= weightSum;
191 vtkMath::Normalize(averageNormal);
192 vtkMath::Normalize(averageTangent);
193
194 double projectedPoint[3];
195 vtkPlane::ProjectPoint(point,averagePoint,averageTangent,projectedPoint);
196
197 double positionVector[3];
198 positionVector[0] = projectedPoint[0] - averagePoint[0];
199 positionVector[1] = projectedPoint[1] - averagePoint[1];
200 positionVector[2] = projectedPoint[2] - averagePoint[2];
201 vtkMath::Normalize(positionVector);
202
203 double normalPoint[3];
204 normalPoint[0] = averagePoint[0] + averageNormal[0];
205 normalPoint[1] = averagePoint[1] + averageNormal[1];
206 normalPoint[2] = averagePoint[2] + averageNormal[2];
207
208 double projectedNormalPoint[3];
209 vtkPlane::ProjectPoint(normalPoint,averagePoint,averageTangent,projectedNormalPoint);
210
211 double projectedNormal[3];
212 projectedNormal[0] = projectedNormalPoint[0] - averagePoint[0];
213 projectedNormal[1] = projectedNormalPoint[1] - averagePoint[1];
214 projectedNormal[2] = projectedNormalPoint[2] - averagePoint[2];
215 vtkMath::Normalize(projectedNormal);
216
217 double cross[3];
218 vtkMath::Cross(positionVector,projectedNormal,cross);
219
220 double tangentDot = vtkMath::Dot(averageTangent,cross);
221
222 double angle = vtkvmtkMath::AngleBetweenNormals(positionVector,projectedNormal);
223
224 if (tangentDot < 0.0)
225 {
226 angle *= -1.0;
227 }
228
229 metricArray->SetComponent(pointId,0,angle);
230
231 centerlineGroupCellIds->Delete();
232 tube->Delete();
233}
static void InterpolatePoint(vtkPolyData *centerlines, int cellId, int subId, double pcoord, double interpolatedPoint[3])
static void InterpolateTuple1(vtkPolyData *centerlines, const char *arrayName, int cellId, int subId, double pcoord, double &interpolatedTuple1)
static void InterpolateTuple3(vtkPolyData *centerlines, const char *arrayName, int cellId, int subId, double pcoord, double interpolatedTuple3[3])
static double AngleBetweenNormals(double normal0[3], double normal1[3])
virtual double GetLastPolyBallCellPCoord()
virtual void SetInput(vtkPolyData *)
virtual void SetPolyBallRadiusArrayName(const char *)
virtual void SetInputCellIds(vtkIdList *)
virtual void SetUseRadiusInformation(int)
virtual vtkIdType GetLastPolyBallCellId()
static vtkvmtkPolyBallLine * New()
double EvaluateFunction(double x[3]) override
virtual vtkIdType GetLastPolyBallCellSubId()
#define VTK_VMTK_DOUBLE_TOL

Member Data Documentation

◆ CenterlineNormalsArrayName

char* vtkvmtkPolyDataCenterlineAngularMetricFilter::CenterlineNormalsArrayName
protected

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