Repository navigation
feat: seg2fil stores editable Catmull-Rom curves by default (v2.0) - #117
Merged
Merged
Conversation
seg2fil stored each filament as its exact B-spline fit, whose many control points editors can move but not add or remove, so curating traces in ChimeraX-copick or napari-copick started with a manual conversion. It now stores a Catmull-Rom curve through the fit by default: the editors' own conversion, with points a voxel apart and within half a voxel of the fit, which is below the fit's smoothing and has fewer control points (12-24 instead of 23-44 for the microtubules of dataset 10521 run 35962). `--curve bspline` stores the exact fit as before. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
uermel
pushed a commit
that referenced
this pull request
Oct 6, 2026
🤖 I have created a release *beep* *boop* --- ## [2.0.0-alpha.4](copick-utils-v2.0.0-alpha.3...copick-utils-v2.0.0-alpha.4) (2026-10-06) ### ✨ Features * seg2fil stores editable Catmull-Rom curves by default (v2.0) ([#117](#117)) ([e768a0d](e768a0d)) --- Merging this PR will publish a copick-utils alpha prerelease to PyPI. Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
uermel
added a commit
that referenced
this pull request
Oct 19, 2026
…127) The v2.0 counterpart of #126; the patch is identical. Two filaments that touch end to end skeletonize as one bent branch with no junction: a V, or one filament ending against another at an acute angle. The pairing at junctions never sees the turn, so seg2fil traced them as one hairpin filament. On dataset 10426 with easymode actin, such joins turned by up to 159 degrees. **Change** - A chain from a semantic segmentation is now split wherever it turns by more than `--max-bend` between its directions over the direction window before and after a point. This is the same rule and window that junctions use. - Each piece loses one label radius at the split, as a branch does at a junction, and the new ends are not extended. - Closed chains and instance segmentations are kept whole. - The run summary reports how many filaments were split. - The split happens before fitting, so each piece is stored with the default Catmull-Rom curve from #117 like any other filament. **Effect** - 10426 actin, run 16853 at threshold 0.2: kinks over 45 degrees drop from 4.9% to 1.5% of filaments, and length-weighted straightness rises from 0.956 to 0.987, with no change in traced length. - 10521: none of the 102 microtubules traced on 58 tomograms changes. **Tests** - New `test_two_filaments_touching_end_to_end_are_two_filaments`: a V traces as two straight filaments, with one split counted. - Checked by hand: default seg2fil on the same V stores two straight Catmull-Rom filaments. - `test_filaments.py`, `test_converter_signatures.py` and `test_run_names_option.py`: 53 passed on v2.0 with the locked environment. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
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.
Port of the main-line change to v2.0.
copick convert seg2filstored every filament as its exact B-spline fit. Editors can move a B-spline's control points but not add or remove them, so curating automatic traces in ChimeraX-copick or napari-copick began with Convert to Catmull-Rom on each filament.Change: seg2fil now stores a Catmull-Rom curve through the fitted spline by default. It is the same conversion the editors' Convert button does (
CopickFilament.editable_curve): control points a voxel apart, within half a voxel of the fit.--curve bsplinestores the exact fit as before, andmetadata["fit"]["stored_curve"]records which one was stored.On dataset 10521, run 35962, the three traced microtubules (370–740 nm) get 11–24 Catmull-Rom control points instead of 12–44 B-spline handles. The converted centrelines deviate from the fit by at most 6.5 Å (mean 2–3 Å), less than the fit's own smoothing (half a voxel RMS) and under one voxel.
fit-spline --filamentsis unchanged and still stores B-splines.Tests
--curve bspline: the stored curve is the exact fit, and the default Catmull-Rom points lie within half a voxel of it.🤖 Generated with Claude Code