Re: Problem with ROI Manager in BatchMode
Posted by Winfried Wurm on
URL: http://imagej.273.s1.nabble.com/Problem-with-ROI-Manager-in-BatchMode-tp3682680p3682681.html
Thank you Peter for trying to solve my Problem.
But my Problems seems to have another reason. Actually I solved my Problem today, but I have to admit that I don´t know why the Macro is working now....
It seems to me now that the Problem was another Function that I run before the Foci counting part that I posted yesterday. That function is measuring the Area of Chromocenters. When I turned it off or behind the Foci measuring today everything worked fine. But I don’t know why! The function measures in a completely different Image and shares no variable with the Foci measuring function. And when I call that function AFTER the Foci Funtion there is no Problem.
So why is that working?
CountMeasureFoci("cell.tif","foci.tif",px[con],mpx[con],msl[con]);
cellarea=Cellar("cellar.tif");
chromarea=Cellar("chrom.tif");
And this not?
cellarea=Cellar("cellar.tif");
chromarea=Cellar("chrom.tif");
CountMeasureFoci("cell.tif","foci.tif",px[con],mpx[con],msl[con]);
And why did the Problem only occur in BatchMode? I have no Idea what has happend. Maybe someone can tell what went wrong? Because even if it works now. I would like to understand why.
Here is the function that seems to make the Problem:
function Cellar(window)
{
selectWindow(window);
area=0;
for(z=1;z<=nSlices;z++)
{
setSlice(z);
run("Select None");
run("Measure");
if (getResult("Max")==255)
{
for(x=1;x<getWidth;x++)
{
makeRectangle(x, 0, 1, getHeight);
run("Measure");
if (getResult("Max")==255)
{
for(y=1;y<getHeight;y++)
{
if(getPixel(x,y)==255)
{
doWand(x-1,y);
run("Measure");
m=getResult("Area");
area+=m;
run("Fill", "slice");
makeRectangle(x, 0, (getWidth-x), getHeight);
run("Measure");
if (getResult("Max")==255)
{
makeRectangle(x, 0, 1, getHeight);
run("Measure");
if (getResult("Max")<255)
y=getHeight;
}
else
{
x=getWidth;
y=getHeight;
}
}
}
}
}
}
}
return area;
}