-
Couldn't load subscription status.
- Fork 10
fix: Fix checking if channel requested by MeasurementProfile exists #1165
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
WalkthroughThe recent updates enhance measurement functionality and channel validation across various components, particularly in Changes
Sequence Diagram(s)sequenceDiagram
participant User
participant MeasurementWidget
participant PartSegImage
User->>MeasurementWidget: Request measurement with channel number
MeasurementWidget->>PartSegImage: Check channel with has_channel()
PartSegImage-->>MeasurementWidget: Return channel existence
MeasurementWidget->>User: Display result or error message
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 as PR comments)
Additionally, you can add CodeRabbit Configuration File (
|
|
🧙 Sourcery has finished reviewing your pull request! Tips
|
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.
We've reviewed this pull request using the Sourcery rules engine. If you would also like our AI-powered code review then let us know.
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.
Actionable comments posted: 0
Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (2)
- package/PartSeg/_roi_analysis/measurement_widget.py (1 hunks)
- package/PartSegImage/image.py (2 hunks)
Additional comments not posted (5)
package/PartSeg/_roi_analysis/measurement_widget.py (2)
370-373: LGTM! The channel validation is now more robust.The use of
has_channel(num)method improves the robustness of the channel validation.
374-376: Update the warning message for clarity.The warning message now correctly references the channel number without incrementing it by one.
package/PartSegImage/image.py (3)
529-533: LGTM! The method now handlesChannelobjects and strings for theCkeyword argument.The change improves the flexibility of the method by allowing it to accept a broader range of input types for channel identification.
575-576: LGTM! The method now handlesChannelobjects and strings.The change improves the flexibility of the method by allowing it to accept a broader range of input types for channel identification.
577-584: LGTM! The newhas_channelmethod enhances functionality.The method provides a straightforward way to verify the existence of a channel before attempting to access it.
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## develop #1165 +/- ##
===========================================
+ Coverage 93.06% 93.10% +0.04%
===========================================
Files 209 209
Lines 32829 32876 +47
===========================================
+ Hits 30552 30609 +57
+ Misses 2277 2267 -10 ☔ View full report in Codecov by Sentry. |
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.
Actionable comments posted: 0
Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (1)
- package/PartSeg/_roi_analysis/measurement_widget.py (1 hunks)
Files skipped from review as they are similar to previous changes (1)
- package/PartSeg/_roi_analysis/measurement_widget.py
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.
Actionable comments posted: 0
Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (14)
- package/PartSeg/_roi_analysis/advanced_window.py (1 hunks)
- package/PartSeg/common_gui/napari_image_view.py (1 hunks)
- package/PartSeg/plugins/napari_widgets/measurement_widget.py (2 hunks)
- package/PartSeg/plugins/napari_widgets/utils.py (1 hunks)
- package/PartSegCore/analysis/measurement_base.py (1 hunks)
- package/tests/conftest.py (3 hunks)
- package/tests/test_PartSeg/conftest.py (3 hunks)
- package/tests/test_PartSeg/roi_analysis/test_advanced_window.py (1 hunks)
- package/tests/test_PartSeg/test_analysis.py (4 hunks)
- package/tests/test_PartSeg/test_napari_widgets.py (3 hunks)
- package/tests/test_PartSeg/test_roi_analysis_batch.py (1 hunks)
- package/tests/test_PartSeg/test_viewer.py (1 hunks)
- package/tests/test_PartSegImage/test_image.py (1 hunks)
- package/tests/test_data/napari_measurements_profile.json (1 hunks)
Files skipped from review due to trivial changes (1)
- package/tests/test_PartSeg/conftest.py
Additional comments not posted (30)
package/PartSeg/plugins/napari_widgets/utils.py (2)
64-65: LGTM! Enhanced flexibility with type check.The type check to handle both string inputs and
Channelobjects enhances the function's flexibility.
67-67: LGTM! Correct usage ofname.value.The usage of
name.valueensures that the correct layer is accessed based on the new input handling.package/tests/test_PartSeg/test_analysis.py (4)
21-21: LGTM! Updated measurement type count.The update to the
measurement_typecount from 3 to 4 reflects the expected behavior of theMeasurementWidget.
37-37: LGTM! Updated measurement type count.The update to the
measurement_typecount from 3 to 4 reflects the expected behavior of theMeasurementWidget.
55-55: LGTM! Updated measurement type count.The update to the
measurement_typecount from 3 to 4 reflects the expected behavior of theMeasurementWidget.
67-83: LGTM! New test case for channel measurements.The new test case
test_base_channelsexpands the coverage of theMeasurementWidgetfunctionality, particularly in scenarios involving channel measurements.package/tests/test_PartSeg/test_viewer.py (3)
78-78: LGTM! Updated expected number of layers.The update to the expected number of layers in the
viewerobject reflects the revised understanding of how many layers should be present after each operation.
81-81: LGTM! Updated expected number of layers.The update to the expected number of layers in the
viewerobject reflects the revised understanding of how many layers should be present after each operation.
84-84: LGTM! Updated expected number of layers.The update to the expected number of layers in the
viewerobject reflects the revised understanding of how many layers should be present after each operation.package/PartSeg/plugins/napari_widgets/measurement_widget.py (2)
62-62: Ensurename.valueis correct.The change to use
name.valueinstead ofnameimproves accuracy in channel validation. Verify thatname.valueis the correct attribute to use.
66-67: Wrap channel name inChannelobject.Wrapping the channel name in a
Channelobject improves type safety and aligns with the expected data structure for channel representation.package/tests/test_PartSeg/roi_analysis/test_advanced_window.py (2)
151-151: Update assertion to reflect new expected state.The assertion has been updated to check for a length of 3, indicating a change in the expected state of
measurement_profiles.
154-154: Update assertion to reflect new expected state.The assertion has been updated to check for a length of 4, indicating a change in the expected state of
measurement_profiles.package/tests/conftest.py (2)
77-77: Update data shape to handle multi-channel images.The data shape has been updated to
[20, 40, 40, 2], allowing the tests to handle multi-channel image data.
209-216: Add newMeasurementProfileforstatistic3.The addition of a new
MeasurementProfileforstatistic3enhances the testing framework to support colocalization measurements.package/PartSegCore/analysis/measurement_base.py (1)
398-401: LGTM! The changes enhance method functionality.The inclusion of a conditional check for the
__argument_class__attribute improves the method's robustness.package/tests/test_data/napari_measurements_profile.json (8)
3-7: LGTM! The structural changes enhance compatibility tracking.Replacing the root key with
__class__and__class_version_dkt__indicates a shift towards a more robust class-based representation.
11-15: LGTM! The changes improve schema uniformity.Using
__class__and__class_version_dkt__instead of__Serializable__and__subtype__enhances the schema's extensibility and maintainability.
18-19: LGTM! The renaming enhances clarity.Including "ROI" in measurement names improves the context-specific application of the measurements.
20-24: LGTM! The restructuring improves clarity.Using
__class__and__values__consistently in calculation trees enhances the understanding of measurement calculations.
25-49: LGTM! The changes align with the new schema.Updating the
ROI Volumemeasurement to use the new schema is consistent with the overall improvements in the file.
53-92: LGTM! The changes align with the new schema.Updating the
ROI Volume per componentmeasurement to use the new schema is consistent with the overall improvements in the file.
94-174: LGTM! The changes align with the new schema.Updating the
ROI Volume per component /ROI Volumemeasurement to use the new schema is consistent with the overall improvements in the file.
176-215: LGTM! The changes align with the new schema.Updating the
ROI Mean pixel brightnessmeasurement to use the new schema is consistent with the overall improvements in the file.package/tests/test_PartSeg/test_napari_widgets.py (1)
Line range hint
226-257:
LGTM! The changes enhance test functionality.The alterations to the function's parameters and the additional assertions improve the test's robustness.
package/tests/test_PartSegImage/test_image.py (2)
291-292: Ensure channel existence checks are meaningful.The assertions
assert image.has_channel(1)andassert not image.has_channel(5)verify that channel 1 exists and channel 5 does not. These checks enhance the robustness of the test.
295-296: Ensure channel existence checks are meaningful.The assertions
assert image.has_channel("b")andassert not image.has_channel("d")verify that channel "b" exists and channel "d" does not. These checks enhance the robustness of the test.package/tests/test_PartSeg/test_roi_analysis_batch.py (1)
538-538: Update the expected count in the assertion.The assertion
assert widget.measurements_list.count() == 3ensures that themeasurements_listcontains the correct number of items, reflecting the updated expected state of the widget.package/PartSeg/_roi_analysis/advanced_window.py (1)
808-808: Enhance dialog management by adding parent parameter.The addition of the
parentparameter to theImportDialoginstantiation improves the dialog's integration within the application's window hierarchy.package/PartSeg/common_gui/napari_image_view.py (1)
416-416: LGTM! But verify the method usage in the codebase.The code changes are approved.
However, ensure that all usages of the
mask_colormethod correctly handle the newNonekey in the returned dictionary.
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.
Actionable comments posted: 0
Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (1)
- package/tests/test_PartSegCore/test_napari_plugins.py (2 hunks)
Additional comments not posted (4)
package/tests/test_PartSegCore/test_napari_plugins.py (4)
30-30: Update the expected number of layers to 4.The expected number of layers has been updated from 3 to 4, reflecting an enhancement in the
project_to_layersfunction.
35-35: Update the index for the second layer.The index for the second layer has been updated from
res[1]tores[2]to accommodate the additional layer.
39-39: Update the index for the third layer.The index for the third layer has been updated from
res[2]tores[3]to accommodate the additional layer.
58-58: Update the expected number of layers to 3.The expected number of layers has been updated from 2 to 3, reflecting an enhancement in the
project_to_layersfunction.
|
|
@coderabbitai review |
Actions performedReview triggered.
|
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.
Actionable comments posted: 0
Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (2)
- package/PartSegCore/analysis/measurement_base.py (1 hunks)
- package/tests/test_PartSegImage/test_image.py (1 hunks)
Files skipped from review as they are similar to previous changes (2)
- package/PartSegCore/analysis/measurement_base.py
- package/tests/test_PartSegImage/test_image.py
fix PARTSEG-VA
Summary by CodeRabbit
Summary by CodeRabbit
New Features
Channelobjects and strings for improved flexibility.Bug Fixes