Skip to content

add intensity#12

Open
MikeLippincott wants to merge 2 commits intoWayScience:mainfrom
MikeLippincott:intensity
Open

add intensity#12
MikeLippincott wants to merge 2 commits intoWayScience:mainfrom
MikeLippincott:intensity

Conversation

@MikeLippincott
Copy link
Copy Markdown
Member

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?

  • Documentation (changes docs or other related content)
  • Bug fix (fixes an issue).
  • Enhancement (adds functionality).
  • Breaking change (these changes would cause existing functionality to not work as expected).

Checklist

Please ensure that all boxes are checked before indicating that this pull request is ready for review.

  • I have read and followed the CONTRIBUTING.md guidelines.
  • I have searched for existing content to ensure this is not a duplicate.
  • I have performed a self-review of these additions (including spelling, grammar, and related).
  • These changes pass all pre-commit checks.
  • I have added comments to my code to help provide understanding
  • I have added a test which covers the code changes found within this PR
  • I have deleted all non-relevant text in this pull request template.

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

Copy link
Copy Markdown
Member

@axiomcura axiomcura left a comment

Choose a reason for hiding this comment

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

LGTM! neat stuff just a couple of comments c:

"compartment": [],
"value": [],
}
for index, label in enumerate(labels):
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Consider adding a single comment on top of this for loops explaining what is happening here.

Comment on lines +125 to +127
max_z, max_y, max_x = scipy.ndimage.maximum_position(
selected_image_object,
) # z, y, x
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

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(
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

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

Comment on lines +64 to +65
selected_label_object = label_object.copy()
selected_image_object = image_object.copy()
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

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
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

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().

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants