CellProfiler-plugins
CellProfiler-plugins copied to clipboard
[bugfix] adjust calculatemoments code to properly use labels
Fixes #207 and #206.
- 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. - The
fix
in the code was assumed to benp.fix
, but it's supposed to befixup_scipy_ndimage_result as fix
(see elsewhere in the codebase).
Also ran black and flake8 on the file.