Import 2017-06-07 23:51:09: master 262acf03

Author Committer Branch Timestamp Parent
jcfr jcfr master 2014-09-12 01:30:49 master f163743f
Changeset

ENH: Update AddMarkup/Fiducial API to optionally accept the label.

When calling the AddMarkup/AddFiducial method, a default
label is associated. That said, it is not uncommon to create markup
or fiducial with a custom label.

For example, within a python script, before this commit, the following
could be done to add a fiducial and set its label:

fiducialIndex = markups.AddFiducial(x, y, z)
markups.SetNthMarkupLabel(fiducialIndex, "Foo")

The first issue is that the event 'MarkupAddedEvent' was triggered before the
label was set. Since when the markup is added an hypothetical callback
could retrieve other data structure based on the label, it is more
complex to do the book-keeping if the callback can't make use of the
label.

This commit ensures that callback connected to "MarkupAddedEvent" will
be able to get the custom label value.

The second issue is that the "Markup" structure is not wrapped in python.
That means it is not possible to pre-initialize a markup structure
before adding it using "AddMarkup(Markup markup)"

Note that ideally, it should be possible to pass other properties
to initialize the markup in python or c++ before the "MarkupAddedEvent"
is invoked. This commit is a trade-off between changing the Markup
structure into a more heavy weight vtkObject (so that it is wrapped) and
not being able to set the label before "MarkupAddedEvent" is invoked.

git-svn-id: http://svn.slicer.org/Slicer4/trunk@23672 3bd1e089-480b-0410-8dfb-8563597acbee

mod - Modules/Loadable/Markups/MRML/vtkMRMLMarkupsFiducialNode.cxx Diff File
mod - Modules/Loadable/Markups/MRML/vtkMRMLMarkupsFiducialNode.h Diff File
mod - Modules/Loadable/Markups/MRML/vtkMRMLMarkupsNode.cxx Diff File
mod - Modules/Loadable/Markups/MRML/vtkMRMLMarkupsNode.h Diff File