Calculate bubble volume

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

Calculate bubble volume

Dimitris Karampalis
Hello all,
I would like to calculate the total volume of the bubbles in pictures like the one that I've attached. Could anyone help me with that please?Thanks in advance for your time.

Dimitris



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

img_000001576_Default_000.tif (1M) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Calculate bubble volume

Rocco D'Antuono
Hi Dimitri, I would do an approximation as follow:
-since you have not a z-stack (so you cannot segment the whole object), assume that the bubbles are quite round objects, without any large irregularity; this give me a sphere in 3D;
- measure Feret's diameter (see http://rsbweb.nih.gov/ij/docs/guide/146-30.html#toc-Subsection-30.7) and take a mean value between "Feret" and "MinFeret" measurements;
- from the diameter "d", calculate the volume V=(4*pi*(d/2)^3)/3.
Hope this would help,
best regards,
Rocco

Senior Microscopist
Crick Advanced Light Microscopy facility (CALM)
The Francis Crick Institute
1 Midland Road, NW1 1AT, London (UK)
https://roccodant.github.io/
Reply | Threaded
Open this post in threaded view
|

Re: Calculate bubble volume

karwas90
Hello Rocco,

Thank you very much for your useful approach.
My main isssue is how to detect the bubbles and then apply the analysing commands.
Do you have any idea about it?

Best,

Dimitris
Reply | Threaded
Open this post in threaded view
|

Re: Calculate bubble volume

Romain Guiet
In reply to this post by Dimitris Karampalis
Hi Dimitris,

You will find below some suggestions and a macro regarding the measurement of the bubbles’ volume.

1 – image saturation : your image is saturated (and a lot). You should consider to decrease the exposure time of your acquisition. Indeed saturated pixels could be considered as (walking) dead pixels. They do not give any information + they make the detection more difficult and less accurate + they make the processing less robust. So, DO NOT acquire saturated images, please.

2 – Pixel size : what is the minimal size of the bubbles that you would like to quantify ?
Many of them are too small to be accurately detected. I don’t know much about your experiment but if you expect that the tiny bubbles population could change from one condition to another you should adapt your pixel size (objective, c-mount, …).

You will find below a macro (that work not so badly on the precise image you provided), but considering point 1- and 2- , it could be less accurate on a different image.

The macro contains some parameters that you could tune.

Results are in pixel, pixel^2, pixel^3 respectively for radius, area, volume.
Knowing your objective magnification,  c-mount, pixel size on the chip of your camera and the binning during the acquisition you should be able to do the math and get the metric values.


Cheers,

Romain

////////////////////////////////////////////////////////////////////////////// start of the macro
/*
 * Goal  : Measure Volume of bubbles on a 2D image
 *
 * Strategy : Measure area of each bubble, approximate a radius and calculate a volume
 *
 * IP Strategy :
 * - get seed points, using find maxima on a blured image
 * - detect bubbles boundaries, using Level sets with the previously detected seed points
 * - analyze particles to keep only the roundish objects
 * - from the area, calculate the radius and volume and populate back the result table
 */


////////////////////////////////////////////////////////////////////////////// start of the macro
closeImages = false;
roiManager("Reset");
run("Clear Results");

////////////////////////////////////////////////////////////////////////////// set the measurements
run("Set Measurements...", "area limit display redirect=None decimal=3"); // area, limited to threshold, display label

title = getTitle(); // get the title of the original image to select it later

////////////////////////////////////////////////////////////////////////////// detect the center of the bubbles
run("Duplicate...", "title=gb2"); //
run("Gaussian Blur...", "sigma=2"); // apply a gaussian blur
run("Find Maxima...", "noise=10 output=[Point Selection] light"); // and look for local maxima to retrieve the center, use as seed points at the next step

////////////////////////////////////////////////////////////////////////////// detect bubbles boundaries
selectImage(title); //
run("Duplicate...", "title=med2"); //
run("Median...", "radius=2"); // denoise a bit before using level sets
run("Restore Selection"); // restore the (previously detected) seed points on this image
                                                                                                                                                        // and use level sets (you can try different parameters)
run("Level Sets", "method=[Active Contours] use_fast_marching grey_value_threshold=40 distance_threshold=0.30 advection=2.20 propagation=1 curvature=1 grayscale=50 convergence=0.0050 region=outside");
selectImage("Segmentation of med2"); //
run("Invert"); // invert the image (for the analyze particles step)
rename(title+"-mask"); // rename the image so the rows in result table mention the current image analyzed

////////////////////////////////////////////////////////////////////////////// detect roundish particles, calculate radius ...
selectImage(title+"-mask");
run("Analyze Particles...", "size=5-Infinity circularity=0.80-1.00 display add"); // you can change circularity parameters

Vtotal = 0 ;
resultNbr = nResults;
for ( rowIndex = 0 ; rowIndex < resultNbr ; rowIndex++){
        area = getResult("Area", rowIndex);
        radius = sqrt( area / PI) ;
        Volume = 4 * PI * pow(radius,3) / 3 ;
        setResult("radius",rowIndex,radius);
        setResult("Volume",rowIndex,Volume);
        Vtotal = Vtotal + Volume;
}
////////////////////////////////////////////////////////////////////////////// print the total volume
print("Vtotal : "+title+" = "+Vtotal);

////////////////////////////////////////////////////////////////////////////// prepare an ouput image
selectImage(title);
roiManager("Show All without labels");
run("Flatten");
rename(title+"-results");

if (closeImages){
////////////////////////////////////////////////////////////////////////////// close unnecessary images
        selectImage("gb2");
        close();
        selectImage("med2");
        close();
        selectImage(title+"-mask");
        close();
}

////////////////////////////////////////////////////////////////////////////// end of the macro

---------------------------------------------------------------
Dr. Romain Guiet
Bioimaging and Optics Platform (PT-BIOP)
Ecole Polytechnique Fédérale de Lausanne (EPFL)
Faculty of Life Sciences
Station 19, AI 0140
CH-1015 Lausanne

Phone: [+4121 69] 39629
http://biop.epfl.ch/
---------------------------------------------------------------

________________________________________
De : ImageJ Interest Group [[hidden email]] de la part de Dimitris Karampalis [[hidden email]]
Envoyé : lundi 14 septembre 2015 15:10
À : [hidden email]
Objet : Calculate bubble volume

Hello all,
I would like to calculate the total volume of the bubbles in pictures like the one that I've attached. Could anyone help me with that please?Thanks in advance for your time.

Dimitris



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

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