-
Notifications
You must be signed in to change notification settings - Fork 102
📝 Update 06-semantic-segmentation notebook for the New API
#978
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
base: dev-define-engines-abc
Are you sure you want to change the base?
Conversation
|
Check out this pull request on See visual diffs & provide feedback on Jupyter Notebooks. Powered by ReviewNB |
for more information, see https://pre-commit.ci
06-semantic-segmentation notebook for the New API
- Update `.readthedocs.yml` to Install CPU Version only for speed up readthedocs build
## Overview This PR addresses **issue #975** and introduces two major improvements: --- ### 1. Improved Index Usage Warning in `SQLiteStore` **Problem:** The previous logic for detecting index usage relied only on the first row of `EXPLAIN QUERY PLAN`. On macOS, this often corresponds to the `rtree` virtual table, so the check missed actual indexes and always warned. **Solution:** - Added a new helper method `_warn_if_query_not_using_index` that inspects **all rows** of the query plan. - The method now looks for any row containing `USING INDEX` or `USING COVERING INDEX` (macOS phrasing). - If no index is detected, a warning is logged; otherwise, it remains silent. **Impact:** More accurate performance warnings and better developer guidance for adding indexes. --- ### 2. Dynamic Port Allocation for Tile Server in Bokeh Tests **Problem:** macOS runs multiple daemons on well-known ports (e.g., `5000`). Tests hardcoded to `http://127.0.0.1:5000/...` often collided with other services, causing `HTML/403` responses and subsequent `JSONDecodeError` or `KeyError`. **Solution:** - Introduced dynamic port binding for the tile server: - At test session start, a free loopback port is reserved and exported as `TIATOOLBOX_TILESERVER_PORT`. - Both the Flask tile server and Bokeh client read this environment variable, ensuring consistent communication. - Updated all relevant tests (`test_app_bokeh.py`, `test_json_config_bokeh.py`, `test_server_bokeh.py`) and CLI launcher to use the dynamic port. - Added proxy bypass (`trust_env=False`) for local requests to avoid interference from system proxies. **Impact:** Eliminates port conflicts, stabilizes UI tests, and improves cross-platform reliability. --- ### Additional Changes - Updated Bokeh app hooks and main logic to respect dynamic port configuration. - Minor refactoring for clarity and maintainability. --- ✅ **Benefits:** - More robust query performance checks. - Reliable test execution across macOS and CI environments. - Cleaner integration between CLI, Bokeh app, and test harness. --- **Closes:** #975 --------- Co-authored-by: Jiaqi Lv <jiaqilv@Jiaqis-MacBook-Pro.local> Co-authored-by: Shan E Ahmed Raza <13048456+shaneahmed@users.noreply.github.com>
for more information, see https://pre-commit.ci
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## dev-define-engines-abc #978 +/- ##
=======================================================
Coverage 95.18% 95.18%
=======================================================
Files 77 77
Lines 9689 9689
Branches 1255 1255
=======================================================
Hits 9222 9222
Misses 431 431
Partials 36 36 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
| bokeh>=3.1.1, <3.6.0 | ||
| Click>=8.1.3, <8.2.0 | ||
| dask>=2025.10.0 | ||
| dask-image>=2025.11.0 |
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.
As this is only used in Jupyter Notebook. I would suggest adding it to the bash cell in the notebook.
|
View / edit / reply to this conversation on ReviewNB shaneahmed commented on 2025-12-23T11:20:34Z You can add pip install dask_image here |
|
View / edit / reply to this conversation on ReviewNB shaneahmed commented on 2025-12-23T11:20:35Z Add a cell at the end to visualize the output using TIAViz. See this example https://app.reviewnb.com/TissueImageAnalytics/tiatoolbox/pull/977/discussion/#comment-3674742370 |
Trying to update example notebook 06.