Skip to content

Fix contact-id labels clustering on double-sided probes#71

Merged
alejoe91 merged 2 commits into
SpikeInterface:mainfrom
h-mayorquin:fix_non_coupled_layers
Jul 15, 2026
Merged

Fix contact-id labels clustering on double-sided probes#71
alejoe91 merged 2 commits into
SpikeInterface:mainfrom
h-mayorquin:fix_non_coupled_layers

Conversation

@h-mayorquin

@h-mayorquin h-mayorquin commented Jul 15, 2026

Copy link
Copy Markdown
Collaborator

On double-sided probes (Cambridge NeuroTech ASSY-325D-*), turning on contact ids makes the numbers collapse into an unreadable clump along each shank. You can see it on the current site: https://spikeinterface.github.io/probeinterface_library/#/probes/cambridgeneurotech/ASSY-325D-E-1?zoom=12&cx=0&cy=150&ids=1 . The same view of a single-sided probe stays clean, because #64 already sized labels to fit each contact there: https://spikeinterface.github.io/probeinterface_library/#/probes/cambridgeneurotech/ASSY-1-E-1?zoom=12&cx=0&cy=150&ids=1 . The double-sided viewer simply never got that fix, so its labels used a fixed screen-size font that ignores how big the contact actually is.

This extends the fit-to-contact sizing from #64 to the double-sided viewer, so labels shrink and grow with their pads and stay legible at any zoom. The reason the fix went missing is that the two viewers (and the image export) each carried their own copy of the drawing code, so this also moves that shared code into one place so the same bug cannot reappear in only one of them. Preview on this branch: https://h-mayorquin.github.io/probeinterface_library/#/probes/cambridgeneurotech/ASSY-325D-E-1?zoom=55&cx=0&cy=150&ids=1

…vases

Move the fit-to-contact contact-id sizing (computeIdLabelInfo + drawContactIds)
and the contact-shape corner rounding into geometry/draw.ts, and thread the
per-probe zoom cap through useProbeViewport. ProbeCanvas now sits on top of the
shared hook and drawing layer instead of reimplementing them, and
DoubleSidedProbeCanvas calls the same drawContactIds (restricted to the visible
face) so double-sided probes get the same label sizing as single-sided ones.
Drops ProbeCanvas's dead forwardRef; net ~290 fewer lines.
Extract computeGeometry/computeScale/computeProjection into geometry/viewport.ts
and use it from useProbeViewport, both canvases, and exportUtils, removing the
duplicate copies. The PNG export now draws contacts and the scale bar through
geometry/draw.ts (keeping its export-only white background, drop-shadow, and
opaque contour); the SVG export shares geometry/projection but keeps its own
markup. PNG-exported contacts gain the rounded corners the screen and SVG
already used.
@h-mayorquin h-mayorquin self-assigned this Jul 15, 2026
@h-mayorquin
h-mayorquin requested a review from alejoe91 July 15, 2026 16:30
@alejoe91
alejoe91 merged commit 5727a54 into SpikeInterface:main Jul 15, 2026
1 check passed
@h-mayorquin
h-mayorquin deleted the fix_non_coupled_layers branch July 15, 2026 17:18
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.

2 participants