Hi Evelyn,I'm guessing you are applying label() directly to your image, which is not the right way to use it. label() connects all neighboring nonzero points together. Since images are rarely zero (rather than some very small intensity value), you are simply connecting all the pixels of your image together into one label.
The correct way to do this is to threshold your image, eg using:So:>>> from skimage.filter import threshold_adaptive>>> from scipy import ndimage as nd>>> diam = 51>>> # "51" is a guess, you might have to fiddle with this parameter.>>> image_t = (image > threshold_adaptive(image, diam))>>> image_labeled = nd.label(image_t)>>> particle_sizes = np.bincount(image_labeled.
ravel())[1:]>>> # [1:] is to select only the foreground labelsHope this helps!Juan.On Wed, Nov 20, 2013 at 3:45 PM, Evelyn Liu <eve...@gmail.com> wrote:
Hi Juan,On Tuesday, November 19, 2013 9:39:47 PM UTC-5, Juan Nunez-Iglesias wrote:Is the goal only to count particles? In that case, I think a local thresholding (threshold_adaptive) would work on all these images. Then, just do a labelling (scipy.ndimage.label) and draw a histogram of particle sizes. You'll get a sharp peak around the true particle size, with bigger peaks for clumps
I'd like to use scikit to plot the size distribution histogram of particles in an image, which is similar with Adam's. I tried scipy.ndimage.measurements.
label(image), which I thought would give an array about particle sizes. However, the output array is with all 1, obviously nothing about size. I must get something wrong...So which function should i call for the size distribution? Thanks Juan!--
You received this message because you are subscribed to the Google Groups "scikit-image" group.
To unsubscribe from this group and stop receiving emails from it, send an email to scikit-image...@
For more options, visit https://groups.google.com/