Hello, I am looking for some suggestions on how to open two similar named images simultaneously. I am attempting to create ROI’s on one image from a segmented version of the same image via color thresholding of my classified image with two classes. The reason is that I need to create ROI’s on the real image because classifying the images I am analyzing is variable in it’s accuracy as they are macro images and sunlight plays a factor.
My goal is to use this for batch processing.
trainingimage3.classified.tif (2.3 MB) trainingimage3.tif (6.8 MB)
in my current macro, the classified image is “select image(2)”
Thank you community for any advice you might have.
Ken
Sample image and/or code
selectImage(2);
run(“Duplicate…”,“v2”);
selectImage(2);
run(“RGB Color”);
// Color Thresholder 2.1.0/1.53c
// Autogenerated macro, single images only!
min=newArray(3);
max=newArray(3);
filter=newArray(3);
a=getTitle();
run(“RGB Stack”);
run(“Convert Stack to Images”);
selectWindow(“Red”);
rename(“0”);
selectWindow(“Green”);
rename(“1”);
selectWindow(“Blue”);
rename(“2”);
min[0]=255;
max[0]=255;
filter[0]=“pass”;
min[1]=0;
max[1]=0;
filter[1]=“pass”;
min[2]=0;
max[2]=0;
filter[2]=“pass”;
for (i=0;i<3;i++){
selectWindow(""+i);
setThreshold(min[i], max[i]);
run(“Convert to Mask”);
if (filter[i]==“stop”) run(“Invert”);
}
imageCalculator(“AND create”, “0”,“1”);
imageCalculator(“AND create”, “Result of 0”,“2”);
for (i=0;i<3;i++){
selectWindow(""+i);
close();
}
selectWindow(“Result of 0”);
close();
selectWindow(“Result of Result of 0”);
rename(a);
// Colour Thresholding-------------
wait(2000);
selectImage(2);
run(“RGB Color”);
// Color Thresholder 2.1.0/1.53c
// Autogenerated macro, single images only!
min=newArray(3);
max=newArray(3);
filter=newArray(3);
a=getTitle();
call(“ij.plugin.frame.ColorThresholder.RGBtoYUV”);
run(“RGB Stack”);
run(“Convert Stack to Images”);
selectWindow(“Red”);
rename(“0”);
selectWindow(“Green”);
rename(“1”);
selectWindow(“Blue”);
rename(“2”);
min[0]=183;
max[0]=194;
filter[0]=“pass”;
min[1]=97;
max[1]=105;
filter[1]=“pass”;
min[2]=27;
max[2]=37;
filter[2]=“pass”;
for (i=0;i<3;i++){
selectWindow(""+i);
setThreshold(min[i], max[i]);
run(“Convert to Mask”);
if (filter[i]==“stop”) run(“Invert”);
}
imageCalculator(“AND create”, “0”,“1”);
imageCalculator(“AND create”, “Result of 0”,“2”);
for (i=0;i<3;i++){
selectWindow(""+i);
close();
}
selectWindow(“Result of 0”);
close();
selectWindow(“Result of Result of 0”);
rename(a);
// Colour Thresholding-------------
wait(2000);
selectImage(2);
run(“Analyze Particles…”, “size=10-Infinity show=[Count Masks] display clear add”);
roiManager(“Deselect”);
roiManager(“combine”);
roiManager(“delete”);
roiManager(“add”);
roiManager(“select”,0);
roiManager(“rename”, “waxmass”);
selectImage(1);
run("*From ROI Manager [F5]");
close(“ROI Manager”);
wait(2000);
selectImage(3);
run(“Analyze Particles…”, “size=10-Infinity show=[Count Masks] display clear add”);
roiManager(“Deselect”);
roiManager(“combine”);
roiManager(“delete”);
roiManager(“add”);
roiManager(“select”,0);
roiManager(“rename”, “rhytidome”);
selectImage(1);
run("*From ROI Manager [F5]");
close(“ROI Manager”);
close("\Others");