Conversation
axiomcura
left a comment
There was a problem hiding this comment.
LGTM! neat stuff just a couple of comments c:
| "compartment": [], | ||
| "value": [], | ||
| } | ||
| for index, label in enumerate(labels): |
There was a problem hiding this comment.
Consider adding a single comment on top of this for loops explaining what is happening here.
| max_z, max_y, max_x = scipy.ndimage.maximum_position( | ||
| selected_image_object, | ||
| ) # z, y, x |
There was a problem hiding this comment.
Is this overwriting intentional? Because max_z max_y and max_x was also declared. Juzt wanna make sure this is on your radar.
| # median intensity | ||
| median_intensity = numpy.median(non_zero_pixels_object) | ||
| # max intensity location | ||
| max_z, max_y, max_x = scipy.ndimage.maximum_position( |
There was a problem hiding this comment.
Hmmm... Are you trying to find the max intensity within the whole images or masks?
If within the mask, using the labels parameter might help. https://docs.scipy.org/doc/scipy/reference/generated/scipy.ndimage.maximum_position.htm
| selected_label_object = label_object.copy() | ||
| selected_image_object = image_object.copy() |
There was a problem hiding this comment.
Are the two full-volume copies at the top necessary? Could it be possible to crop first using a bounding-box lookup (e.g. scipy.ndimage.find_objects), then mask within the crop? This might improve performance, though I'm not certain. c:
| @@ -0,0 +1,105 @@ | |||
| from types import SimpleNamespace | |||
There was a problem hiding this comment.
Would it be useful to have a test that verifies that the peak intensity location is correctly scoped to its object. My assumption is that scipy.ndimage.maximum_position is currently searching the whole image.
The test would be like:
test_compute_intensity_peak_location_is_within_object().
Description
This PR adds the intensity module. The tests might fail due to the lack of the presence of image loading functions
What kind of change(s) are included?
Checklist
Please ensure that all boxes are checked before indicating that this pull request is ready for review.