My final goal is to measure cross-section area of arterial segments.
The image below shows a segmented aorto-iliac aneurysm with a centerline in theaorta and the left iliac artery. The cross-section is moved along the Centerline Model with Cross-Section analysis module.
At the iliac level, two islands of the same segment are naturally drawn in the Red slice view. The code below gets the contour of both iliacs in an array of points, and creates a model with a 2D Delaunay filter. It’s necessarily a single model, corresponding to the array input.
def TryCut(self, center, normal):
segmentation = slicer.util.getNode("Output Volume_1-segmentation")
segment = segmentation.GetSegmentation().GetSegment("Output Volume_1")
plane = vtk.vtkPlane()
plane.SetOrigin(center)
plane.SetNormal(normal)
closedSurfacePolyData = vtk.vtkPolyData()
segmentation.GetClosedSurfaceRepresentation("Output Volume_1", closedSurfacePolyData)
planeCut = vtk.vtkCutter()
planeCut.SetInputData(closedSurfacePolyData)
planeCut.SetCutFunction(plane)
planeCut.Update()
if self.cutModelNode is not None:
slicer.mrmlScene.RemoveNode(self.cutModelNode)
self.cutModelNode = slicer.modules.models.logic().AddModel(planeCut.GetOutputPort())
cutModelDisplayNode = self.cutModelNode.GetDisplayNode()
cutModelDisplayNode.SetColor(0,0,1)
cutModelDisplayNode.SetOpacity(1.0)
delaunay = vtk.vtkDelaunay2D()
delaunay.SetInputData(self.cutModelNode.GetPolyData())
self.cutModelNode.SetPolyDataConnection(delaunay.GetOutputPort())
I wish to be able to splt the array output of vtkCutter in as many islands as there may be, identify each island array and get hold of each of them. This would permit to create a model around the current centerline point only.
I don’t know if it is possible at all, simply would be best. I suppose it should be possible, because the Islands module does manage unconnected objects, but I don’t have a signe clue how this could be done simply.
Thanks for any input.