Is there a way to wait until certain condition are met before continuing and deleting nodes in using a python script

(Kevin) #1

I am currently going through directories, grabbing fcsv and image pairs, and then loading them into slicer using a python script.

Image/fcsv loading
[success, markupNode] = slicer.util.loadMarkupsFiducialList(fcsv, returnNode=True)
[success, imageNode] = slicer.util.loadVolume(image, returnNode=True)

#want to wait here until some condition is met

Node deletion

My goal is to be able to somehow wait inbetween the reading and the removing of the node, so I can check the fcsv files for accuracy and edit them if possible.

Is there a way to do this?

I tried using a simple input() command to wait for an enter keypress , but I get an ‘EOFError: EOF when reading a line’ when trying to do this

(Jean Christophe Fillion Robin) #2

It looks like you want to continuous the processing once the user had an opportunity to validate the content of the files by inspecting the loaded image and markups.

To achieve this, you could look at what is done

(Kevin) #3

Thanks, Ill take a look at this.

I found a workaround using raw_input() that waits for an enter press command, but the embedded python in 3d slicer requires you to enter 3 characters before the input is interpreted as a string/keypress.

otherwise it gives you an EOFError, which im thinking is because it places the start of the user input before the ‘>>>’ that ive seen used by python in other places