How to replicate the behavior of "remove all markups from the active list" from the module "markups"


(ZiyunLiang) #1

Hi, everyone!
I’m writing a scripted module and I want to replicate the behavior of “remove all markups from the active list” from the module “markups” to my module. I have already replicated the behaviors like adding fiducials and get the coordinates of the fiducials but I just cannot replicate the one to delete fiducials.
Does anyone know how to proceed?

Thank you!
Andrea


(G Leman) #2

GetActiveListID() in the markups logic has the current id, then just RemoveAllMarkups()

markupsNode  = slicer.util.getNode( slicer.modules.markups.logic().GetActiveListID() )
markupsNode.RemoveAllMarkups()

Or just remove a single markup with:

markupsNode.RemoveMarkup(0)

which will remove the Nth Markup


(ZiyunLiang) #3

Fantastic! It worked. Thank you so much!:grin: