Problem using ImageJ

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

Problem using ImageJ

Odeline Dumas
Dear reader,

I don't know if I'm in the right place to ask a question. My colleagues don't know how to answer it, so I didn't have many more possibilities than to contact you. I would like to measure the total perimeter of the interface between the red phase and the black phase (see here attached). As you can see on the attached picture, I have some issues. More precisely, an area on the left is not taken into account and all the black grains surrounded by red (or vice versa) are not taken into account even though I ticked 'include holes'. Can you help me?

Thank you in advance,

Odeline Dumas



--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html

ImageJ.png (995K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Problem using ImageJ

Jeremy Adler
Hej Odeline,

The exclude on edges problem.

A solution
1) Measure the perimeter with exclude on edges OFF - the perimeter measurement includes the contact with edge of the image and is too large

2) Find the area of edge contact
Create a selection (Edit/ selection/ Create Selection) that is 2 pixels smaller than your image
And set the position to 1,1 with x and y size  set to 2 pixels less than the image size.
Now invert this selection  (Edit/ Selection/ Invert) - you now have selected a 1 pixel strip around the edge
Measure this - the area (not the perimeter) is the extra perimeter  included in perimeter measured by 1).

Subtract the area from the perimeter.

Jeremy Adler




-----Original Message-----
From: ImageJ Interest Group <[hidden email]> On Behalf Of Odeline Dumas
Sent: Monday, November 16, 2020 10:59 AM
To: [hidden email]
Subject: Problem using ImageJ

Dear reader,

I don't know if I'm in the right place to ask a question. My colleagues don't know how to answer it, so I didn't have many more possibilities than to contact you. I would like to measure the total perimeter of the interface between the red phase and the black phase (see here attached). As you can see on the attached picture, I have some issues. More precisely, an area on the left is not taken into account and all the black grains surrounded by red (or vice versa) are not taken into account even though I ticked 'include holes'. Can you help me?

Thank you in advance,

Odeline Dumas



--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html








När du har kontakt med oss på Uppsala universitet med e-post så innebär det att vi behandlar dina personuppgifter. För att läsa mer om hur vi gör det kan du läsa här: http://www.uu.se/om-uu/dataskydd-personuppgifter/

E-mailing Uppsala University means that we will process your personal data. For more information on how this is performed, please read here: http://www.uu.se/en/about-uu/data-protection-policy

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html
Reply | Threaded
Open this post in threaded view
|

Re: Problem using ImageJ

Michael Schmid
In reply to this post by Odeline Dumas
Hi Odeline,

the 'perimeter' reported by ImageJ is only the outer perimeter of a
particle, it does not include the perimeter of inner holes or particles
in these holes.
Here is a macro that measures the total perimeter, including the inner
perimeters. It does that inverting the particles to reveal the inner
holes. this process is repeated to revel particle in the inner holes,
etc., until nothing is left.


saveSettings();
run("Clear Results");
run("Create Mask");
id=getImageID();
do {
   run("Set Measurements...", "perimeter redirect=None");
   run("Analyze Particles...", "  show=Masks display include");
   run("Create Selection");
   close();
   selectImage(id);
   run("Restore Selection");
   run("Invert");
   getStatistics(area, mean, min, max);
} while (max != 0);
selectImage(id);
close();
totalPerim=0;
for (i=0; i<nResults(); i++)
   totalPerim = totalPerim + getResult("Perim.", i);
print("total perimeter = "+totalPerim);
restoreSettings();


Note that the total perimeter measured this way also includes the
perimeter at the borders of the image, although these are usually not
true particle borders. Unless the density of particle borders in the
image is high, this can make a substantial difference, and one should
correct for it. The most simple approximation would be subtracting the
pixel length for each edge pixel.
For your test image, my macro reports a total perimeter of 39545; this
overestimates the perimeter per area by about 2%. So it should not be an
issue; the errors due to pixel quantization noise and the simple
algorithm used for measuring the perimeter are worse.

[As a side remark, in the future please use more verbose subject lines
on the mailing list; something like "perimeter including inner holes"
would make it easier to find it on the list server. I did not change the
subject because this would make it more difficult to follow which post
is which thread.]

Michael
________________________________________________________________


On 16.11.20 10:59, Odeline Dumas wrote:
> Dear reader,
>
> I don't know if I'm in the right place to ask a question. My colleagues don't know how to answer it, so I didn't have many more possibilities than to contact you. I would like to measure the total perimeter of the interface between the red phase and the black phase (see here attached). As you can see on the attached picture, I have some issues. More precisely, an area on the left is not taken into account and all the black grains surrounded by red (or vice versa) are not taken into account even though I ticked 'include holes'. Can you help me?
>
> Thank you in advance,
>
> Odeline Dumas

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html
Reply | Threaded
Open this post in threaded view
|

Re: Problem using ImageJ

Kenneth Sloan-2
In reply to this post by Jeremy Adler
Just curious - can't this edge effect problem be solved by setting an ROI a bit smaller than the full image?

I don't use the built-in ImageJ functions for such things - but I usually handle edge-effects by excluding a buffer region surrounding the area actually measured (how big the buffer is depends on the details of what is being measured).

--
Kenneth Sloan
[hidden email]
Vision is the art of seeing what is invisible to others.

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html