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

Project all point data from a centerline onto a surface. More...

#include <vtkvmtkPolyDataCenterlineProjection.h>

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

Public Types

typedef vtkPolyDataAlgorithm Superclass

Public Member Functions

virtual int IsA (const char *type)
vtkvmtkPolyDataCenterlineProjection * NewInstance () const
virtual void SetCenterlines (vtkPolyData *)
virtual vtkPolyData * GetCenterlines ()
virtual void SetUseRadiusInformation (int)
virtual int GetUseRadiusInformation ()
virtual void UseRadiusInformationOn ()
virtual void UseRadiusInformationOff ()
virtual void SetCenterlineRadiusArrayName (const char *)
virtual char * GetCenterlineRadiusArrayName ()

Static Public Member Functions

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

Protected Member Functions

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

Protected Attributes

char * CenterlineRadiusArrayName
vtkPolyData * Centerlines
int UseRadiusInformation

Detailed Description

Project all point data from a centerline onto a surface.

For each point of the input surface, finds the nearest point on Centerlines and copies every point data array present on the centerlines (e.g. radius, abscissa, Frenet frame) onto the surface at that point. This is the filter behind the vmtksurfacecenterlineprojection pype script; unlike vtkvmtkPolyDataCenterlineMetricFilter (which computes one specific derived metric), this class does a blanket copy of all existing centerline arrays.

See also
vtkvmtkPolyDataCenterlineMetricFilter, vtkvmtkPolyDataDistanceToCenterlines

Definition at line 41 of file vtkvmtkPolyDataCenterlineProjection.h.

Member Typedef Documentation

◆ Superclass

Definition at line 45 of file vtkvmtkPolyDataCenterlineProjection.h.

Constructor & Destructor Documentation

◆ vtkvmtkPolyDataCenterlineProjection()

vtkvmtkPolyDataCenterlineProjection::vtkvmtkPolyDataCenterlineProjection ( )
protected

◆ ~vtkvmtkPolyDataCenterlineProjection()

vtkvmtkPolyDataCenterlineProjection::~vtkvmtkPolyDataCenterlineProjection ( )
protected

Definition at line 41 of file vtkvmtkPolyDataCenterlineProjection.cxx.

42{
43 if (this->Centerlines)
44 {
45 this->Centerlines->Delete();
46 this->Centerlines = NULL;
47 }
48
50 {
51 delete[] this->CenterlineRadiusArrayName;
52 this->CenterlineRadiusArrayName = NULL;
53 }
54}

Member Function Documentation

◆ New()

vtkvmtkPolyDataCenterlineProjection * vtkvmtkPolyDataCenterlineProjection::New ( )
static

◆ IsTypeOf()

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

◆ IsA()

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

◆ SafeDownCast()

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

◆ NewInstanceInternal()

virtual vtkObjectBase * vtkvmtkPolyDataCenterlineProjection::NewInstanceInternal ( ) const
protectedvirtual

◆ NewInstance()

vtkvmtkPolyDataCenterlineProjection * vtkvmtkPolyDataCenterlineProjection::NewInstance ( ) const

◆ SetCenterlines()

virtual void vtkvmtkPolyDataCenterlineProjection::SetCenterlines ( vtkPolyData * )
virtual

Set/Get the centerlines whose point data arrays are projected onto the input surface. Required input.

◆ GetCenterlines()

virtual vtkPolyData * vtkvmtkPolyDataCenterlineProjection::GetCenterlines ( )
virtual

Set/Get the centerlines whose point data arrays are projected onto the input surface. Required input.

◆ SetUseRadiusInformation()

virtual void vtkvmtkPolyDataCenterlineProjection::SetUseRadiusInformation ( int )
virtual

Toggle using the maximum inscribed sphere radius (CenterlineRadiusArrayName) when locating the nearest centerline point to each surface point, so that the search accounts for local vessel size rather than pure Euclidean distance. Default: on.

◆ GetUseRadiusInformation()

virtual int vtkvmtkPolyDataCenterlineProjection::GetUseRadiusInformation ( )
virtual

Toggle using the maximum inscribed sphere radius (CenterlineRadiusArrayName) when locating the nearest centerline point to each surface point, so that the search accounts for local vessel size rather than pure Euclidean distance. Default: on.

◆ UseRadiusInformationOn()

virtual void vtkvmtkPolyDataCenterlineProjection::UseRadiusInformationOn ( )
virtual

Toggle using the maximum inscribed sphere radius (CenterlineRadiusArrayName) when locating the nearest centerline point to each surface point, so that the search accounts for local vessel size rather than pure Euclidean distance. Default: on.

◆ UseRadiusInformationOff()

virtual void vtkvmtkPolyDataCenterlineProjection::UseRadiusInformationOff ( )
virtual

Toggle using the maximum inscribed sphere radius (CenterlineRadiusArrayName) when locating the nearest centerline point to each surface point, so that the search accounts for local vessel size rather than pure Euclidean distance. Default: on.

◆ SetCenterlineRadiusArrayName()

virtual void vtkvmtkPolyDataCenterlineProjection::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 is on. Commonly named "MaximumInscribedSphereRadius".

◆ GetCenterlineRadiusArrayName()

virtual char * vtkvmtkPolyDataCenterlineProjection::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 is on. Commonly named "MaximumInscribedSphereRadius".

◆ RequestData()

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

Definition at line 56 of file vtkvmtkPolyDataCenterlineProjection.cxx.

60{
61 vtkInformation *inInfo = inputVector[0]->GetInformationObject(0);
62 vtkInformation *outInfo = outputVector->GetInformationObject(0);
63
64 vtkPolyData *input = vtkPolyData::SafeDownCast(
65 inInfo->Get(vtkDataObject::DATA_OBJECT()));
66 vtkPolyData *output = vtkPolyData::SafeDownCast(
67 outInfo->Get(vtkDataObject::DATA_OBJECT()));
68
69 if (!this->Centerlines)
70 {
71 vtkErrorMacro(<<"Centerlines not set");
72 return 1;
73 }
74
75 if (this->UseRadiusInformation)
76 {
78 {
79 vtkErrorMacro(<<"CenterlineRadiusArrayName not set.");
80 return 1;
81 }
82
83 vtkDataArray* centerlineRadiusArray = this->Centerlines->GetPointData()->GetArray(this->CenterlineRadiusArrayName);
84
85 if (!centerlineRadiusArray)
86 {
87 vtkErrorMacro(<<"CenterlineRadiusArrayName with name specified does not exist.");
88 return 1;
89 }
90 }
91
92 int numberOfInputPoints = input->GetNumberOfPoints();
93
94 output->DeepCopy(input);
95
96 vtkPointData* outputPointData = output->GetPointData();
97 vtkPointData* referencePointData = this->Centerlines->GetPointData();
98
99 outputPointData->InterpolateAllocate(referencePointData,numberOfInputPoints);
100
101 vtkvmtkPolyBallLine* tube = vtkvmtkPolyBallLine::New();
102 tube->SetInput(this->Centerlines);
104 if (this->UseRadiusInformation)
105 {
107 }
108
109 double point[3];
110 for (int i=0; i<numberOfInputPoints; i++)
111 {
112 input->GetPoint(i,point);
113 tube->EvaluateFunction(point);
114 vtkIdType cellId = tube->GetLastPolyBallCellId();
115 vtkIdType subId = tube->GetLastPolyBallCellSubId();
116 double pcoord = tube->GetLastPolyBallCellPCoord();
117 vtkCell* cell = this->Centerlines->GetCell(cellId);
118// FIXME: for some reason EvaluateLocation fails on the PolyLine - weights are funny. Copy from the closest subId for the moment.
119// double pcoords[3];
120// pcoords[0] = pcoord;
121// pcoords[1] = pcoords[2] = 0.0;
122// double* weights = new double[cell->GetNumberOfPoints()];
123// double locationPoint[3];
124// cell->EvaluateLocation(subId,pcoords,locationPoint,weights);
125// outputPointData->InterpolatePoint(referencePointData,i,cell->GetPointIds(),weights);
126// delete[] weights;
127 if (pcoord < 0.5)
128 {
129 outputPointData->CopyData(referencePointData,cell->GetPointId(subId),i);
130 }
131 else
132 {
133 outputPointData->CopyData(referencePointData,cell->GetPointId(subId+1),i);
134 }
135 }
136
137 tube->Delete();
138
139 return 1;
140}
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

◆ CenterlineRadiusArrayName

char* vtkvmtkPolyDataCenterlineProjection::CenterlineRadiusArrayName
protected

Definition at line 83 of file vtkvmtkPolyDataCenterlineProjection.h.

◆ Centerlines

vtkPolyData* vtkvmtkPolyDataCenterlineProjection::Centerlines
protected

Definition at line 85 of file vtkvmtkPolyDataCenterlineProjection.h.

◆ UseRadiusInformation

int vtkvmtkPolyDataCenterlineProjection::UseRadiusInformation
protected

Definition at line 87 of file vtkvmtkPolyDataCenterlineProjection.h.


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