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

Calculate the minimum Euclidean distance from surface points to a centerline. More...

#include <vtkvmtkPolyDataDistanceToCenterlines.h>

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

Public Types

typedef vtkPolyDataAlgorithm Superclass

Public Member Functions

virtual int IsA (const char *type)
vtkvmtkPolyDataDistanceToCenterlines * NewInstance () const
virtual void SetCenterlines (vtkPolyData *)
virtual vtkPolyData * GetCenterlines ()
virtual void SetUseRadiusInformation (int)
virtual int GetUseRadiusInformation ()
virtual void UseRadiusInformationOn ()
virtual void UseRadiusInformationOff ()
virtual void SetEvaluateTubeFunction (int)
virtual int GetEvaluateTubeFunction ()
virtual void EvaluateTubeFunctionOn ()
virtual void EvaluateTubeFunctionOff ()
virtual void SetEvaluateCenterlineRadius (int)
virtual int GetEvaluateCenterlineRadius ()
virtual void EvaluateCenterlineRadiusOn ()
virtual void EvaluateCenterlineRadiusOff ()
virtual void SetDistanceToCenterlinesArrayName (const char *)
virtual char * GetDistanceToCenterlinesArrayName ()
virtual void SetCenterlineRadiusArrayName (const char *)
virtual char * GetCenterlineRadiusArrayName ()
virtual void SetProjectPointArrays (int)
virtual int GetProjectPointArrays ()
virtual void ProjectPointArraysOn ()
virtual void ProjectPointArraysOff ()

Static Public Member Functions

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

Protected Member Functions

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

Protected Attributes

char * DistanceToCenterlinesArrayName
char * CenterlineRadiusArrayName
vtkPolyData * Centerlines
int UseRadiusInformation
int EvaluateTubeFunction
int EvaluateCenterlineRadius
int ProjectPointArrays

Detailed Description

Calculate the minimum Euclidean distance from surface points to a centerline.

This function has three distinct ways of working: 1) UseRadiusInformation: 1 (default=1) -> Compute the euclidean distance between a surface point and the closest centerline point (based on polyball association). 2) EvaluateTubeFunction: 1 (default=0) -> Compute the euclidean distance between a surface point and the center of the tube function (based on polyball line). 3) EvaluateCenterlineRadius: 1 (default=0) -> Find the centerline point which is closest to a surface point (similar to method 1), and set distance at that surface point to the radius of the sphere associated with the closest centerline point id. By setting ProjectPointArrays: 1 (default=0) -> Project point data from the centerline onto every surface point by linearly interpolating the relative position of the surface point on the line formed by the two closest centerline points.

Definition at line 38 of file vtkvmtkPolyDataDistanceToCenterlines.h.

Member Typedef Documentation

◆ Superclass

Definition at line 42 of file vtkvmtkPolyDataDistanceToCenterlines.h.

Constructor & Destructor Documentation

◆ vtkvmtkPolyDataDistanceToCenterlines()

◆ ~vtkvmtkPolyDataDistanceToCenterlines()

vtkvmtkPolyDataDistanceToCenterlines::~vtkvmtkPolyDataDistanceToCenterlines ( )
protected

Definition at line 48 of file vtkvmtkPolyDataDistanceToCenterlines.cxx.

49{
51 {
52 delete[] this->DistanceToCenterlinesArrayName;
54 }
55
56 if (this->Centerlines)
57 {
58 this->Centerlines->Delete();
59 this->Centerlines = NULL;
60 }
61
63 {
64 delete[] this->CenterlineRadiusArrayName;
65 this->CenterlineRadiusArrayName = NULL;
66 }
67}

Member Function Documentation

◆ New()

vtkvmtkPolyDataDistanceToCenterlines * vtkvmtkPolyDataDistanceToCenterlines::New ( )
static

◆ IsTypeOf()

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

◆ IsA()

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

◆ SafeDownCast()

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

◆ NewInstanceInternal()

virtual vtkObjectBase * vtkvmtkPolyDataDistanceToCenterlines::NewInstanceInternal ( ) const
protectedvirtual

◆ NewInstance()

vtkvmtkPolyDataDistanceToCenterlines * vtkvmtkPolyDataDistanceToCenterlines::NewInstance ( ) const

◆ SetCenterlines()

virtual void vtkvmtkPolyDataDistanceToCenterlines::SetCenterlines ( vtkPolyData * )
virtual

Set/Get the centerlines to measure distance to. Required input.

◆ GetCenterlines()

virtual vtkPolyData * vtkvmtkPolyDataDistanceToCenterlines::GetCenterlines ( )
virtual

Set/Get the centerlines to measure distance to. Required input.

◆ SetUseRadiusInformation()

virtual void vtkvmtkPolyDataDistanceToCenterlines::SetUseRadiusInformation ( int )
virtual

Toggle using the per-point sphere radii (CenterlineRadiusArrayName) when locating the closest centerline point via polyball association, so the search accounts for local vessel size rather than pure Euclidean distance. Default: on. See the class description for how this interacts with EvaluateTubeFunction and EvaluateCenterlineRadius.

◆ GetUseRadiusInformation()

virtual int vtkvmtkPolyDataDistanceToCenterlines::GetUseRadiusInformation ( )
virtual

Toggle using the per-point sphere radii (CenterlineRadiusArrayName) when locating the closest centerline point via polyball association, so the search accounts for local vessel size rather than pure Euclidean distance. Default: on. See the class description for how this interacts with EvaluateTubeFunction and EvaluateCenterlineRadius.

◆ UseRadiusInformationOn()

virtual void vtkvmtkPolyDataDistanceToCenterlines::UseRadiusInformationOn ( )
virtual

Toggle using the per-point sphere radii (CenterlineRadiusArrayName) when locating the closest centerline point via polyball association, so the search accounts for local vessel size rather than pure Euclidean distance. Default: on. See the class description for how this interacts with EvaluateTubeFunction and EvaluateCenterlineRadius.

◆ UseRadiusInformationOff()

virtual void vtkvmtkPolyDataDistanceToCenterlines::UseRadiusInformationOff ( )
virtual

Toggle using the per-point sphere radii (CenterlineRadiusArrayName) when locating the closest centerline point via polyball association, so the search accounts for local vessel size rather than pure Euclidean distance. Default: on. See the class description for how this interacts with EvaluateTubeFunction and EvaluateCenterlineRadius.

◆ SetEvaluateTubeFunction()

virtual void vtkvmtkPolyDataDistanceToCenterlines::SetEvaluateTubeFunction ( int )
virtual

Toggle computing the distance from each surface point to the center of the polyball-line tube function (i.e. the interpolated centerline medial axis) rather than to the nearest discrete centerline point. Default: off.

◆ GetEvaluateTubeFunction()

virtual int vtkvmtkPolyDataDistanceToCenterlines::GetEvaluateTubeFunction ( )
virtual

Toggle computing the distance from each surface point to the center of the polyball-line tube function (i.e. the interpolated centerline medial axis) rather than to the nearest discrete centerline point. Default: off.

◆ EvaluateTubeFunctionOn()

virtual void vtkvmtkPolyDataDistanceToCenterlines::EvaluateTubeFunctionOn ( )
virtual

Toggle computing the distance from each surface point to the center of the polyball-line tube function (i.e. the interpolated centerline medial axis) rather than to the nearest discrete centerline point. Default: off.

◆ EvaluateTubeFunctionOff()

virtual void vtkvmtkPolyDataDistanceToCenterlines::EvaluateTubeFunctionOff ( )
virtual

Toggle computing the distance from each surface point to the center of the polyball-line tube function (i.e. the interpolated centerline medial axis) rather than to the nearest discrete centerline point. Default: off.

◆ SetEvaluateCenterlineRadius()

virtual void vtkvmtkPolyDataDistanceToCenterlines::SetEvaluateCenterlineRadius ( int )
virtual

Toggle outputting, at each surface point, the maximum inscribed sphere radius of the closest centerline point instead of the actual distance to it. Default: off.

◆ GetEvaluateCenterlineRadius()

virtual int vtkvmtkPolyDataDistanceToCenterlines::GetEvaluateCenterlineRadius ( )
virtual

Toggle outputting, at each surface point, the maximum inscribed sphere radius of the closest centerline point instead of the actual distance to it. Default: off.

◆ EvaluateCenterlineRadiusOn()

virtual void vtkvmtkPolyDataDistanceToCenterlines::EvaluateCenterlineRadiusOn ( )
virtual

Toggle outputting, at each surface point, the maximum inscribed sphere radius of the closest centerline point instead of the actual distance to it. Default: off.

◆ EvaluateCenterlineRadiusOff()

virtual void vtkvmtkPolyDataDistanceToCenterlines::EvaluateCenterlineRadiusOff ( )
virtual

Toggle outputting, at each surface point, the maximum inscribed sphere radius of the closest centerline point instead of the actual distance to it. Default: off.

◆ SetDistanceToCenterlinesArrayName()

virtual void vtkvmtkPolyDataDistanceToCenterlines::SetDistanceToCenterlinesArrayName ( const char * )
virtual

Set/Get the name of the output point data array where the computed distance (or radius, see EvaluateCenterlineRadius) is stored. Commonly named "DistanceToCenterlines".

◆ GetDistanceToCenterlinesArrayName()

virtual char * vtkvmtkPolyDataDistanceToCenterlines::GetDistanceToCenterlinesArrayName ( )
virtual

Set/Get the name of the output point data array where the computed distance (or radius, see EvaluateCenterlineRadius) is stored. Commonly named "DistanceToCenterlines".

◆ SetCenterlineRadiusArrayName()

virtual void vtkvmtkPolyDataDistanceToCenterlines::SetCenterlineRadiusArrayName ( const char * )
virtual

Set/Get the name of the point data array of Centerlines holding the maximum inscribed sphere radius at each point. Used when UseRadiusInformation or EvaluateCenterlineRadius is on. Commonly named "MaximumInscribedSphereRadius".

◆ GetCenterlineRadiusArrayName()

virtual char * vtkvmtkPolyDataDistanceToCenterlines::GetCenterlineRadiusArrayName ( )
virtual

Set/Get the name of the point data array of Centerlines holding the maximum inscribed sphere radius at each point. Used when UseRadiusInformation or EvaluateCenterlineRadius is on. Commonly named "MaximumInscribedSphereRadius".

◆ SetProjectPointArrays()

virtual void vtkvmtkPolyDataDistanceToCenterlines::SetProjectPointArrays ( int )
virtual

Toggle projecting every other point data array present on Centerlines onto the surface, linearly interpolated between the two closest centerline points, in addition to computing DistanceToCenterlinesArrayName. Default: off.

◆ GetProjectPointArrays()

virtual int vtkvmtkPolyDataDistanceToCenterlines::GetProjectPointArrays ( )
virtual

Toggle projecting every other point data array present on Centerlines onto the surface, linearly interpolated between the two closest centerline points, in addition to computing DistanceToCenterlinesArrayName. Default: off.

◆ ProjectPointArraysOn()

virtual void vtkvmtkPolyDataDistanceToCenterlines::ProjectPointArraysOn ( )
virtual

Toggle projecting every other point data array present on Centerlines onto the surface, linearly interpolated between the two closest centerline points, in addition to computing DistanceToCenterlinesArrayName. Default: off.

◆ ProjectPointArraysOff()

virtual void vtkvmtkPolyDataDistanceToCenterlines::ProjectPointArraysOff ( )
virtual

Toggle projecting every other point data array present on Centerlines onto the surface, linearly interpolated between the two closest centerline points, in addition to computing DistanceToCenterlinesArrayName. Default: off.

◆ RequestData()

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

Definition at line 69 of file vtkvmtkPolyDataDistanceToCenterlines.cxx.

73{
74 vtkInformation *inInfo = inputVector[0]->GetInformationObject(0);
75 vtkInformation *outInfo = outputVector->GetInformationObject(0);
76
77 vtkPolyData *input = vtkPolyData::SafeDownCast(
78 inInfo->Get(vtkDataObject::DATA_OBJECT()));
79 vtkPolyData *output = vtkPolyData::SafeDownCast(
80 outInfo->Get(vtkDataObject::DATA_OBJECT()));
81
83 {
84 vtkErrorMacro(<<"DistanceToCenterlinesArrayName not set.");
85 return 1;
86 }
87
88 if (!this->Centerlines)
89 {
90 vtkErrorMacro(<<"Centerlines not set");
91 return 1;
92 }
93
95 {
96 this->UseRadiusInformation = 1;
97 }
98
99 if (this->UseRadiusInformation)
100 {
101 if (!this->CenterlineRadiusArrayName)
102 {
103 vtkErrorMacro(<<"CenterlineRadiusArrayName not set.");
104 return 1;
105 }
106
107 vtkDataArray* centerlineRadiusArray = this->Centerlines->GetPointData()->GetArray(this->CenterlineRadiusArrayName);
108
109 if (!centerlineRadiusArray)
110 {
111 vtkErrorMacro(<<"CenterlineRadiusArrayName with name specified does not exist.");
112 return 1;
113 }
114 }
115
116 int numberOfInputPoints = input->GetNumberOfPoints();
117
118 output->DeepCopy(input);
119
120 vtkDoubleArray* distanceToCenterlinesArray = vtkDoubleArray::New();
121 distanceToCenterlinesArray->SetName(this->DistanceToCenterlinesArrayName);
122 distanceToCenterlinesArray->SetNumberOfComponents(1);
123 distanceToCenterlinesArray->SetNumberOfTuples(numberOfInputPoints);
124 distanceToCenterlinesArray->FillComponent(0,0.0);
125
126 output->GetPointData()->AddArray(distanceToCenterlinesArray);
127
128 vtkDoubleArray* surfaceCenterlineRadiusArray = NULL;
129 if (this->EvaluateCenterlineRadius)
130 {
131 surfaceCenterlineRadiusArray = vtkDoubleArray::New();
132 surfaceCenterlineRadiusArray->SetName(this->CenterlineRadiusArrayName);
133 surfaceCenterlineRadiusArray->SetNumberOfComponents(1);
134 surfaceCenterlineRadiusArray->SetNumberOfTuples(numberOfInputPoints);
135 surfaceCenterlineRadiusArray->FillComponent(0,0.0);
136
137 output->GetPointData()->AddArray(surfaceCenterlineRadiusArray);
138 }
139
140 vtkvmtkPolyBallLine* tube = vtkvmtkPolyBallLine::New();
141 tube->SetInput(this->Centerlines);
143 if (this->UseRadiusInformation)
144 {
146 }
147
148 if (this->ProjectPointArrays)
149 {
150 output->GetPointData()->InterpolateAllocate(this->Centerlines->GetPointData(),numberOfInputPoints);
151 }
152
153 double point[3], centerlinePoint[3];
154 double distanceToCenterlines = 0.0;
155 for (int i=0; i<numberOfInputPoints; i++)
156 {
157 input->GetPoint(i,point);
158 double tubeFunctionValue = tube->EvaluateFunction(point);
159 if (this->EvaluateTubeFunction)
160 {
161 distanceToCenterlines = tubeFunctionValue;
162 }
163 else
164 {
165 tube->GetLastPolyBallCenter(centerlinePoint);
166 distanceToCenterlines = sqrt(vtkMath::Distance2BetweenPoints(point,centerlinePoint));
167 }
168 distanceToCenterlinesArray->SetComponent(i,0,distanceToCenterlines);
169 if (this->EvaluateCenterlineRadius)
170 {
171 surfaceCenterlineRadiusArray->SetComponent(i,0,tube->GetLastPolyBallCenterRadius());
172 }
173
174 if (this->ProjectPointArrays)
175 {
176 vtkIdType cellId = tube->GetLastPolyBallCellId();
177 vtkIdType subId = tube->GetLastPolyBallCellSubId();
178 vtkIdType pcoord = tube->GetLastPolyBallCellPCoord();
179 vtkCell* cell = this->Centerlines->GetCell(cellId);
180 vtkIdType pointId0 = cell->GetPointId(subId);
181 vtkIdType pointId1 = cell->GetPointId(subId+1);
182 output->GetPointData()->InterpolateEdge(this->Centerlines->GetPointData(),i,pointId0,pointId1,pcoord);
183 }
184 }
185
186 tube->Delete();
187 distanceToCenterlinesArray->Delete();
188 if (surfaceCenterlineRadiusArray)
189 {
190 surfaceCenterlineRadiusArray->Delete();
191 }
192
193 return 1;
194}
virtual double * GetLastPolyBallCenter()
virtual double GetLastPolyBallCenterRadius()
virtual double GetLastPolyBallCellPCoord()
virtual void SetInput(vtkPolyData *)
virtual void SetPolyBallRadiusArrayName(const char *)
virtual void SetUseRadiusInformation(int)
virtual vtkIdType GetLastPolyBallCellId()
static vtkvmtkPolyBallLine * New()
double EvaluateFunction(double x[3]) override
virtual vtkIdType GetLastPolyBallCellSubId()

Member Data Documentation

◆ DistanceToCenterlinesArrayName

char* vtkvmtkPolyDataDistanceToCenterlines::DistanceToCenterlinesArrayName
protected

Definition at line 122 of file vtkvmtkPolyDataDistanceToCenterlines.h.

◆ CenterlineRadiusArrayName

char* vtkvmtkPolyDataDistanceToCenterlines::CenterlineRadiusArrayName
protected

Definition at line 123 of file vtkvmtkPolyDataDistanceToCenterlines.h.

◆ Centerlines

vtkPolyData* vtkvmtkPolyDataDistanceToCenterlines::Centerlines
protected

Definition at line 125 of file vtkvmtkPolyDataDistanceToCenterlines.h.

◆ UseRadiusInformation

int vtkvmtkPolyDataDistanceToCenterlines::UseRadiusInformation
protected

Definition at line 127 of file vtkvmtkPolyDataDistanceToCenterlines.h.

◆ EvaluateTubeFunction

int vtkvmtkPolyDataDistanceToCenterlines::EvaluateTubeFunction
protected

Definition at line 128 of file vtkvmtkPolyDataDistanceToCenterlines.h.

◆ EvaluateCenterlineRadius

int vtkvmtkPolyDataDistanceToCenterlines::EvaluateCenterlineRadius
protected

Definition at line 129 of file vtkvmtkPolyDataDistanceToCenterlines.h.

◆ ProjectPointArrays

int vtkvmtkPolyDataDistanceToCenterlines::ProjectPointArrays
protected

Definition at line 130 of file vtkvmtkPolyDataDistanceToCenterlines.h.


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