what's wrong with these codes?
Posted by Jinglei Yang on Mar 19, 2008; 5:10pm
URL: http://imagej.273.s1.nabble.com/what-s-wrong-with-these-codes-tp3696806.html
Dear ImageJ friends,
I'm a very beginner for ImageJ programming.
I write some codes to batch select a circle ROI centered in each image and rename the ROI with the same name of the image.
The codes are shown below. The question is there are always several images that cannot be selected with circle ROI, e.g., I have 35 images in a folder but only 28 or sometime 25 images are selected. I have to copy others to another folder to repeat this process.
It is so weird for me.
Can anybody help?
Many thanks,
Jinglei @ UIUC
Codes:
requires("1.38f");
dir = getDirectory("Choose a Directory ");
list = getFileList(dir);
start = getTime();
setBatchMode(true);
for (i=0; i<list.length; i++) {
path = dir+list[i];
open(path);
w=getWidth();
h=getHeight();
makeOval((w-100)/2, (h-100)/2, 100, 100);
run("Add to Manager ");
roiManager("Add");
}
for (j=0; j<list.length; j++) {
path = dir+list[j];
open(path);
title = getTitle();
roiManager("Select", j );
roiManager("Rename", title);
}