Hi,
I have a stack which has images of bubbles in front of a scratched background. I'm trying to isolate the bubbles so I can determine their sizes. I've tried a number of approaches without success. I've tried Background Subtraction. I've also tried a macro (http://www.petercollingridge.co.uk/blog/removing-background-avi-using-imagej) that gets the median background, subtracted this from my images but obtained streaks through my bubbles. I tried Image Stack Merger Plus (http://www.samuelpean.com/image-stack-merger-plus/) but had the same trouble. Any ideas on how to go about this?
![]() |
Did you try Fourier filtering? It may be able to eliminate the scratches
and preserve the bubbles. Good luck. Prof. Sidnei Paciornik Grupo de Análise de Imagens e Microscopia Digital DEMa <http://www.dema.puc-rio.br/> - Departamento de Engenharia de Materiais PUC-Rio <http://www.puc-rio.br/> Rua Marquês de São Vicente 225 Prédio Leme, Sala 501L Gávea - Rio de Janeiro - RJ 22451-900 - Brasil tel: (55)(21)3527-1243 On Thu, Jun 6, 2013 at 1:31 PM, jmcginnity <[hidden email]>wrote: > Hi,I have a stack which has images of bubbles in front of a scratched > background. I'm trying to isolate the bubbles so I can determine their > sizes. I've tried a number of approaches without success. I've tried > Background Subtraction. I've also tried a macro > ( > http://www.petercollingridge.co.uk/blog/removing-background-avi-using-imagej > ) > that gets the median background, subtracted this from my images but > obtained > streaks through my bubbles. I tried Image Stack Merger Plus > (http://www.samuelpean.com/image-stack-merger-plus/) but had the same > trouble. Any ideas on how to go about this? > < > http://imagej.1557.x6.nabble.com/file/n5003261/CIMG0053-Z3-decby2000021.jpg > > > CIMG0053-Z3-decby2000021.jpg > < > http://imagej.1557.x6.nabble.com/file/n5003261/CIMG0053-Z3-decby2000021.jpg > > > Thanks,Justin > > > > -- > View this message in context: > http://imagej.1557.x6.nabble.com/Background-subtraction-of-scratches-behind-bubbles-tp5003261.html > Sent from the ImageJ mailing list archive at Nabble.com. > > -- > ImageJ mailing list: http://imagej.nih.gov/ij/list.html > -- ImageJ mailing list: http://imagej.nih.gov/ij/list.html |
In reply to this post by jmcginnity
You can try some sort of "alternating sequential filter (asf)" from morphology. If that is not good enough possibly you have additionally to find the objects with a bright center.
run("Duplicate...", "title=test"); for (i=2;i<5;i++) { run("Gray Morphology", "radius="+i+" type=circle operator=close"); run("Gray Morphology", "radius="+i+" type=circle operator=open"); } run("Gray Morphology", "radius=5 type=circle operator=close"); //run("Threshold..."); setAutoThreshold("Default"); The plugin "Gray Morphology" is part of Gabriel Landini's Morphology package The other way around could be to accept a moderate mask, with some cleaning and picking out the bubbles via particle features, e.g. run("Duplicate...", "title=test"); setAutoThreshold("MaxEntropy"); setThreshold(0, 52); setOption("BlackBackground", false); run("Convert to Mask"); run("Options...", "iterations=2 count=2 edm=Overwrite do=Open"); run("Open"); run("Fill Holes"); run("Analyze Particles…", "size=0-Infinity circularity=0.00-1.00 show=Nothing display exclude clear"); Karsten Am 06.06.2013 um 18:31 schrieb jmcginnity <[hidden email]>: > Hi,I have a stack which has images of bubbles in front of a scratched > background. I'm trying to isolate the bubbles so I can determine their > sizes. I've tried a number of approaches without success. I've tried > Background Subtraction. I've also tried a macro > (http://www.petercollingridge.co.uk/blog/removing-background-avi-using-imagej) > that gets the median background, subtracted this from my images but obtained > streaks through my bubbles. I tried Image Stack Merger Plus > (http://www.samuelpean.com/image-stack-merger-plus/) but had the same > trouble. Any ideas on how to go about this? > <http://imagej.1557.x6.nabble.com/file/n5003261/CIMG0053-Z3-decby2000021.jpg> > CIMG0053-Z3-decby2000021.jpg > <http://imagej.1557.x6.nabble.com/file/n5003261/CIMG0053-Z3-decby2000021.jpg> > Thanks,Justin > > > > -- > View this message in context: http://imagej.1557.x6.nabble.com/Background-subtraction-of-scratches-behind-bubbles-tp5003261.html > Sent from the ImageJ mailing list archive at Nabble.com. > > -- > ImageJ mailing list: http://imagej.nih.gov/ij/list.html Karsten [hidden email] -- ImageJ mailing list: http://imagej.nih.gov/ij/list.html |
On Friday 07 Jun 2013 08:57:38 you wrote:
> The plugin "Gray Morphology" is part of Gabriel Landini's Morphology package I think that is Dimiter Prodanov's plugin http://rsbweb.nih.gov/ij/plugins/gray-morphology.html Cheers Gabriel -- ImageJ mailing list: http://imagej.nih.gov/ij/list.html |
In reply to this post by karo03
Thanks Karsten for both suggestions. I was unaware of these options. Your second suggestion works better, though am unable to see the smaller bubbles.
Thanks again, Justin From: Karsten Rodenacker-3 [via ImageJ] [mailto:ml-node+[hidden email]]
You can try some sort of "alternating sequential filter (asf)" from morphology. If that is not good enough possibly you have additionally to find the objects with a bright center.
If you reply to this email, your message will be added to the discussion below: To unsubscribe from Background subtraction of scratches behind bubbles,
click here. |
Justin,
The advanced weka segmentation available in Fiji works well with the images you sent with minimal training. Sincerely, Jerome On 7 June 2013 11:27, jmcginnity <[hidden email]> wrote: > Thanks Karsten for both suggestions. I was unaware of these options. > Your second suggestion works better, though am unable to see the smaller > bubbles. > Thanks again, > Justin > > From: Karsten Rodenacker-3 [via ImageJ] [mailto: > [hidden email]] > Sent: Friday, 7 June 2013 3:58 PM > To: Justin McGinnity > Subject: Re: Background subtraction of scratches behind bubbles > > You can try some sort of "alternating sequential filter (asf)" from > morphology. If that is not good enough possibly you have additionally to > find the objects with a bright center. > > run("Duplicate...", "title=test"); > for (i=2;i<5;i++) { > run("Gray Morphology", "radius="+i+" type=circle operator=close"); > run("Gray Morphology", "radius="+i+" type=circle operator=open"); > } > run("Gray Morphology", "radius=5 type=circle operator=close"); > //run("Threshold..."); > setAutoThreshold("Default"); > > The plugin "Gray Morphology" is part of Gabriel Landini's Morphology > package > > The other way around could be to accept a moderate mask, with some > cleaning and picking out the bubbles via particle features, e.g. > > run("Duplicate...", "title=test"); > setAutoThreshold("MaxEntropy"); > setThreshold(0, 52); > setOption("BlackBackground", false); > run("Convert to Mask"); > run("Options...", "iterations=2 count=2 edm=Overwrite do=Open"); > run("Open"); > run("Fill Holes"); > run("Analyze Particles…", "size=0-Infinity circularity=0.00-1.00 > show=Nothing display exclude clear"); > > Karsten > > Am 06.06.2013 um 18:31 schrieb jmcginnity <[hidden > email]</user/SendEmail.jtp?type=node&node=5003272&i=0>>: > > > Hi,I have a stack which has images of bubbles in front of a scratched > > background. I'm trying to isolate the bubbles so I can determine their > > sizes. I've tried a number of approaches without success. I've tried > > Background Subtraction. I've also tried a macro > > ( > http://www.petercollingridge.co.uk/blog/removing-background-avi-using-imagej > ) > > that gets the median background, subtracted this from my images but > obtained > > streaks through my bubbles. I tried Image Stack Merger Plus > > (http://www.samuelpean.com/image-stack-merger-plus/) but had the same > > trouble. Any ideas on how to go about this? > > < > http://imagej.1557.x6.nabble.com/file/n5003261/CIMG0053-Z3-decby2000021.jpg > > > > CIMG0053-Z3-decby2000021.jpg > > < > http://imagej.1557.x6.nabble.com/file/n5003261/CIMG0053-Z3-decby2000021.jpg > > > > Thanks,Justin > > > > > > > > -- > > View this message in context: > http://imagej.1557.x6.nabble.com/Background-subtraction-of-scratches-behind-bubbles-tp5003261.html > > Sent from the ImageJ mailing list archive at Nabble.com. > > > > -- > > ImageJ mailing list: http://imagej.nih.gov/ij/list.html > > Karsten > [hidden email]</user/SendEmail.jtp?type=node&node=5003272&i=1> > > -- > ImageJ mailing list: http://imagej.nih.gov/ij/list.html > > ________________________________ > If you reply to this email, your message will be added to the discussion > below: > > http://imagej.1557.x6.nabble.com/Background-subtraction-of-scratches-behind-bubbles-tp5003261p5003272.html > To unsubscribe from Background subtraction of scratches behind bubbles, > click here< > >. > NAML< > http://imagej.1557.x6.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml > > > > > > > -- > View this message in context: > http://imagej.1557.x6.nabble.com/Background-subtraction-of-scratches-behind-bubbles-tp5003261p5003275.html > Sent from the ImageJ mailing list archive at Nabble.com. > > -- > ImageJ mailing list: http://imagej.nih.gov/ij/list.html > ImageJ mailing list: http://imagej.nih.gov/ij/list.html |
In reply to this post by jmcginnity
Hi Justin,
here is another one, using just native ImageJ functions, similar to Karsten's second one. It also uses size and circularity (the latter to avoid selecting long lines), and using binary dilation and erosion. You may tweak the parameters (iterations, AutoThreshold method) a bit to get it working also with other images. run("Options...", "iterations=1 count=1 pad edm=Overwrite do=Nothing"); setAutoThreshold("Intermodes"); setThreshold(0, 41); setOption("BlackBackground", false); run("Convert to Mask"); run("Close-"); run("Analyze Particles...", "size=50-Infinity circularity=0.5-1.00 show=Masks include"); run("Open"); Michael ________________________________________________________________ On Jun 7, 2013, at 11:27, jmcginnity wrote: > Thanks Karsten for both suggestions. I was unaware of these options. > Your second suggestion works better, though am unable to see the smaller bubbles. > Thanks again, > Justin > > From: Karsten Rodenacker-3 [via ImageJ] [mailto:[hidden email]] > Sent: Friday, 7 June 2013 3:58 PM > To: Justin McGinnity > Subject: Re: Background subtraction of scratches behind bubbles > > You can try some sort of "alternating sequential filter (asf)" from morphology. If that is not good enough possibly you have additionally to find the objects with a bright center. > > run("Duplicate...", "title=test"); > for (i=2;i<5;i++) { > run("Gray Morphology", "radius="+i+" type=circle operator=close"); > run("Gray Morphology", "radius="+i+" type=circle operator=open"); > } > run("Gray Morphology", "radius=5 type=circle operator=close"); > //run("Threshold..."); > setAutoThreshold("Default"); > > The plugin "Gray Morphology" is part of Gabriel Landini's Morphology package > > The other way around could be to accept a moderate mask, with some cleaning and picking out the bubbles via particle features, e.g. > > run("Duplicate...", "title=test"); > setAutoThreshold("MaxEntropy"); > setThreshold(0, 52); > setOption("BlackBackground", false); > run("Convert to Mask"); > run("Options...", "iterations=2 count=2 edm=Overwrite do=Open"); > run("Open"); > run("Fill Holes"); > run("Analyze Particles…", "size=0-Infinity circularity=0.00-1.00 show=Nothing display exclude clear"); > > Karsten > > Am 06.06.2013 um 18:31 schrieb jmcginnity <[hidden email]</user/SendEmail.jtp?type=node&node=5003272&i=0>>: > >> Hi,I have a stack which has images of bubbles in front of a scratched >> background. I'm trying to isolate the bubbles so I can determine their >> sizes. I've tried a number of approaches without success. I've tried >> Background Subtraction. I've also tried a macro >> (http://www.petercollingridge.co.uk/blog/removing-background-avi-using-imagej) >> that gets the median background, subtracted this from my images but obtained >> streaks through my bubbles. I tried Image Stack Merger Plus >> (http://www.samuelpean.com/image-stack-merger-plus/) but had the same >> trouble. Any ideas on how to go about this? >> <http://imagej.1557.x6.nabble.com/file/n5003261/CIMG0053-Z3-decby2000021.jpg> >> CIMG0053-Z3-decby2000021.jpg >> <http://imagej.1557.x6.nabble.com/file/n5003261/CIMG0053-Z3-decby2000021.jpg> >> Thanks,Justin >> >> >> >> -- >> View this message in context: http://imagej.1557.x6.nabble.com/Background-subtraction-of-scratches-behind-bubbles-tp5003261.html >> Sent from the ImageJ mailing list archive at Nabble.com. >> >> -- >> ImageJ mailing list: http://imagej.nih.gov/ij/list.html > > Karsten > [hidden email]</user/SendEmail.jtp?type=node&node=5003272&i=1> > > -- > ImageJ mailing list: http://imagej.nih.gov/ij/list.html > > ________________________________ > If you reply to this email, your message will be added to the discussion below: > http://imagej.1557.x6.nabble.com/Background-subtraction-of-scratches-behind-bubbles-tp5003261p5003272.html > To unsubscribe from Background subtraction of scratches behind bubbles, click here< > NAML<http://imagej.1557.x6.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml> > > > > > -- > View this message in context: http://imagej.1557.x6.nabble.com/Background-subtraction-of-scratches-behind-bubbles-tp5003261p5003275.html > Sent from the ImageJ mailing list archive at Nabble.com. > > -- > ImageJ mailing list: http://imagej.nih.gov/ij/list.html -- ImageJ mailing list: http://imagej.nih.gov/ij/list.html |
In reply to this post by Sidnei Paciornik
Is this a good start? Follow by Analyze particles, add to ROI Manager, select each one, smooth ROI, etc.
http://www.flickr.com/photos/mcammer/8986418770/ selectWindow("CIMG0053-Z3-decby2000021.jpg"); run("Duplicate...", "title=CIMG0053-Z3-decby2000021-1.jpg"); run("32-bit"); run("Median...", "radius=6"); run("South"); //run("Threshold..."); setAutoThreshold("Default"); setAutoThreshold("Default"); run("Convert to Mask"); run("Erode"); _________________________________________ Michael Cammer, Assistant Research Scientist Skirball Institute of Biomolecular Medicine Lab: (212) 263-3208 Cell: (914) 309-3270 ________________________________________ From: ImageJ Interest Group [[hidden email]] on behalf of Sidnei Paciornik [[hidden email]] Sent: Thursday, June 06, 2013 10:31 PM To: [hidden email] Subject: Re: Background subtraction of scratches behind bubbles Did you try Fourier filtering? It may be able to eliminate the scratches and preserve the bubbles. Good luck. Prof. Sidnei Paciornik Grupo de Análise de Imagens e Microscopia Digital DEMa <http://www.dema.puc-rio.br/> - Departamento de Engenharia de Materiais PUC-Rio <http://www.puc-rio.br/> Rua Marquês de São Vicente 225 Prédio Leme, Sala 501L Gávea - Rio de Janeiro - RJ 22451-900 - Brasil tel: (55)(21)3527-1243 On Thu, Jun 6, 2013 at 1:31 PM, jmcginnity <[hidden email]>wrote: > Hi,I have a stack which has images of bubbles in front of a scratched > background. I'm trying to isolate the bubbles so I can determine their > sizes. I've tried a number of approaches without success. I've tried > Background Subtraction. I've also tried a macro > ( > http://www.petercollingridge.co.uk/blog/removing-background-avi-using-imagej > ) > that gets the median background, subtracted this from my images but > obtained > streaks through my bubbles. I tried Image Stack Merger Plus > (http://www.samuelpean.com/image-stack-merger-plus/) but had the same > trouble. Any ideas on how to go about this? > < > http://imagej.1557.x6.nabble.com/file/n5003261/CIMG0053-Z3-decby2000021.jpg > > > CIMG0053-Z3-decby2000021.jpg > < > http://imagej.1557.x6.nabble.com/file/n5003261/CIMG0053-Z3-decby2000021.jpg > > > Thanks,Justin > > > > -- > View this message in context: > http://imagej.1557.x6.nabble.com/Background-subtraction-of-scratches-behind-bubbles-tp5003261.html > Sent from the ImageJ mailing list archive at Nabble.com. > > -- > ImageJ mailing list: http://imagej.nih.gov/ij/list.html > -- ImageJ mailing list: http://imagej.nih.gov/ij/list.html -- ImageJ mailing list: http://imagej.nih.gov/ij/list.html |
In reply to this post by Michael Schmid
Hi Michael,
Thanks for this suggestion. It worked quite well. Modifying your suggestion I found that I was able to get best results with the erode function. I was also wondering what the first line does to the image, namely run("Options...", "iterations=1 count=1 pad edm=Overwrite do=Nothing"); Thanks, Justin |
In reply to this post by Jerome Mutterer-3
Hi Jerome,
The Advanced Weka Segmentation seems to do a good job, judging from the image you posted. I'll look into it. Do you know of any good websites that have instructions on using Weka? Thanks, Justin |
In reply to this post by jmcginnity
Hi Justin,
the first line in the macro is meant to make sure the binary options are the same: - Black background, - only one cycle (iteration) in binary dilate, erode, open and close operations, - dilate, erode, open and close operations are not restricted if there are few/many neighbors (count) where the pixel is black, - don't erode from the edges ('pad'), - no immediate processing (for trying the options, one could do also one of the dilate/erode/open/close operations with preview while the binary options are open, to see the effect). http://rsb.info.nih.gov/ij/docs/guide/146-29.html#toc-Subsubsection-29.8.14 Michael ________________________________________________________________ On Jun 10, 2013, at 04:34, jmcginnity wrote: > Hi Michael, > Thanks for this suggestion. It worked quite well. Modifying your > suggestion I found that I was able to get best results with the erode > function. > I was also wondering what the first line does to the image, namely > run("Options...", "iterations=1 count=1 pad edm=Overwrite do=Nothing"); > > Thanks, > Justin > > > > > -- > View this message in context: http://imagej.1557.x6.nabble.com/Background-subtraction-of-scratches-behind-bubbles-tp5003261p5003310.html > Sent from the ImageJ mailing list archive at Nabble.com. > > -- > ImageJ mailing list: http://imagej.nih.gov/ij/list.html -- ImageJ mailing list: http://imagej.nih.gov/ij/list.html |
In reply to this post by Sidnei Paciornik
Hi Prof. Paciornik,
Thanks for the suggestion. I am trying to filter the Fourier Transform of my image but am having trouble finding information on how to do this. Can you explain how to filter a Fourier Transform? Thanks, Justin |
Justin,
you won't be happy with the result of linear (Fourier) filtering. The background structure is much too "diverse" and a corresponding filter will considerably degrade the hollow dots. Nonlinear processing may lead to acceptable results. Try thresholding and use the thresholded image as a mask etc. HTH Herbie On 12.06.13 14:48, jmcginnity wrote: > Hi Prof. Paciornik, > Thanks for the suggestion. > I am trying to filter the Fourier Transform of my image but am having > trouble finding information on how to do this. Can you explain how to filter > a Fourier Transform? > Thanks, > Justin > > > > -- > View this message in context: http://imagej.1557.x6.nabble.com/Background-subtraction-of-scratches-behind-bubbles-tp5003261p5003410.html > Sent from the ImageJ mailing list archive at Nabble.com. > > -- > ImageJ mailing list: http://imagej.nih.gov/ij/list.html > -- ImageJ mailing list: http://imagej.nih.gov/ij/list.html |
In reply to this post by jmcginnity
Hi Justin
It is not easy to describe Fourier Filtering. But you can give it a try in the ImageJ Menu Process/FFT/BandPass filter. In the dialog, try "suppress stripes", vertical in your case, with the default values. Then check the help and see how it works. Let me know. Good luck. Sidnei On Wed, Jun 12, 2013 at 9:48 AM, jmcginnity <[hidden email]>wrote: > Hi Prof. Paciornik, > Thanks for the suggestion. > I am trying to filter the Fourier Transform of my image but am having > trouble finding information on how to do this. Can you explain how to > filter > a Fourier Transform? > Thanks, > Justin > > > > -- > View this message in context: > http://imagej.1557.x6.nabble.com/Background-subtraction-of-scratches-behind-bubbles-tp5003261p5003410.html > Sent from the ImageJ mailing list archive at Nabble.com. > > -- > ImageJ mailing list: http://imagej.nih.gov/ij/list.html > -- ImageJ mailing list: http://imagej.nih.gov/ij/list.html |
In reply to this post by Cammer, Michael
Hi Michael,
Thanks, it is a good start. I'll try modifying the parameters to see if i can get a better image. Can you explain the purpose of the 32-bit conversion? Thanks, Justin |
In reply to this post by Herbie-3
Thanks for the advice, Herbie.
When you say 'use the thresholded image as a mask' what does this mean? Do I subtract the thresholded image from the original? Justin |
Well Justin,
using a suitably thresholded image as a mask may not be necessary if you wish to (approximately) determine the sizes of the hollow dots as originally mentioned. As others have already recommended, the way to go for a binary representation is: Threshold (e.g. Yen-scheme) Median-Operator (e.g. Radius 4) Analyze Particles (e.g. Size 50-5000, Circ 0.2-1) If however you want to analyze the hollow dots represented not binary but in gray-levels, then you may use the binary image (Analyze Particles: Masks including holes) and multiply it onto the original image (Image Calculator). HTH Herbie __________________________________ On 12.06.13 16:06, jmcginnity wrote: > Thanks for the advice, Herbie. > When you say 'use the thresholded image as a mask' what does this mean? Do I > subtract the thresholded image from the original? > Justin > > > > -- > View this message in context: http://imagej.1557.x6.nabble.com/Background-subtraction-of-scratches-behind-bubbles-tp5003261p5003414.html > Sent from the ImageJ mailing list archive at Nabble.com. > > -- > ImageJ mailing list: http://imagej.nih.gov/ij/list.html > -- ImageJ mailing list: http://imagej.nih.gov/ij/list.html |
Free forum by Nabble | Edit this page |