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

Split a centerline into three tracts with the middle (blanked) tract being initialized between any two points on the centerline or being an arbitrary length starting at a particular point. More...

#include <vtkvmtkCenterlineSplitExtractor.h>

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

Public Types

enum  { POINTANDGAP , BETWEENPOINTS }
typedef vtkvmtkCenterlineSplittingAndGroupingFilter Superclass
Public Types inherited from vtkvmtkCenterlineSplittingAndGroupingFilter
enum  { FIRSTPOINT , LASTPOINT , POINTINTUBE }
typedef vtkPolyDataAlgorithm Superclass

Public Member Functions

virtual int IsA (const char *type)
vtkvmtkCenterlineSplitExtractor * NewInstance () const
void PrintSelf (std::ostream &os, vtkIndent indent) override
void SetSplittingModeToPointAndGap ()
void SetSplittingModeToBetweenPoints ()
virtual void SetSplitPoint (double data[])
virtual double * GetSplitPoint ()
virtual void GetSplitPoint (double data[3])
virtual void SetTolerance (double)
virtual double GetTolerance ()
virtual void SetGapLength (double)
virtual double GetGapLength ()
virtual void SetSplitPoint2 (double data[])
virtual double * GetSplitPoint2 ()
virtual void GetSplitPoint2 (double data[3])
virtual void SetSplittingMode (int)
virtual int GetSplittingMode ()
Public Member Functions inherited from vtkvmtkCenterlineSplittingAndGroupingFilter
vtkvmtkCenterlineSplittingAndGroupingFilter * NewInstance () const
void PrintSelf (std::ostream &os, vtkIndent indent) override
void SetGroupingModeToFirstPoint ()
void SetGroupingModeToLastPoint ()
void SetGroupingModeToPointInTube ()
virtual void SetRadiusArrayName (const char *)
virtual char * GetRadiusArrayName ()
virtual void SetGroupIdsArrayName (const char *)
virtual char * GetGroupIdsArrayName ()
virtual void SetCenterlineIdsArrayName (const char *)
virtual char * GetCenterlineIdsArrayName ()
virtual void SetBlankingArrayName (const char *)
virtual char * GetBlankingArrayName ()
virtual void SetTractIdsArrayName (const char *)
virtual char * GetTractIdsArrayName ()
virtual void SetGroupingMode (int)
virtual int GetGroupingMode ()

Static Public Member Functions

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

Protected Member Functions

virtual vtkObjectBase * NewInstanceInternal () const
 vtkvmtkCenterlineSplitExtractor ()
 ~vtkvmtkCenterlineSplitExtractor ()
virtual void ComputeCenterlineSplitting (vtkPolyData *input, vtkIdType cellId) override
virtual void ComputePointAndGapCenterlineSplitting (vtkPolyData *input, vtkIdType cellId)
virtual void ComputeBetweenPointsCenterlineSplitting (vtkPolyData *input, vtkIdType cellId)
Protected Member Functions inherited from vtkvmtkCenterlineSplittingAndGroupingFilter
 vtkvmtkCenterlineSplittingAndGroupingFilter ()
 ~vtkvmtkCenterlineSplittingAndGroupingFilter ()
virtual int RequestData (vtkInformation *, vtkInformationVector **, vtkInformationVector *) override
virtual void GroupTracts (vtkPolyData *input, vtkPolyData *centerlineTracts)
void CoincidentExtremePointGroupTracts (vtkPolyData *input, vtkPolyData *centerlineTracts, bool first=true)
void PointInTubeGroupTracts (vtkPolyData *input, vtkPolyData *centerlineTracts)
virtual void MergeTracts (vtkPolyData *centerlineTracts)
void SplitCenterline (vtkPolyData *input, vtkIdType cellId, int numberOfSplittingPoints, const vtkIdType *subIds, const double *pcoords, const int *tractBlanking, vtkPolyData *splitCenterline)
void MakeGroupIdsAdjacent (vtkPolyData *centerlineTracts)
void MakeTractIdsAdjacent (vtkPolyData *centerlineTracts)

Protected Attributes

double SplitPoint [3]
double SplitPoint2 [3]
double Tolerance
double GapLength
int SplittingMode
Protected Attributes inherited from vtkvmtkCenterlineSplittingAndGroupingFilter
char * RadiusArrayName
char * GroupIdsArrayName
char * CenterlineIdsArrayName
char * BlankingArrayName
char * TractIdsArrayName
int NumberOfSplittingPoints
vtkIdType * SubIds
double * PCoords
int * TractBlanking
int GroupingMode

Detailed Description

Split a centerline into three tracts with the middle (blanked) tract being initialized between any two points on the centerline or being an arbitrary length starting at a particular point.

This is useful if you want to split a surface at an arbitrary location along a centerline in later processing.

This is the filter behind the vmtkpointsplitextractor pype script. Two splitting strategies are available (see SplittingMode): POINTANDGAP splits at the point on the centerline closest to SplitPoint, opening a blanked gap of length GapLength around it; BETWEENPOINTS splits into a blanked middle tract running between the points closest to SplitPoint and SplitPoint2.

See also
vtkvmtkCenterlineSplittingAndGroupingFilter

Definition at line 39 of file vtkvmtkCenterlineSplitExtractor.h.

Member Typedef Documentation

◆ Superclass

Member Enumeration Documentation

◆ anonymous enum

anonymous enum

Values for SplittingMode: strategy used to locate the split.

Enumerator
POINTANDGAP 
BETWEENPOINTS 

Definition at line 112 of file vtkvmtkCenterlineSplitExtractor.h.

Constructor & Destructor Documentation

◆ vtkvmtkCenterlineSplitExtractor()

◆ ~vtkvmtkCenterlineSplitExtractor()

vtkvmtkCenterlineSplitExtractor::~vtkvmtkCenterlineSplitExtractor ( )
protected

Definition at line 52 of file vtkvmtkCenterlineSplitExtractor.cxx.

53{
54}

Member Function Documentation

◆ IsTypeOf()

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

◆ IsA()

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

◆ SafeDownCast()

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

◆ NewInstanceInternal()

virtual vtkObjectBase * vtkvmtkCenterlineSplitExtractor::NewInstanceInternal ( ) const
protectedvirtual

◆ NewInstance()

vtkvmtkCenterlineSplitExtractor * vtkvmtkCenterlineSplitExtractor::NewInstance ( ) const

◆ PrintSelf()

void vtkvmtkCenterlineSplitExtractor::PrintSelf ( std::ostream & os,
vtkIndent indent )
override

Definition at line 278 of file vtkvmtkCenterlineSplitExtractor.cxx.

279{
280 this->Superclass::PrintSelf(os,indent);
281}
void PrintSelf(std::ostream &os, vtkIndent indent) override

◆ New()

vtkvmtkCenterlineSplitExtractor * vtkvmtkCenterlineSplitExtractor::New ( )
static

◆ SetSplitPoint()

virtual void vtkvmtkCenterlineSplitExtractor::SetSplitPoint ( double data[])
virtual

Set/Get the (x,y,z) location used to find the primary splitting point on the centerline (the closest centerline point to SplitPoint is used). In POINTANDGAP mode this is the sole split location; in BETWEENPOINTS mode it is one end of the blanked middle tract. Default: (0,0,0).

◆ GetSplitPoint() [1/2]

virtual double * vtkvmtkCenterlineSplitExtractor::GetSplitPoint ( )
virtual

Set/Get the (x,y,z) location used to find the primary splitting point on the centerline (the closest centerline point to SplitPoint is used). In POINTANDGAP mode this is the sole split location; in BETWEENPOINTS mode it is one end of the blanked middle tract. Default: (0,0,0).

◆ GetSplitPoint() [2/2]

virtual void vtkvmtkCenterlineSplitExtractor::GetSplitPoint ( double data[3])
virtual

Set/Get the (x,y,z) location used to find the primary splitting point on the centerline (the closest centerline point to SplitPoint is used). In POINTANDGAP mode this is the sole split location; in BETWEENPOINTS mode it is one end of the blanked middle tract. Default: (0,0,0).

◆ SetTolerance()

virtual void vtkvmtkCenterlineSplitExtractor::SetTolerance ( double )
virtual

Set/Get the distance tolerance used when locating centerline points coincident with SplitPoint/ SplitPoint2. Default: 1E-4.

◆ GetTolerance()

virtual double vtkvmtkCenterlineSplitExtractor::GetTolerance ( )
virtual

Set/Get the distance tolerance used when locating centerline points coincident with SplitPoint/ SplitPoint2. Default: 1E-4.

◆ SetGapLength()

virtual void vtkvmtkCenterlineSplitExtractor::SetGapLength ( double )
virtual

Set/Get, in POINTANDGAP mode, the length of the blanked gap tract opened up around the split point. Default: 1.0.

◆ GetGapLength()

virtual double vtkvmtkCenterlineSplitExtractor::GetGapLength ( )
virtual

Set/Get, in POINTANDGAP mode, the length of the blanked gap tract opened up around the split point. Default: 1.0.

◆ SetSplitPoint2()

virtual void vtkvmtkCenterlineSplitExtractor::SetSplitPoint2 ( double data[])
virtual

Set/Get, in BETWEENPOINTS mode, the (x,y,z) location used to find the other end of the blanked middle tract (the closest centerline point to SplitPoint2 is used). Default: (0,0,0).

◆ GetSplitPoint2() [1/2]

virtual double * vtkvmtkCenterlineSplitExtractor::GetSplitPoint2 ( )
virtual

Set/Get, in BETWEENPOINTS mode, the (x,y,z) location used to find the other end of the blanked middle tract (the closest centerline point to SplitPoint2 is used). Default: (0,0,0).

◆ GetSplitPoint2() [2/2]

virtual void vtkvmtkCenterlineSplitExtractor::GetSplitPoint2 ( double data[3])
virtual

Set/Get, in BETWEENPOINTS mode, the (x,y,z) location used to find the other end of the blanked middle tract (the closest centerline point to SplitPoint2 is used). Default: (0,0,0).

◆ SetSplittingMode()

virtual void vtkvmtkCenterlineSplitExtractor::SetSplittingMode ( int )
virtual

Set/Get the splitting strategy: POINTANDGAP (default) splits at SplitPoint, opening a blanked gap of length GapLength around it; BETWEENPOINTS splits into a blanked middle tract running between SplitPoint and SplitPoint2. See also SetSplittingModeToPointAndGap / SetSplittingModeToBetweenPoints.

◆ GetSplittingMode()

virtual int vtkvmtkCenterlineSplitExtractor::GetSplittingMode ( )
virtual

Set/Get the splitting strategy: POINTANDGAP (default) splits at SplitPoint, opening a blanked gap of length GapLength around it; BETWEENPOINTS splits into a blanked middle tract running between SplitPoint and SplitPoint2. See also SetSplittingModeToPointAndGap / SetSplittingModeToBetweenPoints.

◆ SetSplittingModeToPointAndGap()

void vtkvmtkCenterlineSplitExtractor::SetSplittingModeToPointAndGap ( )
inline

Convenience method: set SplittingMode to split at SplitPoint with a GapLength-long gap (default).

Definition at line 98 of file vtkvmtkCenterlineSplitExtractor.h.

virtual void SetSplittingMode(int)

◆ SetSplittingModeToBetweenPoints()

void vtkvmtkCenterlineSplitExtractor::SetSplittingModeToBetweenPoints ( )
inline

Convenience method: set SplittingMode to split into a blanked tract between SplitPoint and SplitPoint2.

Definition at line 105 of file vtkvmtkCenterlineSplitExtractor.h.

◆ ComputeCenterlineSplitting()

void vtkvmtkCenterlineSplitExtractor::ComputeCenterlineSplitting ( vtkPolyData * input,
vtkIdType cellId )
overrideprotectedvirtual

Implements vtkvmtkCenterlineSplittingAndGroupingFilter.

Definition at line 262 of file vtkvmtkCenterlineSplitExtractor.cxx.

263{
264 if (this->SplittingMode == POINTANDGAP)
265 {
266 this->ComputePointAndGapCenterlineSplitting(input,cellId);
267 }
268 else if (this->SplittingMode == BETWEENPOINTS)
269 {
270 this->ComputeBetweenPointsCenterlineSplitting(input,cellId);
271 }
272 else
273 {
274 vtkErrorMacro("Error: unsupported splitting mode");
275 }
276}
virtual void ComputePointAndGapCenterlineSplitting(vtkPolyData *input, vtkIdType cellId)
virtual void ComputeBetweenPointsCenterlineSplitting(vtkPolyData *input, vtkIdType cellId)

◆ ComputePointAndGapCenterlineSplitting()

void vtkvmtkCenterlineSplitExtractor::ComputePointAndGapCenterlineSplitting ( vtkPolyData * input,
vtkIdType cellId )
protectedvirtual

Definition at line 56 of file vtkvmtkCenterlineSplitExtractor.cxx.

57{
58 vtkvmtkPolyBallLine* tube = vtkvmtkPolyBallLine::New();
59 tube->SetInput(input);
60 tube->SetInputCellId(cellId);
62 double tubeFunctionValue = tube->EvaluateFunction(this->SplitPoint);
63
64 if (tubeFunctionValue > this->Tolerance)
65 {
67 return;
68 }
69
70 vtkIdType centerlineSubId = tube->GetLastPolyBallCellSubId();
71 double centerlinePCoord = tube->GetLastPolyBallCellPCoord();
72 double centerlinePoint[3];
73 tube->GetLastPolyBallCenter(centerlinePoint);
74
76
77 if (this->SubIds)
78 {
79 delete[] this->SubIds;
80 this->SubIds = NULL;
81 }
82
83 if (this->PCoords)
84 {
85 delete[] this->PCoords;
86 this->PCoords = NULL;
87 }
88
89 if (this->TractBlanking)
90 {
91 delete[] this->TractBlanking;
92 this->TractBlanking = NULL;
93 }
94
95 vtkCell* centerline = input->GetCell(cellId);
96
97 if (centerline->GetCellType() != VTK_LINE && centerline->GetCellType() != VTK_POLY_LINE)
98 {
99 return;
100 }
101
102 this->SubIds = new vtkIdType[this->NumberOfSplittingPoints];
103 this->PCoords = new double[this->NumberOfSplittingPoints];
104
105 int numberOfCenterlinePoints = centerline->GetNumberOfPoints();
106 int numberOfCenterlineSubIds = centerline->GetNumberOfPoints() - 1;
107
108 double currentAbscissa = 0.0;
109 vtkDoubleArray* abscissas = vtkDoubleArray::New();
110 abscissas->InsertNextValue(currentAbscissa);
111 double point[3], previousPoint[3];
112 centerline->GetPoints()->GetPoint(0,previousPoint);
113 int i;
114 for (i=1; i<numberOfCenterlinePoints; i++)
115 {
116 centerline->GetPoints()->GetPoint(i,point);
117 currentAbscissa += sqrt(vtkMath::Distance2BetweenPoints(previousPoint,point));
118 abscissas->InsertNextValue(currentAbscissa);
119 previousPoint[0] = point[0];
120 previousPoint[1] = point[1];
121 previousPoint[2] = point[2];
122 }
123
124 double halfGapLength = this->GapLength * 0.5;
125
126 double centerlinePointAbscissa = (1.0 - centerlinePCoord) * abscissas->GetValue(centerlineSubId) + centerlinePCoord * abscissas->GetValue(centerlineSubId+1);
127
128 double abscissa;
129 int lastSubId = numberOfCenterlineSubIds - 1;
130 for (i=centerlineSubId; i<numberOfCenterlineSubIds; i++)
131 {
132 abscissa = abscissas->GetValue(i+1);
133 if (abscissa - centerlinePointAbscissa > halfGapLength)
134 {
135 lastSubId = i;
136 break;
137 }
138 }
139 double lastPCoord = (centerlinePointAbscissa + halfGapLength - abscissas->GetValue(lastSubId)) / (abscissas->GetValue(lastSubId+1) - abscissas->GetValue(lastSubId));
140 if (lastPCoord > 1.0)
141 {
142 lastPCoord = 1.0 - 1E-1;
143 }
144
145 int firstSubId = 0;
146 for (i=centerlineSubId; i>=0; i--)
147 {
148 abscissa = abscissas->GetValue(i);
149 if (centerlinePointAbscissa - abscissa > halfGapLength)
150 {
151 firstSubId = i;
152 break;
153 }
154 }
155 double firstPCoord = (centerlinePointAbscissa - halfGapLength - abscissas->GetValue(firstSubId)) / (abscissas->GetValue(firstSubId+1) - abscissas->GetValue(firstSubId));
156 if (firstPCoord < 0.0)
157 {
158 firstPCoord = 0.0 + 1E-1;
159 }
160
161 this->SubIds[0] = firstSubId;
162 this->PCoords[0] = firstPCoord;
163
164 this->SubIds[1] = lastSubId;
165 this->PCoords[1] = lastPCoord;
166
167 this->TractBlanking = new int[this->NumberOfSplittingPoints+1];
168
169 this->TractBlanking[0] = 0;
170 this->TractBlanking[1] = 1;
171 this->TractBlanking[2] = 0;
172
173 abscissas->Delete();
174}
virtual double * GetLastPolyBallCenter()
virtual void SetInputCellId(vtkIdType)
virtual double GetLastPolyBallCellPCoord()
virtual void SetInput(vtkPolyData *)
static vtkvmtkPolyBallLine * New()
double EvaluateFunction(double x[3]) override
virtual vtkIdType GetLastPolyBallCellSubId()
virtual void UseRadiusInformationOff()

◆ ComputeBetweenPointsCenterlineSplitting()

void vtkvmtkCenterlineSplitExtractor::ComputeBetweenPointsCenterlineSplitting ( vtkPolyData * input,
vtkIdType cellId )
protectedvirtual

Definition at line 176 of file vtkvmtkCenterlineSplitExtractor.cxx.

177{
178 vtkvmtkPolyBallLine* tube = vtkvmtkPolyBallLine::New();
179 tube->SetInput(input);
180 tube->SetInputCellId(cellId);
182 double tubeFunctionValue = tube->EvaluateFunction(this->SplitPoint);
183
184 if (tubeFunctionValue > this->Tolerance)
185 {
186 this->NumberOfSplittingPoints = 0;
187 return;
188 }
189
190 vtkIdType centerlineSubId = tube->GetLastPolyBallCellSubId();
191 double centerlinePCoord = tube->GetLastPolyBallCellPCoord();
192 double centerlinePoint[3];
193 tube->GetLastPolyBallCenter(centerlinePoint);
194
195 double tubeFunctionValue2 = tube->EvaluateFunction(this->SplitPoint2);
196
197 if (tubeFunctionValue2 > this->Tolerance)
198 {
199 this->NumberOfSplittingPoints = 0;
200 return;
201 }
202
203 vtkIdType centerlineSubId2 = tube->GetLastPolyBallCellSubId();
204 double centerlinePCoord2 = tube->GetLastPolyBallCellPCoord();
205 double centerlinePoint2[3];
206 tube->GetLastPolyBallCenter(centerlinePoint2);
207
208 this->NumberOfSplittingPoints = 2;
209
210 if (this->SubIds)
211 {
212 delete[] this->SubIds;
213 this->SubIds = NULL;
214 }
215
216 if (this->PCoords)
217 {
218 delete[] this->PCoords;
219 this->PCoords = NULL;
220 }
221
222 if (this->TractBlanking)
223 {
224 delete[] this->TractBlanking;
225 this->TractBlanking = NULL;
226 }
227
228 vtkCell* centerline = input->GetCell(cellId);
229
230 if (centerline->GetCellType() != VTK_LINE && centerline->GetCellType() != VTK_POLY_LINE)
231 {
232 return;
233 }
234
235 this->SubIds = new vtkIdType[this->NumberOfSplittingPoints];
236 this->PCoords = new double[this->NumberOfSplittingPoints];
237
238 if (centerlineSubId > centerlineSubId2 || (centerlineSubId == centerlineSubId2 && centerlinePCoord > centerlinePCoord2))
239 {
240 this->SubIds[0] = centerlineSubId;
241 this->PCoords[0] = centerlinePCoord;
242
243 this->SubIds[1] = centerlineSubId2;
244 this->PCoords[1] = centerlinePCoord2;
245 }
246 else
247 {
248 this->SubIds[0] = centerlineSubId2;
249 this->PCoords[0] = centerlinePCoord2;
250
251 this->SubIds[1] = centerlineSubId;
252 this->PCoords[1] = centerlinePCoord;
253 }
254
255 this->TractBlanking = new int[this->NumberOfSplittingPoints+1];
256
257 this->TractBlanking[0] = 0;
258 this->TractBlanking[1] = 1;
259 this->TractBlanking[2] = 0;
260}

Member Data Documentation

◆ SplitPoint

double vtkvmtkCenterlineSplitExtractor::SplitPoint[3]
protected

Definition at line 126 of file vtkvmtkCenterlineSplitExtractor.h.

◆ SplitPoint2

double vtkvmtkCenterlineSplitExtractor::SplitPoint2[3]
protected

Definition at line 127 of file vtkvmtkCenterlineSplitExtractor.h.

◆ Tolerance

double vtkvmtkCenterlineSplitExtractor::Tolerance
protected

Definition at line 128 of file vtkvmtkCenterlineSplitExtractor.h.

◆ GapLength

double vtkvmtkCenterlineSplitExtractor::GapLength
protected

Definition at line 129 of file vtkvmtkCenterlineSplitExtractor.h.

◆ SplittingMode

int vtkvmtkCenterlineSplitExtractor::SplittingMode
protected

Definition at line 131 of file vtkvmtkCenterlineSplitExtractor.h.


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