-
Notifications
You must be signed in to change notification settings - Fork 11
fix: Fix reading channel names from single channel czi files #1194
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Reviewer's Guide by SourceryThis pull request fixes an issue with reading channel names from single-channel CZI files. The main change is in the handling of metadata for channel information, ensuring that both single-channel and multi-channel CZI files are processed correctly. File-Level Changes
Tips
|
WalkthroughThe changes made to the Changes
Poem
Recent review detailsConfiguration used: CodeRabbit UI Files selected for processing (1)
Additional comments not posted (1)
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey @Czaki - I've reviewed your changes and they look great!
Here's what I looked at during the review
- 🟡 General issues: 1 issue found
- 🟢 Security: all looks good
- 🟢 Testing: all looks good
- 🟢 Complexity: all looks good
- 🟢 Documentation: all looks good
Help me be more useful! Please click 👍 or 👎 on each comment to tell me if it was helpful.
channel_meta = metadata["ImageDocument"]["Metadata"]["DisplaySetting"]["Channels"]["Channel"] | ||
if isinstance(channel_meta, dict): | ||
# single channel saved in czifile | ||
channel_meta = [channel_meta] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
suggestion: Consider adding error handling for unexpected metadata structure
The current implementation assumes the presence and structure of the 'Channel' key. Consider wrapping this block in a try-except to handle potential KeyError or TypeError exceptions, ensuring robustness against unexpected metadata formats.
try:
channel_meta = metadata["ImageDocument"]["Metadata"]["DisplaySetting"]["Channels"]["Channel"]
if isinstance(channel_meta, dict):
channel_meta = [channel_meta]
except (KeyError, TypeError):
channel_meta = []
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## develop #1194 +/- ##
===========================================
- Coverage 93.06% 93.05% -0.01%
===========================================
Files 209 209
Lines 32906 32909 +3
===========================================
+ Hits 30623 30625 +2
- Misses 2283 2284 +1 ☔ View full report in Codecov by Sentry. |
Summary by Sourcery
Fix the issue with reading channel names from single channel CZI files by ensuring the channel metadata is correctly processed when it is a dictionary.
Bug Fixes:
Summary by CodeRabbit
New Features
Bug Fixes