Hi Robin, This should do the job (regionprops syntax requires the dev version - but also possible with 0.8.x): import numpy as np from skimage.measure import regionprops from skimage.morphology import label a = np.array([[0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 1, 1, 1, 1, 1, 1, 1, 1], [0, 1, 0, 0, 0, 0, 0, 0, 1], [0, 1, 0, 1, 1, 1, 1, 0, 1], [0, 1, 0, 1, 0, 0, 1, 0, 1], [0, 1, 0, 1, 0, 0, 1, 0, 1], [0, 1, 0, 1, 0, 0, 1, 0, 1], [0, 1, 0, 1, 1, 1, 1, 0, 1], [0, 1, 0, 0, 0, 0, 0, 0, 1], [0, 1, 1, 1, 1, 1, 1, 1, 1]]) label_a = label(a, background=0) regions = regionprops(label_a+1) print label_a for props in regions: print props.image print props.filled_image Am 21.09.2013 um 11:12 schrieb Robin Wilson <r.t.wilson.bak@googlemail.com>:
Hi,
I am currently using various skimage functions to perform a customised edge-based image segmentation. Once I've got the outlines of my segments, I am using binary_fill_holes to fill them so I get a binary 'blobs' image, which I can then label, and use for processing.
However, when I have an image like this
0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 0 1 0 0 0 0 0 0 1 0 1 0 1 1 1 1 0 1 0 1 0 1 0 0 1 0 1 0 1 0 1 0 0 1 0 1 0 1 0 1 0 0 1 0 1 0 1 0 1 1 1 1 0 1 0 1 0 0 0 0 0 0 1 0 1 1 1 1 1 1 1 1
binary_fill_holes simply fills the entire, outer shape - and thus the shape in the middle gets lost.
Is there any simple way to do a fill so that I get two regions: the outer ('donut-shaped') region and the inner region? Or will I have to develop and implement my own algorithm to do this?
Any advice would be great,
Thanks,
Robin
-- 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+unsubscribe@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.