[scikit-image] Image intensity measure.regionprops
Cedric Espenel
cedric.espenel at gmail.com
Fri Jul 14 12:34:00 EDT 2017
Hi Jeremy,
Thank you for your answer, it makes a lot of sense to mask the intensity
image with the label region before measuring the mean intensity, which is
exactly what is in the source code:
> np.mean(self.intensity_image[self.image])
I guess I should have check before sending an email but the thank you for
your help!
Best,
Cedric
2017-07-14 6:49 GMT-07:00 Jeremy Chacon <chaco001 at umn.edu>:
> Hi Cedric,
>
> I'm just a user but my interpretation is that mean_intensity is the mean
> intensity of the pixels in that labeled region, whereas intensity_image is
> the region within its bounding box. So intensity_image can contain zeros
> where the label isn't present.
>
> See this:
>
> from skimage import measure
> import numpy as np
> a = np.array([[2,3,4,5],[6,5,4,3]])
> b = np.array([[0,1,1,0],[0,1,0,0]])
>
> rp = measure.regionprops(b, a)
>
> rp[0].mean_intensity # 4
> rp[0].intensity_image # contains a zero, making the mean of this < 4
>
>
>
> On Fri, Jul 14, 2017 at 12:23 AM, Cedric Espenel <cedric.espenel at gmail.com
> > wrote:
>
>> Hi scikit-image users/devs,
>>
>> I'm using skimage.measure.regionprops and I'm little bit confused about a
>> result I get with it.
>>
>> I'm working with a zstack of a microscopy image that I have
>> segmented/label and I'm trying to get the mean intensity of the labeled
>> region:
>>
>> region_props = measure.regionprops(label_image, intensity_image)
>>>
>>
>> If now I do:
>>
>> for prop in region_prop:
>>
>> print('x', prop.mean_intensity)
>>>>
>>> print('y', np.mean(prop.intensity_image))
>>>>
>>>
>> prop.mean_intensity and np.mean(prop.intensity_image) give me different
>> value, which confuse me. Can someone help me understand why I'm getting
>> something different?
>>
>> Thank you in advance for your help.
>>
>> Sincerely,
>>
>> Cedric
>>
>>
>> _______________________________________________
>> scikit-image mailing list
>> scikit-image at python.org
>> https://mail.python.org/mailman/listinfo/scikit-image
>>
>>
>
>
> --
>
> *___________________________________________________________________________Jeremy
> M. Chacon, Ph.D.*
>
> *Post-Doctoral Associate, Harcombe Lab*
> *University of Minnesota*
> *Ecology, Evolution and Behavior*
>
>
> _______________________________________________
> scikit-image mailing list
> scikit-image at python.org
> https://mail.python.org/mailman/listinfo/scikit-image
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/scikit-image/attachments/20170714/c695e2ca/attachment.html>
More information about the scikit-image
mailing list