Matteboo
(Matteboo)
September 4, 2023, 10:10am
1
Hello,
I want to obtain the convex hull of a segment. (I don’t know how to upload an nrrd file but I can give it necessary)
I saw this conversation but I can’t figure out what node I should get.
I want to use this snippet of code
modelNode = getNode('mySurface')
convexHull = vtk.vtkDelaunay3D()
convexHull.SetInputData(modelNode.GetPolyData())
outerSurface = vtk.vtkGeometryFilter()
outerSurface.SetInputConnection(convexHull.GetOutputPort())
outerSurface.Update()
modelNode.SetAndObservePolyData(outerSurface.GetOutput())
But I don’t know what I should put in ‘mysurface’
From my understanding I should put the name of an vtkMRMLModelNode so that I can call GetPolyData()
However when I do getNode(‘mysegmentation’) I get a vtkMRMLSegmentationNode
I don’t know how to get the vtkMRMLModelNode could you help me with that ?
Or if you have another way to get the convec hull that works too
pieper
(Steve Pieper (Isomics, Inc.))
September 4, 2023, 1:49pm
2
Probably you want one of these methods:
/// Export segment to representation MRML node.
/// 1. If representation node is a labelmap node, then the binary labelmap representation of the
/// segment is copied
/// 2. If representation node is a model node, then the closed surface representation is copied
/// Otherwise return with failure.
static bool ExportSegmentToRepresentationNode(vtkSegment* segment, vtkMRMLNode* representationNode);
/// Export multiple segments into a folder, a model node from each segment
/// \param segmentationNode Segmentation node from which the the segments are exported
/// \param segmentIds List of segment IDs to export
/// \param folderItemId Subject hierarchy folder item ID to export the segments to
static bool ExportSegmentsToModels(vtkMRMLSegmentationNode* segmentationNode,
const std::vector<std::string>& segmentIDs, vtkIdType folderItemId);
Matteboo
(Matteboo)
September 20, 2023, 1:52pm
3
Thanks you I managed to make it work