Skip to content

Change regionprops so that indices match labels #2755

@jni

Description

@jni

I would argue that the most common use case for regionprops is to measure the properties of a sequentially labelled image, starting from 0 (if there's a background) or 1 (if not). Currently, in both of these cases, regionprops returns a list where result[i] contains the region properties for label i+1.

In the case of nonsequential labels, this is even more confusing, because result[i] contains the region properties for the ith nonzero label, which could be anything.

I suggest one of the following:

  1. change the API to return a dictionary of label: regionprops.
  2. add a keyword argument to the API to return said dictionary.
  3. add a regionprops_dict function to the API to return this.

Any opinions on this?

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions