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

Provides a collection of functions used when working with split and grouped centerlines. More...

#include <vtkvmtkCenterlineUtilities.h>

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

Public Types

typedef vtkObject Superclass

Public Member Functions

virtual int IsA (const char *type)
vtkvmtkCenterlineUtilities * NewInstance () const

Static Public Member Functions

static int IsTypeOf (const char *type)
static vtkvmtkCenterlineUtilities * SafeDownCast (vtkObjectBase *o)
static vtkvmtkCenterlineUtilities * New ()
static vtkIdType GetMaxGroupId (vtkPolyData *centerlines, const char *groupIdsArrayName)
static void GetGroupsIdList (vtkPolyData *centerlines, const char *groupIdsArrayName, vtkIdList *groupIds)
static void GetGroupsIdList (vtkPolyData *centerlines, const char *groupIdsArrayName, const char *blankingArrayName, int blanked, vtkIdList *groupIds)
static void GetNonBlankedGroupsIdList (vtkPolyData *centerlines, const char *groupIdsArrayName, const char *blankingArrayName, vtkIdList *groupIds)
static void GetBlankedGroupsIdList (vtkPolyData *centerlines, const char *groupIdsArrayName, const char *blankingArrayName, vtkIdList *groupIds)
static void GetGroupCellIds (vtkPolyData *centerlines, const char *groupIdsArrayName, vtkIdType groupId, vtkIdList *groupCellIds)
static void GetGroupUniqueCellIds (vtkPolyData *centerlines, const char *groupIdsArrayName, vtkIdType groupId, vtkIdList *groupCellIds)
static void GetCenterlineCellIds (vtkPolyData *centerlines, const char *centerlineIdsArrayName, vtkIdType centerlineId, vtkIdList *centerlineCellIds)
static void GetCenterlineCellIds (vtkPolyData *centerlines, const char *centerlineIdsArrayName, const char *tractIdsArrayName, vtkIdType centerlineId, vtkIdList *centerlineCellIds)
static int IsGroupBlanked (vtkPolyData *centerlines, const char *groupIdsArrayName, const char *blankingArrayName, vtkIdType groupId)
static int IsCellBlanked (vtkPolyData *centerlines, const char *blankingArrayName, vtkIdType cellId)
static void FindAdjacentCenterlineGroupIds (vtkPolyData *centerlines, const char *groupIdsArrayName, const char *centerlineIdsArrayName, const char *tractIdsArrayName, vtkIdType groupId, vtkIdList *upStreamGroupIds, vtkIdList *downStreamGroupIds)
static void InterpolatePoint (vtkPolyData *centerlines, int cellId, int subId, double pcoord, double interpolatedPoint[3])
static void InterpolateTuple (vtkPolyData *centerlines, const char *arrayName, int cellId, int subId, double pcoord, double *interpolatedTuple)
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 void FindMergingPoints (vtkPolyData *centerlines, vtkPoints *mergingPoints, double tolerance)

Protected Member Functions

virtual vtkObjectBase * NewInstanceInternal () const
 vtkvmtkCenterlineUtilities ()
 ~vtkvmtkCenterlineUtilities ()

Detailed Description

Provides a collection of functions used when working with split and grouped centerlines.

Purely a static utility class (never instantiated), providing common query/interpolation helpers on split and grouped centerlines – looking up group/branch cell ids, testing blanking status, walking adjacent branches at a bifurcation, and interpolating point positions/array values at an arbitrary (cellId, subId, pcoord) location along a centerline. Used internally throughout the "branch extractor" family of filters and by higher-level scripts operating on split centerlines.

See also
vtkvmtkCenterlineSplittingAndGroupingFilter

Definition at line 43 of file vtkvmtkCenterlineUtilities.h.

Member Typedef Documentation

◆ Superclass

Definition at line 46 of file vtkvmtkCenterlineUtilities.h.

Constructor & Destructor Documentation

◆ vtkvmtkCenterlineUtilities()

vtkvmtkCenterlineUtilities::vtkvmtkCenterlineUtilities ( )
inlineprotected

Definition at line 153 of file vtkvmtkCenterlineUtilities.h.

153{};

◆ ~vtkvmtkCenterlineUtilities()

vtkvmtkCenterlineUtilities::~vtkvmtkCenterlineUtilities ( )
inlineprotected

Definition at line 154 of file vtkvmtkCenterlineUtilities.h.

154{};

Member Function Documentation

◆ IsTypeOf()

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

◆ IsA()

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

◆ SafeDownCast()

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

◆ NewInstanceInternal()

virtual vtkObjectBase * vtkvmtkCenterlineUtilities::NewInstanceInternal ( ) const
protectedvirtual

◆ NewInstance()

vtkvmtkCenterlineUtilities * vtkvmtkCenterlineUtilities::NewInstance ( ) const

◆ New()

vtkvmtkCenterlineUtilities * vtkvmtkCenterlineUtilities::New ( )
static

◆ GetMaxGroupId()

vtkIdType vtkvmtkCenterlineUtilities::GetMaxGroupId ( vtkPolyData * centerlines,
const char * groupIdsArrayName )
static

Return the highest group id found in the groupIdsArrayName cell data array of centerlines.

Definition at line 35 of file vtkvmtkCenterlineUtilities.cxx.

36{
37 vtkDataArray* groupIdsArray = centerlines->GetCellData()->GetArray(groupIdsArrayName);
38
39 int numberOfCells = centerlines->GetNumberOfCells();
40 vtkIdType maxGroupId = -1;
41
42 int i;
43 for (i=0; i<numberOfCells; i++)
44 {
45 vtkIdType groupId = static_cast<int>(groupIdsArray->GetComponent(i,0));
46 if (groupId > maxGroupId)
47 {
48 maxGroupId = groupId;
49 }
50 }
51
52 return maxGroupId;
53}

◆ GetGroupsIdList() [1/2]

void vtkvmtkCenterlineUtilities::GetGroupsIdList ( vtkPolyData * centerlines,
const char * groupIdsArrayName,
vtkIdList * groupIds )
static

Fill groupIds with the list of all distinct group ids found in the groupIdsArrayName cell data array of centerlines.

Definition at line 87 of file vtkvmtkCenterlineUtilities.cxx.

88{
89 vtkvmtkCenterlineUtilities::GetGroupsIdList(centerlines,groupIdsArrayName,NULL,0,groupIds);
90}
static void GetGroupsIdList(vtkPolyData *centerlines, const char *groupIdsArrayName, vtkIdList *groupIds)

◆ GetGroupsIdList() [2/2]

void vtkvmtkCenterlineUtilities::GetGroupsIdList ( vtkPolyData * centerlines,
const char * groupIdsArrayName,
const char * blankingArrayName,
int blanked,
vtkIdList * groupIds )
static

Fill groupIds with the list of distinct group ids among cells whose blankingArrayName value equals blanked (0 or 1).

Definition at line 55 of file vtkvmtkCenterlineUtilities.cxx.

56{
57 vtkDataArray* groupIdsArray = centerlines->GetCellData()->GetArray(groupIdsArrayName);
58
59 vtkDataArray* blankingArray = NULL;
60
61 if (blankingArrayName)
62 {
63 blankingArray = centerlines->GetCellData()->GetArray(blankingArrayName);
64 }
65
66 int numberOfCells = centerlines->GetNumberOfCells();
67
68 groupIds->Initialize();
69
70 int i;
71 for (i=0; i<numberOfCells; i++)
72 {
73 vtkIdType groupId = static_cast<int>(groupIdsArray->GetComponent(i,0));
74
75 if (blankingArray)
76 {
77 vtkIdType current_blanked = static_cast<int>(blankingArray->GetComponent(i,0));
78 if (blanked != current_blanked)
79 {
80 continue;
81 }
82 }
83 groupIds->InsertUniqueId(groupId);
84 }
85}

◆ GetNonBlankedGroupsIdList()

void vtkvmtkCenterlineUtilities::GetNonBlankedGroupsIdList ( vtkPolyData * centerlines,
const char * groupIdsArrayName,
const char * blankingArrayName,
vtkIdList * groupIds )
static

Fill groupIds with the list of distinct group ids among the non-blanked cells of centerlines.

Definition at line 92 of file vtkvmtkCenterlineUtilities.cxx.

93{
94 vtkvmtkCenterlineUtilities::GetGroupsIdList(centerlines,groupIdsArrayName,blankingArrayName,0,groupIds);
95}

◆ GetBlankedGroupsIdList()

void vtkvmtkCenterlineUtilities::GetBlankedGroupsIdList ( vtkPolyData * centerlines,
const char * groupIdsArrayName,
const char * blankingArrayName,
vtkIdList * groupIds )
static

Fill groupIds with the list of distinct group ids among the blanked cells of centerlines.

Definition at line 97 of file vtkvmtkCenterlineUtilities.cxx.

98{
99 vtkvmtkCenterlineUtilities::GetGroupsIdList(centerlines,groupIdsArrayName,blankingArrayName,1,groupIds);
100}

◆ GetGroupCellIds()

void vtkvmtkCenterlineUtilities::GetGroupCellIds ( vtkPolyData * centerlines,
const char * groupIdsArrayName,
vtkIdType groupId,
vtkIdList * groupCellIds )
static

Fill groupCellIds with the ids of all cells of centerlines belonging to groupId.

Definition at line 102 of file vtkvmtkCenterlineUtilities.cxx.

103{
104 vtkDataArray* groupIdsArray = centerlines->GetCellData()->GetArray(groupIdsArrayName);
105 int numberOfCells = centerlines->GetNumberOfCells();
106
107 groupCellIds->Initialize();
108
109 int i;
110 for (i=0; i<numberOfCells; i++)
111 {
112 vtkIdType current_groupId = static_cast<int>(groupIdsArray->GetComponent(i,0));
113 if (current_groupId != groupId)
114 {
115 continue;
116 }
117 groupCellIds->InsertNextId(i);
118 }
119}

◆ GetGroupUniqueCellIds()

void vtkvmtkCenterlineUtilities::GetGroupUniqueCellIds ( vtkPolyData * centerlines,
const char * groupIdsArrayName,
vtkIdType groupId,
vtkIdList * groupCellIds )
static

Like GetGroupCellIds, but additionally de-duplicates cells that represent the same tract repeated across multiple original centerlines (keeping one representative cell per unique tract).

Definition at line 121 of file vtkvmtkCenterlineUtilities.cxx.

122{
123 vtkDataArray* groupIdsArray = centerlines->GetCellData()->GetArray(groupIdsArrayName);
124 int numberOfCells = centerlines->GetNumberOfCells();
125
126 groupCellIds->Initialize();
127
128 int i;
129 for (i=0; i<numberOfCells; i++)
130 {
131 vtkIdType current_groupId = static_cast<int>(groupIdsArray->GetComponent(i,0));
132 if (current_groupId != groupId)
133 {
134 continue;
135 }
136 int currentNumberOfGroupCellIds = groupCellIds->GetNumberOfIds();
137 bool duplicate = false;
138 int j;
139 for (j=0; j<currentNumberOfGroupCellIds; j++)
140 {
141 double currentCellFirstPoint[3], currentCellLastPoint[3];
142 double cellFirstPoint[3], cellLastPoint[3];
143 vtkCell* cell = centerlines->GetCell(groupCellIds->GetId(j));
144 cell->GetPoints()->GetPoint(0,currentCellFirstPoint);
145 cell->GetPoints()->GetPoint(cell->GetNumberOfPoints()-1,currentCellLastPoint);
146 cell = centerlines->GetCell(i);
147 cell->GetPoints()->GetPoint(0,cellFirstPoint);
148 cell->GetPoints()->GetPoint(cell->GetNumberOfPoints()-1,cellLastPoint);
149 if ((vtkMath::Distance2BetweenPoints(currentCellFirstPoint,cellFirstPoint) < VTK_VMTK_DOUBLE_TOL) &&
150 (vtkMath::Distance2BetweenPoints(currentCellLastPoint,cellLastPoint) < VTK_VMTK_DOUBLE_TOL))
151 {
152 duplicate = true;
153 break;
154 }
155 }
156 if (duplicate)
157 {
158 continue;
159 }
160 groupCellIds->InsertNextId(i);
161 }
162}
#define VTK_VMTK_DOUBLE_TOL

◆ GetCenterlineCellIds() [1/2]

void vtkvmtkCenterlineUtilities::GetCenterlineCellIds ( vtkPolyData * centerlines,
const char * centerlineIdsArrayName,
vtkIdType centerlineId,
vtkIdList * centerlineCellIds )
static

Fill centerlineCellIds with the ids of all cells of centerlines belonging to the original, unsplit centerline centerlineId.

Definition at line 164 of file vtkvmtkCenterlineUtilities.cxx.

165{
166 vtkDataArray* centerlineIdsArray = centerlines->GetCellData()->GetArray(centerlineIdsArrayName);
167 int numberOfCells = centerlines->GetNumberOfCells();
168
169 centerlineCellIds->Initialize();
170
171 int i;
172 for (i=0; i<numberOfCells; i++)
173 {
174 vtkIdType currentCenterlineId = static_cast<int>(centerlineIdsArray->GetComponent(i,0));
175 if (currentCenterlineId != centerlineId)
176 {
177 continue;
178 }
179 centerlineCellIds->InsertNextId(i);
180 }
181}

◆ GetCenterlineCellIds() [2/2]

void vtkvmtkCenterlineUtilities::GetCenterlineCellIds ( vtkPolyData * centerlines,
const char * centerlineIdsArrayName,
const char * tractIdsArrayName,
vtkIdType centerlineId,
vtkIdList * centerlineCellIds )
static

Like the two-array overload, but also sorts/filters the result using tractIdsArrayName so that cells come back in tract order along the original centerline.

Definition at line 183 of file vtkvmtkCenterlineUtilities.cxx.

184{
185 vtkDataArray* centerlineIdsArray = centerlines->GetCellData()->GetArray(centerlineIdsArrayName);
186 vtkDataArray* tractIdsArray = centerlines->GetCellData()->GetArray(tractIdsArrayName);
187 int numberOfCells = centerlines->GetNumberOfCells();
188
189 centerlineCellIds->Initialize();
190 vtkIdList* centerlineTractIds = vtkIdList::New();
191
192 int i;
193 for (i=0; i<numberOfCells; i++)
194 {
195 vtkIdType currentCenterlineId = static_cast<int>(centerlineIdsArray->GetComponent(i,0));
196 if (currentCenterlineId != centerlineId)
197 {
198 continue;
199 }
200 centerlineCellIds->InsertNextId(i);
201 vtkIdType currectTractId = static_cast<int>(tractIdsArray->GetComponent(i,0));
202 centerlineTractIds->InsertNextId(currectTractId);
203 }
204
205 int numberOfCenterlineCellIds = centerlineCellIds->GetNumberOfIds();
206
207 bool done = false;
208 while (!done)
209 {
210 done = true;
211 for (i=0; i<numberOfCenterlineCellIds-1; i++)
212 {
213 if (centerlineTractIds->GetId(i) > centerlineTractIds->GetId(i+1))
214 {
215 vtkIdType tmp = centerlineTractIds->GetId(i+1);
216 centerlineTractIds->SetId(i+1,centerlineTractIds->GetId(i));
217 centerlineTractIds->SetId(i,tmp);
218 tmp = centerlineCellIds->GetId(i+1);
219 centerlineCellIds->SetId(i+1,centerlineCellIds->GetId(i));
220 centerlineCellIds->SetId(i,tmp);
221 done = false;
222 }
223 }
224 }
225
226 centerlineTractIds->Delete();
227}

◆ IsGroupBlanked()

int vtkvmtkCenterlineUtilities::IsGroupBlanked ( vtkPolyData * centerlines,
const char * groupIdsArrayName,
const char * blankingArrayName,
vtkIdType groupId )
static

Return non-zero if every cell of group groupId is marked blanked in the blankingArrayName cell data array.

Definition at line 229 of file vtkvmtkCenterlineUtilities.cxx.

230{
231 vtkDataArray* groupIdsArray = centerlines->GetCellData()->GetArray(groupIdsArrayName);
232 int numberOfCells = centerlines->GetNumberOfCells();
233
234 vtkIdType cellId = -1;
235 int i;
236 for (i=0; i<numberOfCells; i++)
237 {
238 vtkIdType current_groupId = static_cast<int>(groupIdsArray->GetComponent(i,0));
239 if (current_groupId != groupId)
240 {
241 continue;
242 }
243 cellId = i;
244 break;
245 }
246
247 if (cellId == -1)
248 {
249 return -1;
250 }
251
252 return vtkvmtkCenterlineUtilities::IsCellBlanked(centerlines,blankingArrayName,cellId);
253}
static int IsCellBlanked(vtkPolyData *centerlines, const char *blankingArrayName, vtkIdType cellId)

◆ IsCellBlanked()

int vtkvmtkCenterlineUtilities::IsCellBlanked ( vtkPolyData * centerlines,
const char * blankingArrayName,
vtkIdType cellId )
static

Return the blankingArrayName value (0 or non-zero) of the given cell.

Definition at line 255 of file vtkvmtkCenterlineUtilities.cxx.

256{
257 vtkDataArray* blankingArray = centerlines->GetCellData()->GetArray(blankingArrayName);
258 int blanking = static_cast<int>(blankingArray->GetComponent(cellId,0));
259 int isBlanked = blanking == 1 ? 1 : 0;
260 return isBlanked;
261}

◆ FindAdjacentCenterlineGroupIds()

void vtkvmtkCenterlineUtilities::FindAdjacentCenterlineGroupIds ( vtkPolyData * centerlines,
const char * groupIdsArrayName,
const char * centerlineIdsArrayName,
const char * tractIdsArrayName,
vtkIdType groupId,
vtkIdList * upStreamGroupIds,
vtkIdList * downStreamGroupIds )
static

Fill upStreamGroupIds and downStreamGroupIds with the group ids immediately upstream and downstream, respectively, of groupId along each original centerline passing through it.

Definition at line 263 of file vtkvmtkCenterlineUtilities.cxx.

264{
265 upStreamGroupIds->Initialize();
266 downStreamGroupIds->Initialize();
267
268 vtkDataArray* centerlineGroupIdsArray = centerlines->GetCellData()->GetArray(groupIdsArrayName);
269 vtkDataArray* centerlineIdsArray = centerlines->GetCellData()->GetArray(centerlineIdsArrayName);
270 vtkDataArray* centerlineTractIdsArray = centerlines->GetCellData()->GetArray(tractIdsArrayName);
271
272 int numberOfCenterlineCells = centerlines->GetNumberOfCells();
273
274 int i;
275 for (i=0; i<numberOfCenterlineCells; i++)
276 {
277 vtkIdType branchGroupId = static_cast<int>(centerlineGroupIdsArray->GetComponent(i,0));
278
279 if (branchGroupId != groupId)
280 {
281 continue;
282 }
283
284 vtkCell* centerlineBranch = centerlines->GetCell(i);
285 if (centerlineBranch->GetCellType() != VTK_LINE && centerlineBranch->GetCellType() != VTK_POLY_LINE)
286 {
287 continue;
288 }
289
290 vtkIdType branchCenterlineId = static_cast<int>(centerlineIdsArray->GetComponent(i,0));
291 vtkIdType branchCenterlineTractId = static_cast<int>(centerlineTractIdsArray->GetComponent(i,0));
292
293 int j;
294 for (j=0; j<numberOfCenterlineCells; j++)
295 {
296 vtkIdType currentBranchCenterlineGroupId = static_cast<int>(centerlineGroupIdsArray->GetComponent(j,0));
297 vtkIdType currentBranchCenterlineId = static_cast<int>(centerlineIdsArray->GetComponent(j,0));
298 vtkIdType currentBranchCenterlineTractId = static_cast<int>(centerlineTractIdsArray->GetComponent(j,0));
299
300 if (currentBranchCenterlineGroupId == branchGroupId)
301 {
302 continue;
303 }
304
305 if (currentBranchCenterlineId != branchCenterlineId)
306 {
307 continue;
308 }
309
310 //WARNING: this assumes that tract ids are adjacent
311 if (currentBranchCenterlineTractId == branchCenterlineTractId - 1)
312 {
313 upStreamGroupIds->InsertUniqueId(currentBranchCenterlineGroupId);
314 }
315
316 if (currentBranchCenterlineTractId == branchCenterlineTractId + 1)
317 {
318 downStreamGroupIds->InsertUniqueId(currentBranchCenterlineGroupId);
319 }
320 }
321 }
322}

◆ InterpolatePoint()

void vtkvmtkCenterlineUtilities::InterpolatePoint ( vtkPolyData * centerlines,
int cellId,
int subId,
double pcoord,
double interpolatedPoint[3] )
static

Compute the (x,y,z) position at the given parametric location (cellId, subId, pcoord) along centerlines, linearly interpolated between the segment's two endpoints.

Definition at line 324 of file vtkvmtkCenterlineUtilities.cxx.

325{
326 double point0[3], point1[3];
327 vtkPoints* centerlineCellPoints = centerlines->GetCell(cellId)->GetPoints();
328 centerlineCellPoints->GetPoint(subId,point0);
329 centerlineCellPoints->GetPoint(subId+1,point1);
330
331 interpolatedPoint[0] = (1.0 - pcoord) * point0[0] + pcoord * point1[0];
332 interpolatedPoint[1] = (1.0 - pcoord) * point0[1] + pcoord * point1[1];
333 interpolatedPoint[2] = (1.0 - pcoord) * point0[2] + pcoord * point1[2];
334}

◆ InterpolateTuple()

void vtkvmtkCenterlineUtilities::InterpolateTuple ( vtkPolyData * centerlines,
const char * arrayName,
int cellId,
int subId,
double pcoord,
double * interpolatedTuple )
static

Linearly interpolate the point data array arrayName of centerlines at the given parametric location (cellId, subId, pcoord), writing the result (one value per array component) into interpolatedTuple.

Definition at line 336 of file vtkvmtkCenterlineUtilities.cxx.

337{
338 vtkDataArray* array = centerlines->GetPointData()->GetArray(arrayName);
339 int numberOfComponents = array->GetNumberOfComponents();
340 vtkIdType pointId0 = centerlines->GetCell(cellId)->GetPointId(subId);
341 vtkIdType pointId1 = centerlines->GetCell(cellId)->GetPointId(subId+1);
342 double* tuple0 = array->GetTuple(pointId0);
343 double* tuple1 = array->GetTuple(pointId1);
344
345 int i;
346 for (i=0; i<numberOfComponents; i++)
347 {
348 interpolatedTuple[i] = (1.0 - pcoord) * tuple0[i] + pcoord * tuple1[i];
349 }
350}

◆ InterpolateTuple1()

void vtkvmtkCenterlineUtilities::InterpolateTuple1 ( vtkPolyData * centerlines,
const char * arrayName,
int cellId,
int subId,
double pcoord,
double & interpolatedTuple1 )
inlinestatic

Convenience overload of InterpolateTuple for single-component (scalar) arrays.

Definition at line 133 of file vtkvmtkCenterlineUtilities.h.

134 {
135 InterpolateTuple(centerlines,arrayName,cellId,subId,pcoord,&interpolatedTuple1);
136 }
static void InterpolateTuple(vtkPolyData *centerlines, const char *arrayName, int cellId, int subId, double pcoord, double *interpolatedTuple)

◆ InterpolateTuple3()

void vtkvmtkCenterlineUtilities::InterpolateTuple3 ( vtkPolyData * centerlines,
const char * arrayName,
int cellId,
int subId,
double pcoord,
double interpolatedTuple3[3] )
inlinestatic

Convenience overload of InterpolateTuple for 3-component (vector) arrays.

Definition at line 141 of file vtkvmtkCenterlineUtilities.h.

142 {
143 InterpolateTuple(centerlines,arrayName,cellId,subId,pcoord,interpolatedTuple3);
144 }

◆ FindMergingPoints()

void vtkvmtkCenterlineUtilities::FindMergingPoints ( vtkPolyData * centerlines,
vtkPoints * mergingPoints,
double tolerance = 1E-8 )
static

Find points shared (within tolerance) by more than one cell of centerlines – typically bifurcation points where multiple branches meet – and append them to mergingPoints.

Definition at line 352 of file vtkvmtkCenterlineUtilities.cxx.

353{
354 mergingPoints->Initialize();
355 int numberOfCells = centerlines->GetNumberOfCells();
356 int i, j, k;
357 for (i=0; i<numberOfCells; i++)
358 {
359 vtkCell* centerline = centerlines->GetCell(i);
360 int numberOfCenterlinePoints = centerline->GetNumberOfPoints();
361 int previousMergeStatus = -1;
362 int mergeStatus = -1;
363 for (j=0; j<numberOfCenterlinePoints; j++)
364 {
365 double point[3];
366 centerline->GetPoints()->GetPoint(j,point);
367 for (k=i+1; k<numberOfCells; k++)
368 {
369 vtkCell* currentCenterline = centerlines->GetCell(k);
370 int numberOfCurrentCenterlinePoints = currentCenterline->GetNumberOfPoints();
371 double closestPoint[3];
372 int subId;
373 double pcoords[3];
374 double dist2;
375 double* weights = new double[numberOfCurrentCenterlinePoints];
376 currentCenterline->EvaluatePosition(point,closestPoint,subId,pcoords,dist2,weights);
377 if (dist2 < tolerance*tolerance)
378 {
379 mergeStatus = 1;
380 }
381 else
382 {
383 mergeStatus = 0;
384 }
385 if (j>0 && mergeStatus != previousMergeStatus)
386 {
387 mergingPoints->InsertNextPoint(point);
388 previousMergeStatus = mergeStatus;
389 }
390 delete[] weights;
391 }
392 }
393 }
394}

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