WaitForUserInput Timing Problem

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

WaitForUserInput Timing Problem

albstein
Hello, and thanks in advance for any help.

I am writing a Jython script in Fiji to analyze a series of images. I am running Fiji based on ImageJ 1.49d on Ubuntu  14.04. I am stuck on making the user set the threshold for each user. I want the script to pause and wait for the user to set the proper threshold level before proceeding.

To accomplish this, I have been trying to use WaitForUserInput. The relevant code snippet is below...

IJ.run("Threshold...")
WaitForUserDialog("Set threshold, then click OK.").show()

This function works as expected when called in its own file. However, when the main script calls this function, Fiji tries to display both the Threshold dialog box and the WaitForUserInput dialog box. It seems that the WaitForUserInput dialog box appears before Fiji is able to populate the Threshold dialog box with the necessary information, and then both boxes become nonresponsive. Again, this problem only emerges when the function is called by another script.

I've tried using time.delay between the dialog boxes but without success. I've also tried adding a meaningless calculation between the two dialog boxes to force the system to pause, but I wasn't successful with that approach either. With both of these approaches, the function continues to work when run in its own file and fails when called by the main script.

I'm not sure what else to try at this point, so I would greatly appreciate any suggestions.