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

feat: Add distance based watersheed to flow methods #915

Merged
merged 61 commits into from
May 19, 2023

Conversation

Czaki
Copy link
Collaborator

@Czaki Czaki commented Mar 22, 2023

Add option to adjust frame thick for components loaded from mask project.
Multiple minor fixes.

@Czaki Czaki added this to the 0.15.0 milestone Mar 22, 2023
@sourcery-ai
Copy link
Contributor

sourcery-ai bot commented Mar 22, 2023

Sourcery Code Quality Report

✅  Merging this PR will increase code quality in the affected files by 0.12%.

Quality metrics Before After Change
Complexity 3.98 ⭐ 3.89 ⭐ -0.09 👍
Method Length 65.47 🙂 65.71 🙂 0.24 👎
Working memory 7.48 🙂 7.45 🙂 -0.03 👍
Quality 68.78% 🙂 68.90% 🙂 0.12% 👍
Other metrics Before After Change
Lines 9805 10006 201
Changed files Quality Before Quality After Quality Change
package/PartSeg/_roi_analysis/batch_window.py 65.37% 🙂 65.12% 🙂 -0.25% 👎
package/PartSeg/_roi_analysis/main_window.py 65.10% 🙂 65.08% 🙂 -0.02% 👎
package/PartSeg/_roi_analysis/prepare_plan_widget.py 70.46% 🙂 70.38% 🙂 -0.08% 👎
package/PartSeg/_roi_mask/main_window.py 63.11% 🙂 63.15% 🙂 0.04% 👍
package/PartSeg/common_gui/main_window.py 70.86% 🙂 70.70% 🙂 -0.16% 👎
package/PartSeg/common_gui/napari_image_view.py 67.38% 🙂 67.38% 🙂 0.00%
package/PartSegCore/algorithm_describe_base.py 66.67% 🙂 66.67% 🙂 0.00%
package/PartSegCore/analysis/load_functions.py 68.26% 🙂 67.08% 🙂 -1.18% 👎
package/PartSegCore/analysis/measurement_base.py 76.07% ⭐ 76.27% ⭐ 0.20% 👍
package/PartSegCore/analysis/measurement_calculation.py 71.04% 🙂 71.16% 🙂 0.12% 👍
package/PartSegCore/analysis/batch_processing/batch_backend.py 64.87% 🙂 66.05% 🙂 1.18% 👍
package/PartSegCore/image_transforming/__init__.py 86.21% ⭐ 81.83% ⭐ -4.38% 👎
package/PartSegCore/image_transforming/interpolate_image.py 60.73% 🙂 60.51% 🙂 -0.22% 👎
package/PartSegCore/image_transforming/swap_time_stack.py 96.04% ⭐ 95.44% ⭐ -0.60% 👎
package/PartSegCore/image_transforming/transform_base.py 94.01% ⭐ 93.12% ⭐ -0.89% 👎
package/PartSegCore/mask/algorithm_description.py 80.02% ⭐ 77.49% ⭐ -2.53% 👎
package/PartSegCore/mask/io_functions.py 66.63% 🙂 66.63% 🙂 0.00%
package/PartSegCore/segmentation/restartable_segmentation_algorithms.py 74.57% 🙂 74.25% 🙂 -0.32% 👎
package/PartSegCore/segmentation/segmentation_algorithm.py 70.55% 🙂 70.51% 🙂 -0.04% 👎
package/PartSegCore/segmentation/threshold.py 80.98% ⭐ 79.44% ⭐ -1.54% 👎
package/tests/test_PartSegCore/test_image_adjustment.py 87.92% ⭐ 86.80% ⭐ -1.12% 👎
package/tests/test_PartSegCore/segmentation/test_segmentation_algorithm.py 73.83% 🙂 73.83% 🙂 0.00%

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

File Function Complexity Length Working Memory Quality Recommendation
package/PartSeg/_roi_mask/main_window.py MainMenu.load_segmentation 23 😞 320 ⛔ 24.41% ⛔ Refactor to reduce nesting. Try splitting into smaller methods
package/PartSegCore/analysis/batch_processing/batch_backend.py FileData.add_data_part 16 🙂 277 ⛔ 19 ⛔ 27.56% 😞 Try splitting into smaller methods. Extract out complex expressions
package/PartSeg/_roi_analysis/prepare_plan_widget.py PlanPreview.update_view 24 😞 281 ⛔ 13 😞 28.13% 😞 Refactor to reduce nesting. Try splitting into smaller methods. Extract out complex expressions
package/PartSegCore/segmentation/restartable_segmentation_algorithms.py BaseMultiScaleOpening.calculation_run 15 🙂 401 ⛔ 15 😞 29.10% 😞 Try splitting into smaller methods. Extract out complex expressions
package/PartSegCore/mask/io_functions.py load_stack_segmentation_from_tar 15 🙂 358 ⛔ 14 😞 31.05% 😞 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
Copy link

deprecated-napari-hub-preview-bot bot commented Mar 22, 2023

Preview page for your plugin is ready here:
https://preview.napari-hub.org/4DNucleome/PartSeg/915
Updated: 2023-05-19T17:51:07.459906

Czaki pushed a commit that referenced this pull request Mar 22, 2023
Pull Request #915 refactored by [Sourcery](https://sourcery.ai/github/).

If you're happy with these changes, merge this Pull Request using the
*Squash and merge* strategy.

**NOTE**: As code is pushed to the original Pull Request, Sourcery will
re-run and update (force-push) this Pull Request with new refactorings
as
necessary. If Sourcery finds no refactorings at any point, this Pull
Request
will be closed automatically.

See our documentation
[here](https://docs.sourcery.ai/GitHub/Using-Sourcery-for-GitHub/).

<details>
<summary>Run Sourcery locally</summary>
<p>
Reduce the feedback loop during development by using the Sourcery editor
plugin:
</p>
<ul>
<li><a href="https://sourcery.ai/download/?editor=vscode">VS
Code</a></li>
<li><a
href="https://sourcery.ai/download/?editor=pycharm">PyCharm</a></li>
</ul>
</details>

<details>
<summary>Review changes via command line</summary>
<p>To manually merge these changes, make sure you're on the
<code>features/add_new_thresholds</code> branch, then run:</p>
<pre>
git fetch origin sourcery/features/add_new_thresholds
git merge --ff-only FETCH_HEAD
git reset HEAD^
</pre>
</details>

Help us
[improve](https://research.typeform.com/to/j06Spdfr?type=pr_refactor&github_login=Czaki&base_repo=https%3A%2F%2Fgithub.com%2F4DNucleome%2FPartSeg.git&base_remote_ref=refs%2Fpull%2F915%2Fhead&base_ref=features%2Fadd_new_thresholds&base_sha=c507054d2295af0cbbbd823309b7e3506807dc94&head_repo=https%3A%2F%2Fgithub.com%2F4DNucleome%2FPartSeg.git&head_ref=sourcery%2Ffeatures%2Fadd_new_thresholds&base_pr_number=915&base_pr_state=open)
this pull request!

Co-authored-by: Sourcery AI <>
@codecov
Copy link

codecov bot commented Mar 22, 2023

Codecov Report

Patch coverage: 98.78% and project coverage change: +0.07 🎉

Comparison is base (74cb89a) 91.76% compared to head (1758ebd) 91.84%.

Additional details and impacted files
@@             Coverage Diff             @@
##           develop     #915      +/-   ##
===========================================
+ Coverage    91.76%   91.84%   +0.07%     
===========================================
  Files          199      200       +1     
  Lines        30947    31071     +124     
===========================================
+ Hits         28399    28536     +137     
+ Misses        2548     2535      -13     
Impacted Files Coverage Δ
package/PartSeg/plugins/__init__.py 66.66% <33.33%> (-0.99%) ⬇️
...egmentation/restartable_segmentation_algorithms.py 95.38% <95.45%> (+<0.01%) ⬆️
package/PartSeg/_roi_analysis/batch_window.py 70.54% <100.00%> (-0.05%) ⬇️
...ckage/PartSeg/_roi_analysis/prepare_plan_widget.py 90.90% <100.00%> (+0.03%) ⬆️
package/PartSeg/common_gui/napari_image_view.py 87.94% <100.00%> (ø)
package/PartSegCore/algorithm_describe_base.py 87.06% <100.00%> (+0.57%) ⬆️
...SegCore/analysis/batch_processing/batch_backend.py 90.09% <100.00%> (+0.32%) ⬆️
package/PartSegCore/analysis/load_functions.py 84.32% <100.00%> (+1.57%) ⬆️
package/PartSegCore/analysis/measurement_base.py 90.54% <100.00%> (+0.19%) ⬆️
...ge/PartSegCore/analysis/measurement_calculation.py 97.09% <100.00%> (-0.01%) ⬇️
... and 11 more

☔ View full report in Codecov by Sentry.
📢 Do you have feedback about the report comment? Let us know in this issue.

@Czaki Czaki force-pushed the features/add_new_thresholds branch 2 times, most recently from 93d18b2 to a6c9375 Compare March 30, 2023 21:51
Czaki and others added 22 commits April 14, 2023 08:43
Pull Request #915 refactored by [Sourcery](https://sourcery.ai/github/).

If you're happy with these changes, merge this Pull Request using the
*Squash and merge* strategy.

**NOTE**: As code is pushed to the original Pull Request, Sourcery will
re-run and update (force-push) this Pull Request with new refactorings
as
necessary. If Sourcery finds no refactorings at any point, this Pull
Request
will be closed automatically.

See our documentation
[here](https://docs.sourcery.ai/GitHub/Using-Sourcery-for-GitHub/).

<details>
<summary>Run Sourcery locally</summary>
<p>
Reduce the feedback loop during development by using the Sourcery editor
plugin:
</p>
<ul>
<li><a href="https://sourcery.ai/download/?editor=vscode">VS
Code</a></li>
<li><a
href="https://sourcery.ai/download/?editor=pycharm">PyCharm</a></li>
</ul>
</details>

<details>
<summary>Review changes via command line</summary>
<p>To manually merge these changes, make sure you're on the
<code>features/add_new_thresholds</code> branch, then run:</p>
<pre>
git fetch origin sourcery/features/add_new_thresholds
git merge --ff-only FETCH_HEAD
git reset HEAD^
</pre>
</details>

Help us
[improve](https://research.typeform.com/to/j06Spdfr?type=pr_refactor&github_login=Czaki&base_repo=https%3A%2F%2Fgithub.com%2F4DNucleome%2FPartSeg.git&base_remote_ref=refs%2Fpull%2F915%2Fhead&base_ref=features%2Fadd_new_thresholds&base_sha=c507054d2295af0cbbbd823309b7e3506807dc94&head_repo=https%3A%2F%2Fgithub.com%2F4DNucleome%2FPartSeg.git&head_ref=sourcery%2Ffeatures%2Fadd_new_thresholds&base_pr_number=915&base_pr_state=open)
this pull request!

Co-authored-by: Sourcery AI <>
@sonarcloud
Copy link

sonarcloud bot commented May 19, 2023

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
0.0% 0.0% Duplication

@Czaki Czaki changed the title feat: Add option to use distance based watersheed feat: Add distance based watersheed to flow method May 19, 2023
@Czaki Czaki changed the title feat: Add distance based watersheed to flow method feat: Add distance based watersheed to flow methods May 19, 2023
@Czaki Czaki merged commit d62fcc4 into develop May 19, 2023
@Czaki Czaki deleted the features/add_new_thresholds branch May 19, 2023 18:46
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.

1 participant