mjg
March 16, 2021, 3:16am
1
How can I get a bifurcated centerline as two separate numpy arrays? I can view the two centerlines with the below code. How can I then get the red centerline as one numpy array, and the blue centerline as another numpy array?
Thank you!
vmtkCommand = r'vmtkcenterlines -ifile ' + modelPath + r' --pipe vmtkbranchextractor -ofile ' + extractedPath + r' --pipe vmtkcenterlineviewer -cellarray CenterlineIds'
myPype = pypes.PypeRun(vmtkCommand)
Which returns:
lassoan
(Andras Lasso)
March 26, 2021, 3:34am
2
You can see an example of how to extract a specific branch by thresholding based on group ID:
assignAttribute = vtk.vtkAssignAttribute()
assignAttribute.SetInputData(mergedCenterlines)
assignAttribute.Assign(self.groupIdsArrayName, vtk.vtkDataSetAttributes.SCALARS,
vtk.vtkAssignAttribute.CELL_DATA)
thresholder = vtk.vtkThreshold()
thresholder.SetInputConnection(assignAttribute.GetOutputPort())
groupId = mergedCenterlines.GetCellData().GetArray(self.groupIdsArrayName).GetValue(cellId)
thresholder.ThresholdBetween(groupId - 0.5, groupId + 0.5)
thresholder.Update()