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

Split a centerline into tracts which can be used to mark endpoints of the centerline. More...

#include <vtkvmtkCenterlineEndpointExtractor.h>

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

Public Types

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

Public Member Functions

virtual int IsA (const char *type)
vtkvmtkCenterlineEndpointExtractor * NewInstance () const
void PrintSelf (std::ostream &os, vtkIndent indent) override
void SetExtractionModeToFirstEndpoint ()
void SetExtractionModeToLastEndpoint ()
void SetExtractionModeToBothEndpoints ()
virtual void SetNumberOfEndpointSpheres (int)
virtual int GetNumberOfEndpointSpheres ()
virtual void SetNumberOfGapSpheres (int)
virtual int GetNumberOfGapSpheres ()
virtual void SetExtractionMode (int)
virtual int GetExtractionMode ()
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 vtkvmtkCenterlineEndpointExtractor * SafeDownCast (vtkObjectBase *o)
static vtkvmtkCenterlineEndpointExtractor * New ()
Static Public Member Functions inherited from vtkvmtkCenterlineSplittingAndGroupingFilter
static int IsTypeOf (const char *type)
static vtkvmtkCenterlineSplittingAndGroupingFilter * SafeDownCast (vtkObjectBase *o)

Protected Types

enum  { VTK_VMTK_FIRST_ENDPOINT , VTK_VMTK_LAST_ENDPOINT , VTK_VMTK_BOTH_ENDPOINTS }

Protected Member Functions

virtual vtkObjectBase * NewInstanceInternal () const
 vtkvmtkCenterlineEndpointExtractor ()
 ~vtkvmtkCenterlineEndpointExtractor ()
virtual void ComputeCenterlineSplitting (vtkPolyData *input, vtkIdType cellId) override
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

int NumberOfEndpointSpheres
int NumberOfGapSpheres
int ExtractionMode
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 tracts which can be used to mark endpoints of the centerline.

The methods employed here are similar to those in CenterlineBranchExtractor. Starting at (both) terminal end points of a centerline generate two, one sphere long, tracts (for four in total, two from each end of the centerline), and a single tract (n-sphere long) composed of points on the centerline connecting the "second" tracts internal endpoint (as you move the endpoint of the second tract if you moved inwards from terminal points on the centerline). The second internal tract on each side of the centerline is Blanked.

This is the filter behind the vmtkendpointextractor pype script, typically run right after splitting/grouping centerlines to additionally mark the free (non-bifurcating) ends of the tree.

See also
vtkvmtkCenterlineBranchExtractor, vtkvmtkCenterlineSplittingAndGroupingFilter

Definition at line 38 of file vtkvmtkCenterlineEndpointExtractor.h.

Member Typedef Documentation

◆ Superclass

Member Enumeration Documentation

◆ anonymous enum

anonymous enum
protected

Constructor & Destructor Documentation

◆ vtkvmtkCenterlineEndpointExtractor()

vtkvmtkCenterlineEndpointExtractor::vtkvmtkCenterlineEndpointExtractor ( )
protected

◆ ~vtkvmtkCenterlineEndpointExtractor()

vtkvmtkCenterlineEndpointExtractor::~vtkvmtkCenterlineEndpointExtractor ( )
protected

Definition at line 38 of file vtkvmtkCenterlineEndpointExtractor.cxx.

39{
40}

Member Function Documentation

◆ IsTypeOf()

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

◆ IsA()

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

◆ SafeDownCast()

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

◆ NewInstanceInternal()

virtual vtkObjectBase * vtkvmtkCenterlineEndpointExtractor::NewInstanceInternal ( ) const
protectedvirtual

◆ NewInstance()

vtkvmtkCenterlineEndpointExtractor * vtkvmtkCenterlineEndpointExtractor::NewInstance ( ) const

◆ PrintSelf()

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

Definition at line 135 of file vtkvmtkCenterlineEndpointExtractor.cxx.

136{
137 this->Superclass::PrintSelf(os,indent);
138}
void PrintSelf(std::ostream &os, vtkIndent indent) override

◆ New()

vtkvmtkCenterlineEndpointExtractor * vtkvmtkCenterlineEndpointExtractor::New ( )
static

◆ SetNumberOfEndpointSpheres()

virtual void vtkvmtkCenterlineEndpointExtractor::SetNumberOfEndpointSpheres ( int )
virtual

Set/Get the number of maximum-inscribed-sphere-long tracts extracted at each extracted endpoint. Default: 2.

◆ GetNumberOfEndpointSpheres()

virtual int vtkvmtkCenterlineEndpointExtractor::GetNumberOfEndpointSpheres ( )
virtual

Set/Get the number of maximum-inscribed-sphere-long tracts extracted at each extracted endpoint. Default: 2.

◆ SetNumberOfGapSpheres()

virtual void vtkvmtkCenterlineEndpointExtractor::SetNumberOfGapSpheres ( int )
virtual

Set/Get the number of spheres separating the endpoint tracts from the (blanked) internal gap tract that connects them. Default: 1.

◆ GetNumberOfGapSpheres()

virtual int vtkvmtkCenterlineEndpointExtractor::GetNumberOfGapSpheres ( )
virtual

Set/Get the number of spheres separating the endpoint tracts from the (blanked) internal gap tract that connects them. Default: 1.

◆ SetExtractionMode()

virtual void vtkvmtkCenterlineEndpointExtractor::SetExtractionMode ( int )
virtual

Set/Get which terminal end(s) of each input centerline are processed: VTK_VMTK_FIRST_ENDPOINT, VTK_VMTK_LAST_ENDPOINT, or VTK_VMTK_BOTH_ENDPOINTS (default). See also SetExtractionModeToFirstEndpoint / SetExtractionModeToLastEndpoint / SetExtractionModeToBothEndpoints.

◆ GetExtractionMode()

virtual int vtkvmtkCenterlineEndpointExtractor::GetExtractionMode ( )
virtual

Set/Get which terminal end(s) of each input centerline are processed: VTK_VMTK_FIRST_ENDPOINT, VTK_VMTK_LAST_ENDPOINT, or VTK_VMTK_BOTH_ENDPOINTS (default). See also SetExtractionModeToFirstEndpoint / SetExtractionModeToLastEndpoint / SetExtractionModeToBothEndpoints.

◆ SetExtractionModeToFirstEndpoint()

void vtkvmtkCenterlineEndpointExtractor::SetExtractionModeToFirstEndpoint ( )
inline

Convenience method: set ExtractionMode to only process the first endpoint of each centerline.

Definition at line 77 of file vtkvmtkCenterlineEndpointExtractor.h.

◆ SetExtractionModeToLastEndpoint()

void vtkvmtkCenterlineEndpointExtractor::SetExtractionModeToLastEndpoint ( )
inline

Convenience method: set ExtractionMode to only process the last endpoint of each centerline.

Definition at line 83 of file vtkvmtkCenterlineEndpointExtractor.h.

◆ SetExtractionModeToBothEndpoints()

void vtkvmtkCenterlineEndpointExtractor::SetExtractionModeToBothEndpoints ( )
inline

Convenience method: set ExtractionMode to process both endpoints of each centerline (default).

Definition at line 89 of file vtkvmtkCenterlineEndpointExtractor.h.

◆ ComputeCenterlineSplitting()

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

Implements vtkvmtkCenterlineSplittingAndGroupingFilter.

Definition at line 42 of file vtkvmtkCenterlineEndpointExtractor.cxx.

43{
45
46 if (this->SubIds)
47 {
48 delete[] this->SubIds;
49 this->SubIds = NULL;
50 }
51
52 if (this->PCoords)
53 {
54 delete[] this->PCoords;
55 this->PCoords = NULL;
56 }
57
58 if (this->TractBlanking)
59 {
60 delete[] this->TractBlanking;
61 this->TractBlanking = NULL;
62 }
63
64 vtkCell* centerline = input->GetCell(cellId);
65
66 if (centerline->GetCellType() != VTK_LINE && centerline->GetCellType() != VTK_POLY_LINE)
67 {
68 return;
69 }
70
73 {
75 }
76
77 this->SubIds = new vtkIdType[this->NumberOfSplittingPoints];
78 this->PCoords = new double[this->NumberOfSplittingPoints];
79
80 vtkIdType firstSubId, lastSubId;
81 double firstPCoord, lastPCoord;
82
83 firstSubId = 0;
84 firstPCoord = 0.0;
85
86 lastSubId = centerline->GetNumberOfPoints() - 2;
87 lastPCoord = 1.0;
88
90 {
91 vtkvmtkCenterlineSphereDistance::FindNTouchingSphereCenter(input,this->RadiusArrayName,cellId,firstSubId,firstPCoord,this->NumberOfEndpointSpheres,this->SubIds[0],this->PCoords[0],false);
92 vtkvmtkCenterlineSphereDistance::FindNTouchingSphereCenter(input,this->RadiusArrayName,cellId,this->SubIds[0],this->PCoords[0],this->NumberOfGapSpheres,this->SubIds[1],this->PCoords[1],false);
93 }
94 else if (this->ExtractionMode == VTK_VMTK_LAST_ENDPOINT)
95 {
96 vtkvmtkCenterlineSphereDistance::FindNTouchingSphereCenter(input,this->RadiusArrayName,cellId,lastSubId,lastPCoord,this->NumberOfEndpointSpheres,this->SubIds[1],this->PCoords[1],true);
97 vtkvmtkCenterlineSphereDistance::FindNTouchingSphereCenter(input,this->RadiusArrayName,cellId,this->SubIds[1],this->PCoords[1],this->NumberOfGapSpheres,this->SubIds[0],this->PCoords[0],true);
98 if (this->SubIds[0] == -1)
99 {
100 this->SubIds[0] = 0;
101 this->PCoords[0] = 0.0;
102 }
103 if (this->SubIds[1] == -1)
104 {
105 this->SubIds[1] = 0;
106 this->PCoords[1] = 0.0;
107 }
108 }
109 else
110 {
111 vtkvmtkCenterlineSphereDistance::FindNTouchingSphereCenter(input,this->RadiusArrayName,cellId,firstSubId,firstPCoord,this->NumberOfEndpointSpheres,this->SubIds[0],this->PCoords[0],false);
112 vtkvmtkCenterlineSphereDistance::FindNTouchingSphereCenter(input,this->RadiusArrayName,cellId,this->SubIds[0],this->PCoords[0],this->NumberOfGapSpheres,this->SubIds[1],this->PCoords[1],false);
113 vtkvmtkCenterlineSphereDistance::FindNTouchingSphereCenter(input,this->RadiusArrayName,cellId,lastSubId,lastPCoord,this->NumberOfEndpointSpheres,this->SubIds[3],this->PCoords[3],true);
114 vtkvmtkCenterlineSphereDistance::FindNTouchingSphereCenter(input,this->RadiusArrayName,cellId,this->SubIds[3],this->PCoords[3],this->NumberOfGapSpheres,this->SubIds[2],this->PCoords[2],true);
115 }
116
117 this->TractBlanking = new int[this->NumberOfSplittingPoints+1];
118
120 {
121 this->TractBlanking[0] = 0;
122 this->TractBlanking[1] = 1;
123 this->TractBlanking[2] = 0;
124 }
125 else
126 {
127 this->TractBlanking[0] = 0;
128 this->TractBlanking[1] = 1;
129 this->TractBlanking[2] = 0;
130 this->TractBlanking[3] = 1;
131 this->TractBlanking[4] = 0;
132 }
133}
static void FindNTouchingSphereCenter(vtkPolyData *centerlines, const char *radiusArrayName, vtkIdType cellId, vtkIdType subId, double pcoord, int numberOfTouchingSpheres, vtkIdType &touchingSubId, double &touchingPCoord, bool forward=true)

Member Data Documentation

◆ NumberOfEndpointSpheres

int vtkvmtkCenterlineEndpointExtractor::NumberOfEndpointSpheres
protected

Definition at line 98 of file vtkvmtkCenterlineEndpointExtractor.h.

◆ NumberOfGapSpheres

int vtkvmtkCenterlineEndpointExtractor::NumberOfGapSpheres
protected

Definition at line 99 of file vtkvmtkCenterlineEndpointExtractor.h.

◆ ExtractionMode

int vtkvmtkCenterlineEndpointExtractor::ExtractionMode
protected

Definition at line 100 of file vtkvmtkCenterlineEndpointExtractor.h.


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