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

Compute a harmonic mapping over each branch of a bifurcated surface, treating every branch as an independent open cylinder. More...

#include <vtkvmtkPolyDataMultipleCylinderHarmonicMappingFilter.h>

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

Public Types

typedef vtkPolyDataAlgorithm Superclass

Public Member Functions

virtual int IsA (const char *type)
vtkvmtkPolyDataMultipleCylinderHarmonicMappingFilter * NewInstance () const
virtual void SetHarmonicMappingArrayName (const char *)
virtual char * GetHarmonicMappingArrayName ()
virtual void SetGroupIdsArrayName (const char *)
virtual char * GetGroupIdsArrayName ()

Static Public Member Functions

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

Protected Member Functions

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

Protected Attributes

char * HarmonicMappingArrayName
char * GroupIdsArrayName

Detailed Description

Compute a harmonic mapping over each branch of a bifurcated surface, treating every branch as an independent open cylinder.

Given an input surface whose points are tagged with a per-branch group id (see GroupIdsArrayName, typically produced while splitting a vascular surface into branches), this filter extracts each group in turn, treats it as an independent open cylindrical surface, and computes a harmonic mapping over it with vtkvmtkPolyDataCylinderHarmonicMappingFilter (a longitudinal scalar field ranging between the two open boundaries of the cylinder). The per-branch results are merged into a single point data array (HarmonicMappingArrayName) on the output, which retains all points/cells of the input. This is used by the vmtkbranchmapping pype script as the first step in building a longitudinal metric for centerline-based surface parameterization, later stretched to correctly account for the presence of insertion regions at bifurcations.

See also
vtkvmtkPolyDataCylinderHarmonicMappingFilter, vtkvmtkUnstructuredGridHarmonicMappingFilter

Definition at line 44 of file vtkvmtkPolyDataMultipleCylinderHarmonicMappingFilter.h.

Member Typedef Documentation

◆ Superclass

Constructor & Destructor Documentation

◆ vtkvmtkPolyDataMultipleCylinderHarmonicMappingFilter()

vtkvmtkPolyDataMultipleCylinderHarmonicMappingFilter::vtkvmtkPolyDataMultipleCylinderHarmonicMappingFilter ( )
protected

◆ ~vtkvmtkPolyDataMultipleCylinderHarmonicMappingFilter()

vtkvmtkPolyDataMultipleCylinderHarmonicMappingFilter::~vtkvmtkPolyDataMultipleCylinderHarmonicMappingFilter ( )
protected

Definition at line 44 of file vtkvmtkPolyDataMultipleCylinderHarmonicMappingFilter.cxx.

45{
47 {
48 delete[] this->HarmonicMappingArrayName;
49 this->HarmonicMappingArrayName = NULL;
50 }
51
52 if (this->GroupIdsArrayName)
53 {
54 delete[] this->GroupIdsArrayName;
55 this->GroupIdsArrayName = NULL;
56 }
57}

Member Function Documentation

◆ New()

vtkvmtkPolyDataMultipleCylinderHarmonicMappingFilter * vtkvmtkPolyDataMultipleCylinderHarmonicMappingFilter::New ( )
static

◆ IsTypeOf()

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

◆ IsA()

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

◆ SafeDownCast()

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

◆ NewInstanceInternal()

virtual vtkObjectBase * vtkvmtkPolyDataMultipleCylinderHarmonicMappingFilter::NewInstanceInternal ( ) const
protectedvirtual

◆ NewInstance()

vtkvmtkPolyDataMultipleCylinderHarmonicMappingFilter * vtkvmtkPolyDataMultipleCylinderHarmonicMappingFilter::NewInstance ( ) const

◆ SetHarmonicMappingArrayName()

virtual void vtkvmtkPolyDataMultipleCylinderHarmonicMappingFilter::SetHarmonicMappingArrayName ( const char * )
virtual

Set/get the name of the point data array where the computed per-branch harmonic mapping scalar is stored on the output surface. Commonly named "HarmonicMapping".

◆ GetHarmonicMappingArrayName()

virtual char * vtkvmtkPolyDataMultipleCylinderHarmonicMappingFilter::GetHarmonicMappingArrayName ( )
virtual

Set/get the name of the point data array where the computed per-branch harmonic mapping scalar is stored on the output surface. Commonly named "HarmonicMapping".

◆ SetGroupIdsArrayName()

virtual void vtkvmtkPolyDataMultipleCylinderHarmonicMappingFilter::SetGroupIdsArrayName ( const char * )
virtual

Set/get the name of the point data array of the input surface holding the branch/group id that each point belongs to. Each distinct group id is extracted and processed independently as its own open cylinder. Commonly named "GroupIds".

◆ GetGroupIdsArrayName()

virtual char * vtkvmtkPolyDataMultipleCylinderHarmonicMappingFilter::GetGroupIdsArrayName ( )
virtual

Set/get the name of the point data array of the input surface holding the branch/group id that each point belongs to. Each distinct group id is extracted and processed independently as its own open cylinder. Commonly named "GroupIds".

◆ RequestData()

int vtkvmtkPolyDataMultipleCylinderHarmonicMappingFilter::RequestData ( vtkInformation * request,
vtkInformationVector ** inputVector,
vtkInformationVector * outputVector )
overrideprotectedvirtual

Definition at line 59 of file vtkvmtkPolyDataMultipleCylinderHarmonicMappingFilter.cxx.

63{
64 vtkInformation *inInfo = inputVector[0]->GetInformationObject(0);
65 vtkInformation *outInfo = outputVector->GetInformationObject(0);
66
67 vtkPolyData *input = vtkPolyData::SafeDownCast(
68 inInfo->Get(vtkDataObject::DATA_OBJECT()));
69 vtkPolyData *output = vtkPolyData::SafeDownCast(
70 outInfo->Get(vtkDataObject::DATA_OBJECT()));
71
72 if (!this->HarmonicMappingArrayName)
73 {
74 vtkErrorMacro(<<"HarmonicMappingArrayName not set.");
75 return 1;
76 }
77
78 if (!this->GroupIdsArrayName)
79 {
80 vtkErrorMacro(<<"GroupIdsArrayName not set.");
81 return 1;
82 }
83
84 vtkDataArray* groupIdsArray = input->GetPointData()->GetArray(this->GroupIdsArrayName);
85
86 if (!groupIdsArray)
87 {
88 vtkErrorMacro(<<"GroupIdsArray with name specified does not exist.");
89 return 1;
90 }
91
92 int numberOfInputPoints = input->GetNumberOfPoints();
93
94 vtkDoubleArray* harmonicMappingArray = vtkDoubleArray::New();
95 harmonicMappingArray->SetName(this->HarmonicMappingArrayName);
96 harmonicMappingArray->SetNumberOfComponents(1);
97 harmonicMappingArray->SetNumberOfTuples(numberOfInputPoints);
98 harmonicMappingArray->FillComponent(0,0.0);
99 output->DeepCopy(input);
100
101 vtkIdList* groupIds = vtkIdList::New();
103
104 int i, j;
105 for (i=0; i<groupIds->GetNumberOfIds(); i++)
106 {
107 vtkIdType groupId = groupIds->GetId(i);
108 vtkPolyData* cylinder = vtkPolyData::New();
109 vtkvmtkPolyDataBranchUtilities::ExtractGroup(input,this->GroupIdsArrayName,groupId,false,cylinder);
110
111 vtkvmtkPolyDataCylinderHarmonicMappingFilter* mappingFilter = vtkvmtkPolyDataCylinderHarmonicMappingFilter::New();
112 mappingFilter->SetInputData(cylinder);
114 mappingFilter->Update();
115
116 vtkDataArray* cylinderMappingArray = mappingFilter->GetOutput()->GetPointData()->GetArray(this->HarmonicMappingArrayName);
117
118 if (!cylinderMappingArray)
119 {
120 mappingFilter->Delete();
121 continue;
122 }
123
124 double mappingValue;
125 for (j=0; j<numberOfInputPoints; j++)
126 {
127 vtkIdType currentGroupId = static_cast<int>(groupIdsArray->GetComponent(j,0));
128 if (currentGroupId == groupId)
129 {
130 mappingValue = cylinderMappingArray->GetComponent(j,0);
131 harmonicMappingArray->SetComponent(j,0,mappingValue);
132 }
133 }
134
135 mappingFilter->Delete();
136 cylinder->Delete();
137 }
138
139 output->GetPointData()->AddArray(harmonicMappingArray);
140
141 groupIds->Delete();
142 harmonicMappingArray->Delete();
143
144 return 1;
145}
static void ExtractGroup(vtkPolyData *surface, const char *groupIdsArrayName, vtkIdType groupId, bool cleanGroupSurface, vtkPolyData *groupSurface)
static void GetGroupsIdList(vtkPolyData *surface, const char *groupIdsArrayName, vtkIdList *groupIds)
static vtkvmtkPolyDataCylinderHarmonicMappingFilter * New()
virtual void SetHarmonicMappingArrayName(const char *)

Member Data Documentation

◆ HarmonicMappingArrayName

char* vtkvmtkPolyDataMultipleCylinderHarmonicMappingFilter::HarmonicMappingArrayName
protected

◆ GroupIdsArrayName

char* vtkvmtkPolyDataMultipleCylinderHarmonicMappingFilter::GroupIdsArrayName
protected

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