Skip to content

fibermorph-v2#16

Merged
tinalasisi merged 10 commits into
lasisilab:fibermorph-devfrom
ezhil384:main
Jul 3, 2026
Merged

fibermorph-v2#16
tinalasisi merged 10 commits into
lasisilab:fibermorph-devfrom
ezhil384:main

Conversation

@ezhil384

@ezhil384 ezhil384 commented Jul 3, 2026

Copy link
Copy Markdown
Collaborator

New version of fibermorph

ezhil384 and others added 10 commits March 14, 2026 16:34
- 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
@eraser-labs

eraser-labs Bot commented Jul 3, 2026

Copy link
Copy Markdown

fibermorph-architecture

View in eraser

Generated Diagram

Updated as of commit: d06b3eca317f09837f12408764774c56dba5a92c

Changed Files
Relevant Files
  • fibermorph/main.py
  • fibermorph/cli.py
  • fibermorph/fibermorph.py
  • fibermorph/workflows.py
  • fibermorph/analysis/section_pipeline.py
  • fibermorph/analysis/curvature_pipeline.py
  • fibermorph/analysis/parallel.py
  • fibermorph/io/readers.py
  • fibermorph/io/writers.py
  • fibermorph/io/converters.py
  • fibermorph/core/section.py
  • fibermorph/core/curvature.py
  • fibermorph/core/filters.py
  • fibermorph/core/shape_analysis.py
  • fibermorph/processing/section_sam2.py
  • fibermorph/pipeline/batch.py
  • fibermorph/gui/app.py
  • fibermorph/gui/visualizations.py
  • fibermorph/processing/binary.py
  • fibermorph/processing/morphology.py
  • fibermorph/processing/geometry.py
  • fibermorph/utils/filesystem.py
  • fibermorph/utils/metadata.py
  • fibermorph/utils/timing.py
  • fibermorph/fibermorph_compat.py
  • fibermorph/demo/dummy_data.py
  • fibermorph/gui/launcher.py
Diagram Syntax
title CI Pipeline Workflow

Developer [icon: user, color: blue]
GitHub [icon: github]
CI Runner [icon: server, color: green]
Cache Service [icon: database, color: orange]
Test Environment [icon: tool, color: green]
Artifact Storage [icon: archive, color: orange]

Developer > GitHub: Push code changes
activate Developer
GitHub > CI Runner: Trigger workflow

CI Runner > CI Runner: Set up environment
CI Runner > Cache Service: Check for cached dependencies

alt [label: cache exists, icon: check] {
  Cache Service > CI Runner: Return cached dependencies
}
else [label: cache miss, icon: x] {
  CI Runner > CI Runner: Install dependencies
  CI Runner > Cache Service: Store dependencies in cache
}

CI Runner > CI Runner: Install project dependencies

par [label: parallel jobs, icon: layers] {
  CI Runner > Test Environment: Run linting checks
}
and {
  CI Runner > Test Environment: Run unit tests
}
and {
  CI Runner > Test Environment: Run integration tests
}

loop [label: retry on failure, icon: refresh-cw] {
  Test Environment > Test Environment: Execute test suite
}

opt [label: tests pass, icon: check-circle] {
  CI Runner > Artifact Storage: Upload test results
  CI Runner > Artifact Storage: Upload coverage report
}

alt [label: all checks pass, icon: thumbs-up] {
  CI Runner > GitHub: Report success status
  GitHub > Developer: Notify build passed
}
else [label: checks fail, icon: thumbs-down] {
  CI Runner > GitHub: Report failure status
  GitHub > Developer: Notify build failed
}

deactivate Developer

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 thread fibermorph/__init__.py
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 thread STREAMLIT_DEPLOYMENT.md
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 thread Dockerfile
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 thread conda-recipe/meta.yaml
Comment on lines +1 to +2
{% set name = "fibermorph" %}
{% set version = "0.3.9" %}
Comment thread conda-recipe/meta.yaml
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
@tinalasisi
tinalasisi changed the base branch from main to fibermorph-dev July 3, 2026 21:02
@tinalasisi
tinalasisi merged commit 03c714d into lasisilab:fibermorph-dev Jul 3, 2026
1 check failed
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.

4 participants