I will be analyzing pictures where I want to threshold out interesting objects and then use the particle plugin to count them etc. This will be done one a lot of pictures and I want to use a few different automatic threshold methods and a manual one to make sure that the findings are not dependent on a specific threshold setting.
The automatic ones are easy to do but for the manual one I want to save the settings for each file that I do to make sure that there is not a big difference between groups.
The question is: Is there a way to create a macro/script that opens the threshold windows, lets you set the values for the threshold and store them. And then continue the script. Any help that could point me in the right direction to get started would be very appreciated.
The closes I have gotten is
run("Threshold..."); waitForUser("select threshold, then hit OK"); getThreshold(lower,upper) print("your thresholds are; "+lower, "to "+ upper);
This does what I want but it requires the user to set the threshold press OK then hit apply. If apply is hit first it adds the mask and all value become 255. Hence, It is very sensitive to pressing buttons in the correct order.
importClass(Packages.ij.IJ); importClass(Packages.ij.plugin.frame.RoiManager); importClass(Packages.ij.gui.GenericDialog); IJ.run("Threshold");