Restore selection error, cannot reset selection

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

Restore selection error, cannot reset selection

JRMerritt
I am trying to run a macro which allows me to analyze an image of tissue; however, some of my images have white background space. I do not want to include white space in my analysis. Right now, I take a polygonal selection of my tissue if there is white space. If I do not take a polygonal selection, I want the macro to select the entire image (no white space).

When I run my script, I can select some or all of the first image. Then, the second image I open receives the last image's selection, which is reflected in my area in the Results table.

This is my code:

macro 'macror [j]'{
run("8-bit");
setAutoThreshold();
//run("Threshold...");
setThreshold(0, 105);
run("Threshold", "thresholded remaining black");
run("Restore Selection");
run("Set Measurements...", "area area_fraction display redirect=None decimal=3");
run("Measure");
setResult("Label", nResults-1, getTitle());
updateResults();
run("Select All");

}

How can I reset my selection to 'select all' after using a polygon selection on a subset of the previous image?