Login  Register

Re: font size for outline labels

Posted by Gabriel Landini on Jan 11, 2008; 11:15am
URL: http://imagej.273.s1.nabble.com/font-size-for-outline-labels-tp3697609p3697611.html

 On 11 Jan 2008, at 04:34, Simon Hamlet wrote:
> I am using ImageJ to analyse leaf area. Using 200 dpi A4 scans.
> Is there a way to have the program return large sized number labels
> for the outlines when using Analyse Particles.
>
> A large part of my processing time is taken up zooming in an
> getting these numbers.

Maybe you can adapt the following macro and set the font size to do what you
want.
Mind the line breaks.

Cheers,

G.

//-----------------------8<-----------------------------------
// NumberParticles.txt
// G. Landini
// Analyses and numbers white or black particles
// Labels particles at their centre of mass (approx).
// Requires Particles8_class
//
// Do not use this macro with stacks!

requires("1.30e");
w=getBoolean("White particles?");

if(w){
  //setThreshold(127,255);
  run("Particles8 ", "white  show=Particles minimum=0 maximum=999999 display
overwrite");
  }
 else{
  //setThreshold(0,127);
  run("Particles8 ", "  show=Particles minimum=0 maximum=999999 display
overwrite");
}

run("Duplicate...", "title=Numbered");

selectWindow("Numbered");
run("RGB Color");

for (i=0; i<nResults; i++) {    
    //x = getResult('XStart', i); // start points
    //y = getResult('YStart', i);

    x = getResult('XM', i); //centre of mass
    y = getResult('YM', i);

    setColor(255, 0, 0);

    // approx the centre of mass (never sure how wide & tall the font is)
    drawString((i+1), x-5, y+5);
}
//-----------------------8<-----------------------------------