Stop code execution until Event

Hi all :slight_smile:

On this time I’m interested in automatize some process, related with centerline quantification and data related with it.

In my code I have to put some fiducial (that can not be set before), and with this fiducial node info, made some operations. The problem becomes when the code doesn’t wait for the fiducial selection and keeps running (The code finally fail, because it don’t have the fiducial Info)

Is there a way to keep waiting the code until some event occurs, and then runs the other part of the code?

Thanks a lot for your help.

Hi -

For this issue and probably your other question you could study how the event observers work in Slicer to make everything asynchronous. E.g. this example has callbacks for markup interactions. Your code shouldn’t block, but should instead be driven by callbacks when events occur.

1 Like