User selection macro

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

User selection macro

knels
Hi

I'm pretty new to writing macros in imagej. I am trying to design a macro that would process an image in a few ways. But I want to have an option to run the macro again with all commands being the same except with a user prompt to adjust the threshold (increase or decrease at user's desecration).

Is this possible? An example of what I mean is below:

run("RGB Stack");
setSlice(1)
run("Set Scale...", "distance=197.75 known=50 pixel=1 unit=um");
run("Bandpass Filter...", "filter_large=160 filter_small=3 suppress=None tolerance=5 autoscale saturate");
setAutoThreshold();
getThreshold(min, max)
setThreshold(0, 100);
run("Convert to Mask", "method=Default background=Light calculate");


///User is given a prompt that asks to increase or decrease threshold//////

based on user's choice, the macro would run the same but with a different like setThreshold(100, 255);


Sorry if this question is confusing!

Best,
Knels
Reply | Threaded
Open this post in threaded view
|

Re: User selection macro

Krs5
Hi Knels,

Yes, this is possible. You can use

run("RGB Stack");
setSlice(1)
run("Set Scale...", "distance=197.75 known=50 pixel=1 unit=um"); run("Bandpass Filter...", "filter_large=160 filter_small=3 suppress=None
tolerance=5 autoscale saturate");
setAutoThreshold();

waitForUser("Set the threshold and select\"OK\".");

run("Convert to Mask", "method=Default background=Light calculate");

Best wishes

Kees

Dr Ir K.R. Straatman
Senior Experimental Officer
Advanced Imaging Facility
Centre for Core Biotechnology Services
University of Leicester
http://www2.le.ac.uk/colleges/medbiopsych/facilities-and-services/cbs/lite/aif

ImageJ workhops 1 and 2 June: http://www2.le.ac.uk/colleges/medbiopsych/facilities-and-services/cbs/AIF/workshops/imagej-workshops-June-2017

-----Original Message-----
From: knels [mailto:[hidden email]]
Sent: 31 March 2017 18:41
To: [hidden email]
Subject: User selection macro

Hi

I'm pretty new to writing macros in imagej. I am trying to design a macro that would process an image in a few ways. But I want to have an option to run the macro again with all commands being the same except with a user prompt to adjust the threshold (increase or decrease at user's desecration).

Is this possible? An example of what I mean is below:

run("RGB Stack");
setSlice(1)
run("Set Scale...", "distance=197.75 known=50 pixel=1 unit=um"); run("Bandpass Filter...", "filter_large=160 filter_small=3 suppress=None
tolerance=5 autoscale saturate");
setAutoThreshold();
getThreshold(min, max)
setThreshold(0, 100);
run("Convert to Mask", "method=Default background=Light calculate");


///User is given a prompt that asks to increase or decrease threshold//////

based on user's choice, the macro would run the same but with a different like setThreshold(100, 255);


Sorry if this question is confusing!

Best,
Knels



--
View this message in context: http://imagej.1557.x6.nabble.com/User-selection-macro-tp5018429.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