fibermorph-v2#16
Merged
Merged
Conversation
- README: remove HuggingFace Spaces YAML frontmatter (was rendering as raw text on GitHub) - packages.txt: replace libgl1-mesa-glx (removed in Debian bookworm/trixie) with libgl1 - requirements.txt: use -e ".[gui]" to include matplotlib and seaborn for the Streamlit Cloud visualizations tab - streamlit_app.py: replace main() call (removed in new app.py) with exec() pattern so Streamlit's re-run model works correctly - test.yaml: drop poetry in favour of plain pip (avoids poetry.lock sync issues after adding opencv-python-headless); add libgl1/libglib2.0-0 apt step; run tests on feature/** branches too - conventional-prs.yaml: mark title check continue-on-error in fork (advisory only; lasisilab enforces it on the upstream PR) Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…flict libglib2.0-0 from Bullseye repos requires libffi7 which is not available on the Trixie-based Streamlit Cloud image. opencv-python-headless needs no system GL libraries, so packages.txt can be empty. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…as package names apt-get was trying to install each word of the comment as a package.
Streamlit Cloud now runs Python 3.14.4. The previous caret constraints (^1.26.4 for numpy, ^0.22 for scikit-image, ^10.2 for pillow) forced pip to use source distributions that fail to compile on Python 3.14. Widening to >=X allows pip to resolve pre-built wheels for newer minor versions. Also remove quotes around .[gui] in requirements.txt for uv compatibility.
app.py was calling segment_section() with sam2_checkpoint=/sam2_cfg= (hair_analysis names) but section_sam2.py defines checkpoint=/model_cfg=.
- TestComputeEFD: access efd["efd_coeffs"] instead of treating return value as ndarray directly - TestComputeRadialProfile: update key names to radial_* prefix, replace missing radius_range_mu with computed radial_max - radial_min, add n_radial_peaks to expected key set - TestExtractFeaturesFromArray: fix call signature (resolution_mu=, source_name=), adapt assertions for dict return type, fix efd key count (51 not 40), fix hu prefix (no underscore) - TestClassifyShape: add n_radial_peaks and asymmetry_index to all feature dicts (now required by classify_shape) - test_section_pipeline: fix hu column prefix from hu_ to hu - TestCurlIndex: make _curved_skel dense enough to avoid disconnected segments causing nan; fix assertion direction (chord/arc metric gives lower values for curved lines, not higher) Agent-Logs-Url: https://github.com/ezhil384/fibermorph/sessions/86945c40-fef0-4344-97fa-c44ac3c5e80d Co-authored-by: ezhil384 <80913303+ezhil384@users.noreply.github.com>
…ctored-version fix(tests): align test suite with refactored v2 API
Feature/v2 enhanced analysis
fibermorph-architectureUpdated as of commit: d06b3eca317f09837f12408764774c56dba5a92c Changed FilesRelevant Files
Diagram Syntax |
There was a problem hiding this comment.
Pull request overview
This PR introduces the “fibermorph v2” release, expanding the analysis pipelines (extended section/curvature metrics), adding optional SAM2-based cross-section segmentation with CPU fallback, and updating deployment/testing assets (Streamlit + Docker + CI).
Changes:
- Bump package to 2.0.0 and add/adjust dependencies + extras for GUI/viz and headless environments.
- Add new functionality: batch pipeline, extended feature extraction, CLAHE curvature path, and optional SAM2 segmentation module.
- Expand tests substantially and update deployment docs / Docker / GitHub Actions workflows.
Reviewed changes
Copilot reviewed 31 out of 77 changed files in this pull request and generated 8 comments.
Show a summary per file
| File | Description |
|---|---|
| tools/inventory_imports.py | Formatting-only update for the import inventory helper script. |
| test_py313.sh | Formatting-only update for the Python 3.13 install test script. |
| test_installation.sh | Formatting-only update for multi-version install test script. |
| STREAMLIT_DEPLOYMENT.md | Streamlit deployment doc expanded (now also documents Hugging Face Spaces Docker path). |
| streamlit_app.py | Switches Streamlit entrypoint to exec-based re-run behavior. |
| requirements.txt | Streamlit deployment requirements now install editable package with [gui] extras. |
| pyproject.toml | Bumps version to 2.0.0; updates dependency constraints; expands extras. |
| packages.txt | Removes Streamlit Cloud system package list. |
| LICENSE | Formatting-only (line-numbered diff) change. |
| fibermorph/utils/timing.py | Formatting-only (line-numbered diff) change. |
| fibermorph/utils/metadata.py | Adds filename metadata parsing and image collection utilities. |
| fibermorph/utils/logging_config.py | Formatting-only (line-numbered diff) change. |
| fibermorph/utils/filesystem.py | Formatting-only (line-numbered diff) change. |
| fibermorph/test/test_utils_timing.py | Formatting-only (line-numbered diff) change. |
| fibermorph/test/test_utils_metadata.py | Adds tests for utils.metadata (parse + directory scan). |
| fibermorph/test/test_utils_filesystem.py | Formatting-only (line-numbered diff) change. |
| fibermorph/test/test_section_pipeline.py | Adds tests for updated section pipeline behavior/extended features. |
| fibermorph/test/test_processing_binary.py | Formatting-only (line-numbered diff) change. |
| fibermorph/test/test_pipeline_batch.py | Adds tests for per-sample aggregation logic. |
| fibermorph/test/test_io_writers.py | Formatting-only (line-numbered diff) change. |
| fibermorph/test/test_io_readers.py | Formatting-only (line-numbered diff) change. |
| fibermorph/test/test_curvature_pipeline.py | Adds tests for CLAHE path + extended curvature outputs. |
| fibermorph/test/test_core_shape_analysis.py | Adds unit tests for new shape-analysis feature extraction/classification APIs. |
| fibermorph/test/test_core_filters.py | Extends filter tests; adds coverage for CLAHE filter path. |
| fibermorph/test/test_core_curvature_extended.py | Adds tests for new extended curvature metrics (curl index, wave count). |
| fibermorph/test_data/SimArcData/Oct06_1855_32_017780_arc_data.csv | Formatting-only (line-numbered diff) change. |
| fibermorph/test_data/SimArcData/Oct06_1855_32_017780_arc_data_errordata.csv | Formatting-only (line-numbered diff) change. |
| fibermorph/processing/section_sam2.py | New optional SAM2 segmentation module with watershed fallback. |
| fibermorph/processing/geometry.py | Formatting-only (line-numbered diff) change. |
| fibermorph/processing/binary.py | Formatting-only (line-numbered diff) change. |
| fibermorph/pipeline/batch.py | Adds batch runner + per-sample aggregation. |
| fibermorph/pipeline/init.py | Adds pipeline package init (file presence). |
| fibermorph/io/writers.py | Formatting-only (line-numbered diff) change. |
| fibermorph/io/readers.py | Formatting-only (line-numbered diff) change. |
| fibermorph/io/converters.py | Reorders optional rawpy import (still optional). |
| fibermorph/gui/launcher.py | Formatting-only (line-numbered diff) change. |
| fibermorph/gui/init.py | Formatting-only (line-numbered diff) change. |
| fibermorph/fibermorph.py | Formatting-only (line-numbered diff) change. |
| fibermorph/fibermorph_compat.py | Formatting-only (line-numbered diff) change. |
| fibermorph/demo/init.py | Formatting-only (line-numbered diff) change. |
| fibermorph/core/filters.py | Adds filter_curv_clahe (CLAHE + Frangi + ROI Otsu). |
| fibermorph/analysis/section_pipeline.py | Adds SAM2/watershed segmentation path + extended feature option. |
| fibermorph/analysis/parallel.py | Formatting-only (line-numbered diff) change. |
| fibermorph/analysis/curvature_pipeline.py | Adds CLAHE option + extended curvature metrics path. |
| fibermorph/.gitignore | Formatting-only (line-numbered diff) change. |
| fibermorph/main.py | Formatting-only (line-numbered diff) change. |
| fibermorph/init.py | Makes import more resilient; expands exports for v2 APIs. |
| docs/dependency-audit.md | Formatting-only (line-numbered diff) change. |
| docs/CONDA_FORGE_SETUP.md | Formatting-only (line-numbered diff) change. |
| Dockerfile | Adds CPU + GPU targets for containerized Streamlit deployments. |
| conda-recipe/meta.yaml | Formatting-only currently, but recipe content remains pinned to old version. |
| CHANGELOG.md | Adds 2.0.0 release notes and new feature list. |
| .streamlit/config.toml | Formatting-only (line-numbered diff) change. |
| .python-version | Formatting-only (line-numbered diff) change. |
| .gitignore | Formatting-only (line-numbered diff) change. |
| .github/workflows/test.yaml | Switches CI to pip editable install, adds system libs for OpenCV/headless. |
| .github/workflows/publish.yml | Formatting-only (line-numbered diff) change. |
| .github/workflows/conventional-prs.yaml | Makes semantic PR check advisory (continue-on-error). |
| .dockerignore | New docker ignore list to reduce build context. |
| .devcontainer/devcontainer.json | Formatting-only (line-numbered diff) change. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+153
to
+157
| resolution_mu = 1000.0 / resolution | ||
| diam = 2.0 * dist_map[rows, cols] / resolution_mu | ||
| im_df["diameter_mean_mu"] = float(np.mean(diam)) | ||
| mean_d = float(np.mean(diam)) | ||
| im_df["diameter_cv"] = float(np.std(diam) / (mean_d + 1e-10)) |
Comment on lines
+137
to
+141
| if "curv_mean_mean" in im_df.columns: | ||
| curv_vals = im_df["curv_mean_mean"].dropna().values | ||
| else: | ||
| curv_vals = np.array([]) | ||
| wc = int(wave_count_fn(curv_vals)) if len(curv_vals) > 0 else 0 |
Comment on lines
+45
to
+50
| elif isinstance(result, pd.DataFrame) and not result.empty: | ||
| row_dict = result.iloc[0].to_dict() | ||
| row_dict["image_type"] = image_type | ||
| row_dict["source_file"] = fname | ||
| row_dict.update(parse_metadata(fname)) | ||
| rows.append(row_dict) |
Comment on lines
115
to
119
| "imread", | ||
| "save_image", | ||
| "raw_to_gray", | ||
| # Utility functions | ||
| "make_subdirectory", | ||
| "copy_if_exist", | ||
| "list_images", | ||
| "convert", | ||
| "timing", | ||
| # Demo | ||
| "demo", |
Comment on lines
+36
to
+40
| - **`streamlit_app.py`**: Entry point for Streamlit Cloud | ||
| - **`requirements.txt`**: Python dependencies | ||
| - **`.python-version`**: Specifies Python 3.11 | ||
| - **`.streamlit/config.toml`**: App configuration (theme, upload limits, etc.) | ||
| - **`packages.txt`**: System-level dependencies for image processing |
Comment on lines
+76
to
+79
| RUN python3.11 -m pip install --upgrade pip && \ | ||
| python3.11 -m pip install ".[gui]" && \ | ||
| python3.11 -m pip install torch --index-url https://download.pytorch.org/whl/cu121 && \ | ||
| python3.11 -m pip install git+https://github.com/facebookresearch/segment-anything-2 |
Comment on lines
+1
to
+2
| {% set name = "fibermorph" %} | ||
| {% set version = "0.3.9" %} |
Comment on lines
+8
to
+10
| source: | ||
| url: https://pypi.io/packages/source/{{ name[0] }}/{{ name }}/fibermorph-{{ version }}.tar.gz | ||
| sha256: REPLACE_WITH_SHA256_FROM_PYPI # Get from https://pypi.org/project/fibermorph/0.3.9/#files |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

New version of fibermorph