Re: colour thresholding

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Re: colour thresholding

Kashif Zeeshan
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------------
Reply | Threaded
Open this post in threaded view
|

Re: colour thresholding

Kashif Zeeshan
Thanks David. Your suggestions are really very helpful for me. So nice of
you. Due to your previous and current suggestions, I am being able to
analyse my images almost perfectly in the way I want.

Thanks a lot to all of experts which are always there when we need.

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 12:19
À : Kashif Zeeshan
Objet : Re: colour thresholding


If you want a really simple way to do this.

Start the macro recorder, then do this:

1) load the target image
2) Image->Color->RGB split
3) Select the blue channel
4) Select the ImageJ threshold function
5) Change the parameters using the silder bars to whatever you want
6) Hit the "Apply" button

It should generate code something like this:

run("RGB Split");
setAutoThreshold();
setThreshold(0, 152);
run("Convert to Mask");

If you want to recombine the RGB images, use the Image-> Color-> RGB Merge
function.

Regards,
Dave Randell