Clone markups node

Hi, I need to clone a markups node but I can’t find a way to do it. I know that for volumes there is (using python):

slicer.vtkSlicerVolumesLogic().CloneVolume()

I would like to know if there’s a similar method for markups, as I would like to make multiple copies of a set of markups and apply different transforms to them.

Thanks for your help. Cheers,

Example code for this can be found here: https://www.slicer.org/wiki/Documentation/Nightly/ScriptRepository#Clone_a_node

# Get a node from SampleData that we will clone
import SampleData
nodeToClone = SampleData.SampleDataLogic().downloadMRHead()

# Clone the node
shNode = slicer.vtkMRMLSubjectHierarchyNode.GetSubjectHierarchyNode(slicer.mrmlScene)
itemIDToClone = shNode.GetItemByDataNode(nodeToClone)
clonedItemID = slicer.modules.subjecthierarchy.logic().CloneSubjectHierarchyItem(shNode, itemIDToClone)
clonedNode = shNode.GetItemDataNode(clonedItemID)
2 Likes

Thanks, it works perfectly.