Skip to content

add loaders#9

Open
MikeLippincott wants to merge 1 commit intoWayScience:mainfrom
MikeLippincott:loaders
Open

add loaders#9
MikeLippincott wants to merge 1 commit intoWayScience:mainfrom
MikeLippincott:loaders

Conversation

@MikeLippincott
Copy link
Copy Markdown
Member

Description

This PR adds the loaders needed for ZedProfiler's featurization process

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.

Comment thread src/zedprofiler/IO/__init__.py
Comment thread src/zedprofiler/IO/feature_writing_utils.py
Comment thread src/zedprofiler/IO/feature_writing_utils.py
Comment thread src/zedprofiler/IO/feature_writing_utils.py
Comment thread src/zedprofiler/IO/feature_writing_utils.py
self.compartments = [
x
for x in self.image_set_dict
if "Nuclei" in x or "Cell" in x or "Cytoplasm" in x or "Organoid" in 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.

Consider making the specific kind of compartments configurable with this reasonable default.

"""Configuration options for ImageSetLoader."""

image_set_name: str | None = None
mask_key_name: list[str] | None = None
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 make sense to use "label" instead of "mask" wherever it appears to keep language consistent?

Comment on lines +404 to +405
self.image1 = self.image_set_loader.image_set_dict[channel1].copy()
self.image2 = self.image_set_loader.image_set_dict[channel2].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.

Why a copy? Consider documenting.

"""Test that spaces are replaced with hyphens."""
assert remove_underscores_from_string("test string") == "test-string"

def test_remove_slashes(self) -> None:
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 using pytest parametrization throughout where possible.


class ImageSetLoader:
"""
Load an image set consisting of raw z stack images and segmentation masks.
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 there a hidden assumption within the implementation about the resulting order (and object returned)? Consider documenting what that might be. Specifically I'm wondering if we load images with this class, do we get back the "correctly ordered" version of the sets, or only what the filesystem decided to send to us?

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