Skip to content

fix: split traced filaments at sharp bends without a junction (v2.0) - #127

Open
uermel wants to merge 1 commit into
v2.0from
uermel/split-at-bends-v2
Open

uermel wants to merge 1 commit into
v2.0from
uermel/split-at-bends-v2

Conversation

@uermel

@uermel uermel commented Oct 16, 2026

Copy link
Copy Markdown
Member

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 feat: seg2fil stores editable Catmull-Rom curves by default (v2.0) #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

Two filaments that touch end to end skeletonize as one bent branch with
no junction, so seg2fil traced them as one hairpin filament.

A chain from a semantic segmentation is now split wherever it turns by
more than --max-bend over the direction window, the rule junctions use.
Closed chains and instances are kept whole, and the run summary counts
the splits. Each piece is stored with the default Catmull-Rom curve like
any other filament.

On 10426 actin, kinks over 45 degrees drop from 4.9% to 1.5% of
filaments. None of the 102 traced 10521 microtubules changes.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

This branch has not been deployed

No deployments
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