Page history Edit this page How do I edit this website?
Original MediaWiki page

How to call a plugin with a range of parameters

The content of this page has not been vetted since shifting away from MediaWiki. If you’d like to help, check out the how to help guide!

If you want to call a plugin taking a single numerical parameter for a range of values, use a macro like this:

id = getImageID();
for (radius = 1; radius < 10; radius++) {
    run("Duplicate...", "title=slice");
    run("Gaussian Blur...", "sigma=" + radius);
    run("Select All");
    run("Add Slice");

This macro takes the current image, and makes a stack of it by adding Gaussian-blurred versions for sigma (radius) values between 1..9.

The easiest way to adjust this macro to your needs is to use the Macro Recorder to record one processing step and adjust the recorded call accordingly. For example, a call like run("Median...", "radius=2"); would have to be edited to replace the 2 by a concatenation of the variable radius, i.e. run("Median...", "radius=" + radius);.

Note: you might need to call close(); twice if the plugin you are calling processes images not in place, but rather opens a new image.