CellProfiler-plugins icon indicating copy to clipboard operation
CellProfiler-plugins copied to clipboard

[bugfix] adjust calculatemoments code to properly use labels

Open wllgrnt opened this issue 1 year ago • 0 comments

Fixes #207 and #206.

  1. The function get_object_moment was not correct, since it failed to use the labels. What it was instead doing was getting a mask of all pixels in the array with the same numerical value, and then calculating the moments on those (which will definitionally be zero), rather than getting the mask for each label in turn. See the old calculatehistogram.py here for an example of how this function used to be implemented.
  2. The fix in the code was assumed to benp.fix, but it's supposed to be fixup_scipy_ndimage_result as fix (see elsewhere in the codebase).

Also ran black and flake8 on the file.

wllgrnt avatar Jan 04 '24 19:01 wllgrnt