Skip to content
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

refactor: store PartSegImage.Image channels as separated arrays #554

Merged
merged 23 commits into from
Mar 21, 2022

Conversation

Czaki
Copy link
Collaborator

@Czaki Czaki commented Mar 17, 2022

This PR change storage of Image data from a monolithic array to one array per channel.

Also, PartSegImage is checked using mypy. and mypy was added to the pre-commit configuration.

@lgtm-com
Copy link

lgtm-com bot commented Mar 17, 2022

This pull request introduces 1 alert when merging 51324ff into df7c54d - view on LGTM.com

new alerts:

  • 1 for Unused local variable

@deprecated-napari-hub-preview-bot

Preview page for your plugin is ready here:
https://preview.napari-hub.org/4DNucleome/PartSeg/554

@codecov
Copy link

codecov bot commented Mar 17, 2022

Codecov Report

Merging #554 (051fc54) into develop (df7c54d) will increase coverage by 0.04%.
The diff coverage is 95.83%.

@@             Coverage Diff             @@
##           develop     #554      +/-   ##
===========================================
+ Coverage    77.05%   77.10%   +0.04%     
===========================================
  Files          144      144              
  Lines        18606    18653      +47     
===========================================
+ Hits         14337    14382      +45     
- Misses        4269     4271       +2     
Impacted Files Coverage Δ
package/PartSeg/plugins/old_partseg/old_partseg.py 36.53% <0.00%> (ø)
package/PartSegImage/image.py 90.84% <95.65%> (-1.23%) ⬇️
package/PartSegImage/image_reader.py 96.49% <97.05%> (+0.20%) ⬆️
package/PartSeg/common_backend/base_settings.py 95.47% <100.00%> (+0.01%) ⬆️
package/PartSeg/common_gui/main_window.py 53.81% <100.00%> (+1.35%) ⬆️
package/PartSeg/common_gui/napari_image_view.py 84.78% <100.00%> (-0.14%) ⬇️
...SegCore/analysis/batch_processing/batch_backend.py 89.73% <100.00%> (+0.08%) ⬆️
...ge/PartSegCore/analysis/measurement_calculation.py 96.98% <100.00%> (-0.01%) ⬇️
package/PartSegCore/segmentation/algorithm_base.py 88.14% <100.00%> (ø)
package/PartSegImage/image_writer.py 93.82% <100.00%> (-0.15%) ⬇️
... and 3 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update df7c54d...051fc54. Read the comment docs.

sourcery-ai bot and others added 4 commits March 17, 2022 17:50
…ed) (#555)

Co-authored-by: Sourcery AI <>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
@deprecated-napari-hub-preview-bot

Preview page for your plugin is ready here:
https://preview.napari-hub.org/4DNucleome/PartSeg/554

@lgtm-com
Copy link

lgtm-com bot commented Mar 17, 2022

This pull request introduces 1 alert when merging 6f7069a into df7c54d - view on LGTM.com

new alerts:

  • 1 for Unused local variable

@deprecated-napari-hub-preview-bot

Preview page for your plugin is ready here:
https://preview.napari-hub.org/4DNucleome/PartSeg/554

@deprecated-napari-hub-preview-bot

Preview page for your plugin is ready here:
https://preview.napari-hub.org/4DNucleome/PartSeg/554

@deprecated-napari-hub-preview-bot

Preview page for your plugin is ready here:
https://preview.napari-hub.org/4DNucleome/PartSeg/554

@lgtm-com
Copy link

lgtm-com bot commented Mar 19, 2022

This pull request introduces 1 alert when merging 1f9c6e0 into df7c54d - view on LGTM.com

new alerts:

  • 1 for Unused local variable

@deprecated-napari-hub-preview-bot

Preview page for your plugin is ready here:
https://preview.napari-hub.org/4DNucleome/PartSeg/554

@lgtm-com
Copy link

lgtm-com bot commented Mar 19, 2022

This pull request introduces 1 alert when merging 8ad390c into df7c54d - view on LGTM.com

new alerts:

  • 1 for Unused local variable

@deprecated-napari-hub-preview-bot

Preview page for your plugin is ready here:
https://preview.napari-hub.org/4DNucleome/PartSeg/554

@Czaki Czaki marked this pull request as ready for review March 20, 2022 16:59
@deprecated-napari-hub-preview-bot

Preview page for your plugin is ready here:
https://preview.napari-hub.org/4DNucleome/PartSeg/554

@Czaki Czaki added this to the 0.14.0 milestone Mar 20, 2022
@Czaki Czaki added the refactor Refacor of code label Mar 20, 2022
@deprecated-napari-hub-preview-bot

Preview page for your plugin is ready here:
https://preview.napari-hub.org/4DNucleome/PartSeg/554

@deprecated-napari-hub-preview-bot

Preview page for your plugin is ready here:
https://preview.napari-hub.org/4DNucleome/PartSeg/554

@deprecated-napari-hub-preview-bot

Preview page for your plugin is ready here:
https://preview.napari-hub.org/4DNucleome/PartSeg/554

@deprecated-napari-hub-preview-bot

Preview page for your plugin is ready here:
https://preview.napari-hub.org/4DNucleome/PartSeg/554

@deprecated-napari-hub-preview-bot

Preview page for your plugin is ready here:
https://preview.napari-hub.org/4DNucleome/PartSeg/554

@sourcery-ai
Copy link
Contributor

sourcery-ai bot commented Mar 21, 2022

Sourcery Code Quality Report

❌  Merging this PR will decrease code quality in the affected files by 0.01%.

Quality metrics Before After Change
Complexity 2.79 ⭐ 2.80 ⭐ 0.01 👎
Method Length 60.62 ⭐ 60.73 ⭐ 0.11 👎
Working memory 7.66 🙂 7.67 🙂 0.01 👎
Quality 72.62% 🙂 72.61% 🙂 -0.01% 👎
Other metrics Before After Change
Lines 10655 10828 173
Changed files Quality Before Quality After Quality Change
package/PartSeg/common_backend/base_settings.py 85.61% ⭐ 85.69% ⭐ 0.08% 👍
package/PartSeg/common_gui/main_window.py 67.98% 🙂 67.96% 🙂 -0.02% 👎
package/PartSeg/common_gui/napari_image_view.py 67.57% 🙂 67.57% 🙂 0.00%
package/PartSeg/plugins/old_partseg/old_partseg.py 51.10% 🙂 51.02% 🙂 -0.08% 👎
package/PartSegCore/analysis/measurement_calculation.py 73.55% 🙂 73.73% 🙂 0.18% 👍
package/PartSegCore/analysis/batch_processing/batch_backend.py 65.41% 🙂 65.12% 🙂 -0.29% 👎
package/PartSegCore/segmentation/algorithm_base.py 85.44% ⭐ 85.51% ⭐ 0.07% 👍
package/PartSegImage/image.py 72.47% 🙂 72.31% 🙂 -0.16% 👎
package/PartSegImage/image_reader.py 58.70% 🙂 58.27% 🙂 -0.43% 👎
package/PartSegImage/image_writer.py 71.48% 🙂 71.90% 🙂 0.42% 👍
package/tests/test_PartSeg/test_common_backend.py 77.17% ⭐ 77.23% ⭐ 0.06% 👍
package/tests/test_PartSeg/test_settings.py 78.00% ⭐ 78.00% ⭐ 0.00%
package/tests/test_PartSegCore/test_image_adjustment.py 88.96% ⭐ 88.90% ⭐ -0.06% 👎
package/tests/test_PartSegCore/test_io.py 69.90% 🙂 69.70% 🙂 -0.20% 👎
package/tests/test_PartSegCore/test_measurements.py 70.81% 🙂 70.82% 🙂 0.01% 👍
package/tests/test_PartSegCore/test_segmentation.py 72.96% 🙂 72.94% 🙂 -0.02% 👎
package/tests/test_PartSegImage/test_image.py 77.06% ⭐ 76.99% ⭐ -0.07% 👎
package/tests/test_PartSegImage/test_image_reader.py 88.46% ⭐ 88.48% ⭐ 0.02% 👍

Here are some functions in these files that still need a tune-up:

File Function Complexity Length Working Memory Quality Recommendation
package/PartSegCore/analysis/batch_processing/batch_backend.py FileData.add_data_part 26 😞 257 ⛔ 21 ⛔ 20.32% ⛔ Refactor to reduce nesting. Try splitting into smaller methods. Extract out complex expressions
package/PartSegImage/image.py Image.__init__ 15 🙂 273 ⛔ 20 ⛔ 27.87% 😞 Try splitting into smaller methods. Extract out complex expressions
package/PartSegCore/analysis/batch_processing/batch_backend.py CalculationProcess.do_calculation 23 😞 238 ⛔ 13 😞 30.79% 😞 Refactor to reduce nesting. Try splitting into smaller methods. Extract out complex expressions
package/PartSegImage/image_reader.py ObsepImageReader.read 21 😞 213 ⛔ 13 😞 33.67% 😞 Refactor to reduce nesting. Try splitting into smaller methods. Extract out complex expressions
package/PartSegImage/image_reader.py TiffImageReader.read 10 🙂 284 ⛔ 17 ⛔ 34.08% 😞 Try splitting into smaller methods. Extract out complex expressions

Legend and Explanation

The emojis denote the absolute quality of the code:

  • ⭐ excellent
  • 🙂 good
  • 😞 poor
  • ⛔ very poor

The 👍 and 👎 indicate whether the quality has improved or gotten worse with this pull request.


Please see our documentation here for details on how these metrics are calculated.

We are actively working on this report - lots more documentation and extra metrics to come!

Help us improve this quality report!

@deprecated-napari-hub-preview-bot

Preview page for your plugin is ready here:
https://preview.napari-hub.org/4DNucleome/PartSeg/554

@Czaki Czaki changed the title refactor: store Image channels as separated arrays refactor: store PartSegImage.Image channels as separated arrays Mar 21, 2022
@Czaki Czaki merged commit f687b82 into develop Mar 21, 2022
@Czaki Czaki deleted the feature/image_separate_channels branch March 21, 2022 10:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
refactor Refacor of code
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant