Creation of a 3D ROIs
Posted by Galathorn on Mar 12, 2014; 10:41am
URL: http://imagej.273.s1.nabble.com/Creation-of-a-3D-ROIs-tp5006882.html
Hi all,
I would like to create a rectangular 3D ROI grid to measure the spatial homogeneity of particles in a 3D volume. I tried the following macro but it only works in 2D. When I make a 3D object and if I modify the macro adding a third component it doesn't work... I'm not very good for coding macros, I found the model of the code for 2D ROI grid in this forum. Any idea? Thanks.
x = 130;
y = 80;
width =160;
height = 160;
spacing = 0;
numRow = 4;
numCol = 4;
for(i = 0; i < numRow; i++)
{
for(j = 0; j < numCol; j++)
{
xOffset = j * (width + spacing);
print(xOffset);
yOffset = i * (height + spacing);
print(yOffset);
makeRectangle(x + xOffset, y + yOffset, width, height);
roiManager("Add");
if (roiManager("count") > 500)
{
print("Maximum reached: 500 entries have been created.");
exit;
}
}
}