Hi,
I am writing a module where I need to use threshold and scissors from the Segment Editor.
If I run the following code in the console it works as expected and I can draw the ROI but when I copy the code to my module, the thresholding is done and the cursor changes to the scissor icon but I cannot create the ROI. Any suggestions?
If I put my code in a function on the console I have the same behavior so I need to pause for user input inside the function. What is the best way to do that?
Hello Mark, I have the same issue.
I’m using application startup script from Slicer. From my pyhton script, I managed to perform a few segmentation operations such as Tresholding and Smoothing, but then I’d like to create a rectangle shape from scissors and then Erase Outside.
I keep having the same mistake :
AttributeError: qSlicerSegmentEditorScissorsEffect has no attribute named ‘onApply’
which pauses further processing until the user presses the enter key in the python console.
I didn’t like this solution so now the user adds a markup ROI and then a binary mask is created from the markup points. Our images are very low resolution so using markups allows the user to adjust the ROI until they are satisfied with the result.
Ok I understand and that’s what I thought.
However, I was wondering if it could be possible with a python scrip because I read topic “Scissors segment editor effects from a script” and thought it could be possible to draw a shape (a rectangle for instance) inside a segment and then erase outside the shape.
Tell me if i’m wrong or if I missunderstood.
Here is a complete example. As previously mentioned, I could not work out how to avoid using keyboard input in the python console and using markups is better in my application.