Skip to content

Add intensity_median to regionprops#7745

Merged
lagru merged 3 commits intoscikit-image:mainfrom
imagejan:intensity-median
May 28, 2025
Merged

Add intensity_median to regionprops#7745
lagru merged 3 commits intoscikit-image:mainfrom
imagejan:intensity-median

Conversation

@imagejan
Copy link
Contributor

@imagejan imagejan commented Mar 11, 2025

Description

Add intensity_median to skimage.measure.regionprops.

Closes #7742.

Checklist

Release note

For maintainers and optionally contributors, please refer to the instructions on how to document this PR for the release notes.

Add new property `intensity_median` to `skimage.measure.regionprops`.

@imagejan imagejan force-pushed the intensity-median branch 5 times, most recently from 87f8b57 to 336bc4c Compare March 11, 2025 13:24
@imagejan imagejan marked this pull request as ready for review March 11, 2025 14:19
Copy link
Member

@lagru lagru left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@imagejan, thank you for the this proposed new feature! I left some comments on tweaking the tests.

To avoid that the to-be-added 'intensity_median' feature
shadows the extra feature in the tests, we rename
from 'intensity_mean' to 'custom_intensity_mean'.
@lagru lagru self-requested a review April 9, 2025 15:25
Copy link
Member

@lagru lagru left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, looks ready to merge in my opinion. 😊

@lagru lagru added the 👍 1st approval Needs 2nd approval to merge label May 25, 2025
@lagru lagru merged commit a6a24f5 into scikit-image:main May 28, 2025
26 checks passed
@lagru
Copy link
Member

lagru commented May 28, 2025

Thank you @imagejan!

@stefanv stefanv added this to the 0.26 milestone May 28, 2025
@imagejan imagejan deleted the intensity-median branch May 29, 2025 18:31


def intensity_median(regionmask, image_intensity):
def custom_intensity_median(regionmask, image_intensity):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@imagejan I know the PR has been merged already, but just to confirm: Was the function renamed just so its name would be different from the property name?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for reviewing, @mkcor! Yes, this change was just to avoid the conflict of this custom property and the now-added built-in property.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great, thanks for confirming!

**intensity_mean** : float
Average of intensity values in the region.
**intensity_median** : float
Value with the median intensity in the region.
Copy link
Member

@mkcor mkcor Jun 2, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For consistency, I would use "Value of ..." as in the other property descriptions. Happy to submit it in a tiny follow-up PR.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done #7804.

lagru pushed a commit that referenced this pull request Jun 3, 2025
matthew-brett added a commit to matthew-brett/scikit-image that referenced this pull request Jul 7, 2025
* origin/main:
  Deprecate estimate method in favor of class constructor (scikit-image#7771)
  Temporary fix for Visual Studio & Clang incompatibility in Windows image (scikit-image#7835)
  Address deprecations in Pillow 11.3 (scikit-image#7828)
  Remove unused & obsolete `legacy_datasets`, `legacy_registry` vars (scikit-image#7677)
  Draft migration guide for skimage2 (scikit-image#7785)
  Do not report failure in wheels sub-recipe (scikit-image#7806)
  Use consistent wording in property description. (scikit-image#7804)
  Add intensity_median to regionprops (scikit-image#7745)
  CI: Update pypa/gh-action-pypi-publish to v1.12.4 for attestations on PyPI (scikit-image#7793)
  Document output dtype for transform.resize. (scikit-image#7792)
  Use `cibuildwheel` to build WASM/Pyodide wheels for `scikit-image`, push nightlies to Anaconda.org (scikit-image#7440)
  DOC: Include missing gain parameter in adjust_gamma equation (scikit-image#7763)
  Temporarily pin to `pyodide-build==0.30.0`, and ensure that the correct xbuildenvs are used (scikit-image#7788)
  Deprecate old names & attributes in RegionProperties (scikit-image#7778)
  Pin JasonEtco/create-an-issue action to SHA for v2.9.2 (scikit-image#7787)
  Make doctest-plus work with spin (scikit-image#7786)
  Report failures on main via issue (scikit-image#7752)
  Use `workers` instead of alternate parameter names (scikit-image#7302)
  Fix f-string in otsu plot (scikit-image#7780)
  Further document use of regionprops function and fix terms. (scikit-image#7518)
matthew-brett added a commit to matthew-brett/scikit-image that referenced this pull request Jul 14, 2025
* origin/main: (31 commits)
  Update import convention in certain gallery examples (scikit-image#7764)
  Refactor fundamental matrix scaling (scikit-image#7767)
  Add unit test for cval unequal to zero
  Forward  in _generic_edge_filter
  Remove superfluous mask argument from _generic_edge_filter
  Only report failure on main branch once
  Deprecate estimate method in favor of class constructor (scikit-image#7771)
  Temporary fix for Visual Studio & Clang incompatibility in Windows image (scikit-image#7835)
  Address deprecations in Pillow 11.3 (scikit-image#7828)
  Remove unused & obsolete `legacy_datasets`, `legacy_registry` vars (scikit-image#7677)
  Draft migration guide for skimage2 (scikit-image#7785)
  Do not report failure in wheels sub-recipe (scikit-image#7806)
  Use consistent wording in property description. (scikit-image#7804)
  Add intensity_median to regionprops (scikit-image#7745)
  CI: Update pypa/gh-action-pypi-publish to v1.12.4 for attestations on PyPI (scikit-image#7793)
  Document output dtype for transform.resize. (scikit-image#7792)
  Use `cibuildwheel` to build WASM/Pyodide wheels for `scikit-image`, push nightlies to Anaconda.org (scikit-image#7440)
  DOC: Include missing gain parameter in adjust_gamma equation (scikit-image#7763)
  Temporarily pin to `pyodide-build==0.30.0`, and ensure that the correct xbuildenvs are used (scikit-image#7788)
  Deprecate old names & attributes in RegionProperties (scikit-image#7778)
  ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add intensity_median to regionprops

4 participants