Re: [Numpy-discussion] finding connected areas?
I'm bringing back the discussion on list. On Mon, Jun 19, 2006 at 12:01:27AM +0100, stephen emslie wrote: > > > >You will get this in numarray.nd_image, the function is > >called label. It is also available in recent versions of scipy, in > >module scipy.ndimage. > > > > Thanks for pointing me in the right direction. I've been playing around with > this and I'm getting along with my problem, which is to find the areas of > the connected components in the binary image. ndimage.label has been a great > help in identifying and locating each shape in my image, but I am not quite > sure how to interpret the results. I would like to be able to calculate the > area of each slice returned by ndimage.labels. Is there a simple way to do > this? Yes, you will get an example in http://stsdas.stsci.edu/numarray/numarray-1.5.html/node98.html > Also, being very new to scipy I dont fully understand how the slice objects > returned by label actually work. Is there some documentation on this module > that I could look at? http://stsdas.stsci.edu/numarray/numarray-1.5.html/module-numarray.ndimage.html -- Alexandre Fayolle LOGILAB, Paris (France) Formations Python, Zope, Plone, Debian: http://www.logilab.fr/formations Développement logiciel sur mesure: http://www.logilab.fr/services Informatique scientifique: http://www.logilab.fr/science signature.asc Description: Digital signature ___ Numpy-discussion mailing list Numpy-discussion@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/numpy-discussion
Re: [Numpy-discussion] finding connected areas?
On Tue, Jun 13, 2006 at 01:41:17AM +0100, stephen emslie wrote: > I have used adaptive thresholding to turn an image into a binary image > so that I can locate a particularly large bright spot. However, now > that I have the binary image I need to be able to group connected > cell's together and determine their relative sizes. Matlab has a > function called bwlabel (http://tinyurl.com/fcnvd) that labels > connected objects in a matrix. That seems like a good way to start, > and I'm sure there is a way for me to do something similar in numpy, > but how? You will get this in numarray.nd_image, the function is called label. It is also available in recent versions of scipy, in module scipy.ndimage. -- Alexandre Fayolle LOGILAB, Paris (France) Formations Python, Zope, Plone, Debian: http://www.logilab.fr/formations Développement logiciel sur mesure: http://www.logilab.fr/services Informatique scientifique: http://www.logilab.fr/science signature.asc Description: Digital signature ___ Numpy-discussion mailing list Numpy-discussion@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/numpy-discussion
Re: [Numpy-discussion] finding connected areas?
Stephen,I don't know of a data structure in numpy or scipy that does this. To do this myself I use a modified union/find (equivalence relation) algorithm interfaced to python using boost/python. The same algorithm is also useful for connecting points on the basis of equivalence relations other than distance. If there is much interest I could make a standard C version sometime, but the interface needs some thinking about. Chuck On 6/12/06, stephen emslie <[EMAIL PROTECTED]> wrote: I have used adaptive thresholding to turn an image into a binary imageso that I can locate a particularly large bright spot. However, nowthat I have the binary image I need to be able to group connectedcell's together and determine their relative sizes. Matlab has a function called bwlabel (http://tinyurl.com/fcnvd) that labelsconnected objects in a matrix. That seems like a good way to start,and I'm sure there is a way for me to do something similar in numpy, but how?ThanksStephen Emslie___Numpy-discussion mailing listNumpy-discussion@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/numpy-discussion ___ Numpy-discussion mailing list Numpy-discussion@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/numpy-discussion
[Numpy-discussion] finding connected areas?
I have used adaptive thresholding to turn an image into a binary image so that I can locate a particularly large bright spot. However, now that I have the binary image I need to be able to group connected cell's together and determine their relative sizes. Matlab has a function called bwlabel (http://tinyurl.com/fcnvd) that labels connected objects in a matrix. That seems like a good way to start, and I'm sure there is a way for me to do something similar in numpy, but how? Thanks Stephen Emslie ___ Numpy-discussion mailing list Numpy-discussion@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/numpy-discussion