Login  Register

Re: Save values & Popup window

Posted by Ihiertje on Oct 25, 2016; 6:47am
URL: http://imagej.273.s1.nabble.com/Save-values-Popup-window-tp5017455p5017467.html

Hi Herbie,

Thank you for your effert and time. Unfortunately my code is not working yet.
The textfile thresholds is made, however in de debug screen it is stored as follows: file ="~0~". So it won't recognizes where it is stored I think. This is also the reason I think that nothing gets printed in it. When running this part of the code no error is given.

file=File.open(Output+"Thresholds.txt")
print(file, "Minimum threshold: "+lower + "\n")

Do you maybe have an idea how to solve this?

Thanks a lot.

Iris

2016-10-24 17:10 GMT+02:00 Herbie [via ImageJ] <[hidden email]>:
Iris,

this is part 2 of my answer.

Here is the macro code:

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

txt_file = File.open( "Thresholds.txt" );
print( txt_file, "Minimum threshold: " + lower + "\n" );
print( txt_file, "Maximum threshold: " + upper );
/////////////////////////////////

getNumber( "Minimum", lower );

Does the latter help with your last question?

Best

Herbie

::::::::::::::::::::::::::::::::::::::
Am 24.10.16 um 16:11 schrieb Ihiertje:

> 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
>
>
>
> --
> View this message in context: http://imagej.1557.x6.nabble.com/Save-values-Popup-window-tp5017455.html
> Sent from the ImageJ mailing list archive at Nabble.com.
>
> --
> ImageJ mailing list: http://imagej.nih.gov/ij/list.html
>
--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html



If you reply to this email, your message will be added to the discussion below:
http://imagej.1557.x6.nabble.com/Save-values-Popup-window-tp5017455p5017459.html
To unsubscribe from Save values & Popup window, click here.
NAML