Login  Register

Re: colour thresholding

Posted by Kashif Zeeshan on Jun 18, 2008; 9:03am
URL: http://imagej.273.s1.nabble.com/Re-colour-thresholding-tp3695857.html

Thanks for your reply. Actually, my objective was to search a simple macro
that can be used in this case. The macro you send is really a coding and its
too difficult for me to use this because I am not understanding all the
terms and when I try to run this macro command by command, it doesn’t work
also. It works when I run as a whole. (I have tested the ancient macro sent
by you). The reason is probably the different ImageJ because most of the
time I use MacBiophotonics ImageJ. For the moment, I will do manually and
meanwhile I will try to understand the things in detail.

Thanks again for your kind help.

Cordially.

Kashif ZEESHAN
(00 33 6 74 90 18 10)
Doctorant, Biopesticide Group,
Laboratoire Universitaire de
Biodiversité et d'Ecologie
Microbienne (LUBEM),
6 Rue de l'Université,
29334, Quimper Cedex,
France

-----Message d'origine-----
De : David Randell [mailto:[hidden email]]
Envoyé : mercredi 18 juin 2008 10:53
À : Kashif Zeeshan
Cc : [hidden email]
Objet : colour thresholding

Open up a new macro window, paste and run this code stub - appended.  Does
it
work OK?

Dave Randell


// Colour Thresholding v1.8-------
// Autogenerated macro, single images only!
// G Landini 5/Jan/2007.
//
// This only works with Black background and White foreground!
// You will probably have to uncomment the following 2 lines if
// the settings in ImageJ are not so:
//
//run("Colors...", "foreground=white background=black selection=yellow");
//run("Options...", "iterations=1 black count=1");
//
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]=0;
max[0]=255;
filter[0]="pass";
min[1]=0;
max[1]=255;
filter[1]="pass";
min[2]=0;
max[2]=135;
filter[2]="pass";
for (i=0;i<3;i++){
  selectWindow(""+i);
  setThreshold(min[i], max[i]);
  run("Make Binary", "thresholded remaining");
  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");
rename(a);
// Colour Thresholding------------