[addon] Slice Shifter

https://github.com/ChrisRaven/Neuroglancer-Slice-Shifter/raw/refs/heads/main/Slice-shifter.user.js

A small script that might be helpful with misalignments.
I did it in cooperation with Gemini 2.5 Pro. And by cooperation I mean, that I gave the LLM instructions and it did, what I wanted. Then I took the code, tested it, debugged, gave the information back, rinse and repeat until it worked, then we were switching to a next functionality, etc. :smiley:

Here’s how it looks:

image

You can grab it by the header and move where you want. You can also click that small underscore symbol in the top left corner to minimize/restore it. Both the position and the state will be remembered between sessions and instances of Neuroglancer.
It works for https://spelunker.cave-explorer.org/ , https://ngl.brain-wire.org/ and https://play.eyewire.ai/ .

The idea is simple:

  • When you reach a misaligned slice, you click the ā€œGet Zā€ button to get the slice number to the tool. You can also add it manually. You can add manually more than one slice, even non-consequential ones,
  • Then you can reposition the misaligned slice using either the sliders (range from -100 to 100px for both) or by manually typing the offsets,
  • When you’re going to add on a segment on a misaligned slice, the highlighted subvoxels will differ from the normal ones for that segment, but when you add the segment, the correct one will be added (the one under the cursor),
  • When you’re done with solving the misalignment just click the Reset button to remove the offset and the selected slice number.

Moving the 2D moves also the 3D since they are both drawn on the same canvas, but I didn’t find it problematic enough to search for a solution.

At one point I’ve stumbled at a bug, where after selecting a segment, the misaligned slice moved back to it’s position and the whole stack moved by the same offsets by in the opposite directions. I had to refresh the page to fix it. I wasn’t able to reproduce it, so I couldn’t potentially fix it.

2 Likes