Login  Register

Save values & Popup window

Posted by Ihiertje on Oct 24, 2016; 2:11pm
URL: http://imagej.273.s1.nabble.com/Save-values-Popup-window-tp5017455.html

Hi,

Last time I was helped very well, so I hope someone can help me again.
I have an image which I threshold manually. Afterwards I want to save the minimal and maximal value of this threshold to a textfile. This is done two times, so if the text file could be updated, that would be great.

Underneath you find my code so far. First I want to create a textfile where I can save my values. Then I want to print the text 'Minimal threshold' plus its value. However, it creates the text file, but does not print any text in it. Is there a way to print the text in the textfile and update it with the maximal threshold?

run("Threshold...");
waitForUser("set the threshold and press OK, or cancel to exit macro");
getThreshold(lower,upper)
print("your thresholds are; "+lower, "to "+ upper);  

file=File.open(Output+threshold.txt)
open(file)
print(file, "Minimal threshold"+lower+"\n");


Next to that, I would like to have a pop-up screen where some can select a value that will be used in another calculation. I found that Dialog.create could be used for this. However, normally codes like Dialog.create will change from black to a yellow collor when there typed right. With Dialog.create this does not happen and also does not show any pop-up screen when  an option with Dialog.addChoice is included.

Thank you already.

Iris