Problem with ROI Manager in BatchMode
Posted by Winfried Wurm on
URL: http://imagej.273.s1.nabble.com/Problem-with-ROI-Manager-in-BatchMode-tp3682680.html
Dear ImageJ community,
I´ve encountered some Problems by using the Batchmode together with the ROI Manager in my Macro. I wrote a Macro which counts Foci in a Binary Image, selects the Outline of the Focus in every Slice and adds it to the ROI Manager. The ROIs are than measured in a second Channel.
The Macro works fine if setBatchMode(false). But when I turn it true, the Measurements are completely nonsense.
I think that I´ve tracked the error down to the creation of the Selection in the second Channel. When I let the Macro fill the ROIs in the second Channel the ROI in every Slice has the shape of the ROI of the last added ROI, but are good when I manually select them in the ROI Manager afterwards or when BatchMode is turned off.
Since the Macro is very long I will only add the part of the Code which I think makes the trouble, the measuring in the second Channel.
At this point, the ROI Manager has a least two ROIs added.
focus++;
hc=false;
selectWindow("cell.tif");
run("Select None");
m=(roiManager("count")-1);
for(r=0;r<=m;r++)
{
roiManager("deselect");
roiManager("select",r);
arg="enlarge="+px;
run("Enlarge...", arg);
run("Measure")
if(getResult("Max")==255)
hc=true;
run("Fill", "slice");
}
selectWindow("foci.tif");
roiManager("Reset");
if(hc==true)
HC++;
else
EC++;
Can anyone help me fix this Problem?
Thx for Helping in advance
Winfried Wurm