Calculating length of peaks (plot profile)

Hi people,
I would like to have some help in analysing the lenght of peaks on plot profile. When I draw a line in my image, through plot profile I can set the range of intensity that I want to analyse; but I do not know how to calculate the sum of the length of each peak.
Do you know any plugin I can use?
I saw maybe “Find peaks” from BAR could help me, but I do not get download this plugin.
Thank your for any help you can provide.

Eg: I need to know X1+X2+X3…

What do you mean by length? The cumulative sum of the heights or of the widths?

Hi
@Monara

Without using BAR.
You have a proposal there:

I hope this helps.

Hi, I mean the widths.

Thank you, but it is the BAR plugin and I don’t get download it.

Hello @Monara
Please find help below.
I use “Plot Profile” in Image J. (without BAR.):

  • an image for the test
  • a macro

20191217_Mathew_Intervalles dans un profil.tif (768.2 KB)

// Macro "20191217_Intervalles dans un profil"

run("Plot Profile");
IJ.renameResults("Plot Values","Results");

// Define the array
X2Array = newArray(nResults);
X1Array = newArray(nResults);

// loop
for ( i=1; i<nResults-1; i++ ) 
{
if(getResult("Y", i)==0 && getResult("Y", i-1)>0 )
X2Array[i] =  getResult("X", i);
if(getResult("Y", i)>0 && getResult("Y", i-1)==0)
X1Array[i] =  getResult("X", i);
}

// Close window
if (isOpen("Results")) { 
selectWindow("Results"); 
run("Close"); 
}

//look at the array
X2 = Array.deleteValue(X2Array,0 );
X1 = Array.deleteValue(X1Array,0 );
Array.show("Interval (indexes)", X2,X1);
exit( );

Thank you all for the help,
I got the macro.
Regards,
Monara

Below the macro sent by Mr. Gluender (Muenchen) which works perfectly:

// thresholded cumulative width
thresh = 1000;
a = getProfile();
width = 0;
for (i=0; i<a.length; i++) if ((a[i]-thresh)>0) width++;
toScaled(width);
print(width);
exit();
//////////////////////

Thank you,
Monara

1 Like

Hi Mathew,
I also tried your macro, but it does not work. Have you tried on that image?

Monara