regionprops - displaying region properties

ciaran.robb at googlemail.com ciaran.robb at googlemail.com
Thu Feb 26 11:51:18 EST 2015


Hi
Adding to my own post but hey....

I have since written my own code which allows visualising of region 
properties (eg area, eccentricity etc) via colormap, if anyone is 
interested let me know!

Ciaran

On Sunday, February 1, 2015 at 11:45:44 PM UTC, ciara... at googlemail.com 
wrote:
>
> Hello everyone,
>
> I have recently been attempting to modify some existing skimage code to 
> display regionprops for a labeled image  (e.g. area or eccentricity)
>
> I initially tried to translate a vectorized bit of old matlab code I had, 
> but gave up on that and decided to alter the existing label2rgb skimage 
> function
>
> I am attempting to change each label value to it's area property value 
> similar to the label2rgb "avg" function.
>
> so I have:
> labels = a labeled image
>
>     out = np.zeros_like(labels) #a blank array
>     labels2 = np.unique(labels) #a vector of label vals
>     out = np.zeros_like(labels)
>     Props = regionprops(labels, ['Area'])
>     bg_label=0
>     bg = (labels2 == bg_label) 
>     if bg.any():
>         labels2 = labels2[labels2 != bg_label]
>         out[bg] = 0
>         for label in labels2:
>             mask = (labels == label).nonzero()    
>             color = Props[label].area
>             out[mask] = color
> but the "out" props image does not correspond to the correct area values?
> Can anyone help me with this?
>  It also throws the following error:
> "list index out of range"
> It would certainly be useful to have a way to view the spatial 
> distribution of label properties in this way - perhaps in a future skimage 
> version?
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/scikit-image/attachments/20150226/fba17f11/attachment.html>


More information about the scikit-image mailing list