Eyewire 2/pyr player script: 2D tools

I have created a new EW2/pyr userscript, which does the following based on a convo in EW 2 misc talk - #68 by KrzysztofKruk with the original idea being @KrzysztofKruk 's and additional ideas/thoughts from me and @annkri :

It creates and places a button under the 2D only button in the 2D that has the following three (3) functions.

  1. A coordinates set(s) save and jump system.

    you go to the slice you want and you click the “+save pre jump here” button,
    image
    name it whatever you want and click ok. You’ll have a second popup to click ok from. DO NOT click the don’t show me any further popups.
    Then go to the post jump slide and click ‘set post here’.

    image
    You can choose whether to select ‘auto’ or not, without auto enabled/clicked you’ll have to manually click the go pre/post buttons every time. With the auto enabled/clicked it’ll do so on it’s on. It is somewhat…finecky/sensitive to scrolling, so if you want it to do the jump automatically you have to be careful when you reach the slide you have set as pre scroll very slowly to the right next slide and wait half a second then it’ll jump on its own, (pre or post) if you scroll through it very fast it won’t engage the required jumping mechanism.

My suggestion is if you do decide to go with auto don’t set the pre and/or post jump slides/ coordinates on the slide(s) you are going to be adding lasso overlays on (that’s 2 below), set them 1 slide below/above (pre/post) so that you have a buffer zone and you dont endanger pausing scroll to set/view overlays only for the script to auto jump you to pre/post.

You can store up to 20 pre/post coordinate pairs per dataset.

  1. a lasso selection tool that allows you to create shapes on a slice (any slice) on the 2D and when you stop ‘drawing’ out the lasso outline it shows you a colour picker pop up, you select the colour you want and click ok, That new coloured in shape (at 40% opacity so that it doesn’t hide the 2D beneath) will auto-correct its size and/or position if you pan and/or zoom in/out and will vanish if you scroll away from that particular slice.
    Imgur: The magic of the Internet

So how to work this:


click 'Enable lasso" and draw out the outline on the 2D structure you wish to create a coloured overlay on.

Then click the colour you want (you can also click the right of the two coloured rectangulars for a custom colour picker, then click the left of the two white buttons (I forgot to tell chatgpt to change them to ok/cancel and now I’m too frustrated with it to go and ask it to change them haha) like in the video above.

You can store up to 40 coloured overlays per dataset. In theory 20 pre and 20 post should be enough to determine a correct extension past a misalignment.

  1. You can download a screenshot of two different (or even one) 2D screenshot. And if you have any coloured overlays on it’ll include them as well.


Click ‘capture Sldie 1’ on the 2D slide you want.

Then go to the second slide (ie: post jump) you want to capture and click “capture Slide 2” then click Preview.


And you can then click 'Download Combined Jpg" if you want and it’ll download the two slides with the overlayed coloured shapes onto your PC. :blush: :sunglasses:

Another tool to aid with those pesky misalignments.

To install the script you’ll need tampermonkey.
Then create a new userscript and copy paste the script from in here:

Overwriting any sample code.
Refresh ew2/pyr and enjoy! :smiley:

2 Likes

Excellent!

I’ve modified the navigateTo() function slightly so instead of reloading the whole state it now jumps directly to the new location. I did it because the original caused 1-2s delays between jumps on my PC:

2 Likes

This is amazing!! We def need to get these tools on the live site. Will look next week.

2 Likes

I built a prototype of your black spill feature request here https://claude-2d-tools-prototype-dot-brain-wire-dot-seung-lab.ue.r.appspot.com/

To try it on MEC, go to a misalignment (annkri mentioned around z 2663) and press 2D Tools at the top right of the 2D view.

  1. Jump pairs:
  • Scroll to one side of the misalignment and press + New pair, A here.
  • Scroll to the other side and press Set B.
  • ⇄ now jumps back and forth at the same zoom. A and B go straight to each side. You can rename a pair by typing in its name.
  1. Lasso:
  • Press Lasso, pick a color, and drag around a shape.
  • Scrolling still changes slices while you draw, and Esc stops drawing.
  • The shape shows only on its own slice. Remove it with its chip, such as 1 ×, or use Clear for the whole slice.
  1. Compare:
  • Press Capture 1, move somewhere else, then press Capture 2.
  • Download saves one side-by-side image with both slices, their coordinates and any lassos.

What to look at:

  • Confusing interface: whether it’s clear how to use this tool and what it is for (for new users).
  • Jump speed: whether it’s fast enough on MEC. I used Krzysztof’s approach of jumping straight there without reloading the view.
  • Lasso accuracy: whether the shape stays on the same tissue.

Limits of the prototype:

  • Pairs and shapes are saved only in your browser, per dataset (up to 20 pairs and 40 shapes), so they don’t follow your account or share links. They also don’t appear on the live site.
  • The lasso works on the regular front 2D view only, not rotated views. Shapes attach to the slice number.
  • It’s a straight jump, without Nik’s auto-jump on scroll, which he said himself was sensitive.
  • It’s a test version anyone with the link can open, and it’s built from the current live site.

Currently adding a way to make the captured views larger and an (i) box that explains the feature.

cc @Nseraf @KrzysztofKruk @sorek_m @celiad

2 Likes

This feature has been deployed! Please submit any feedback via triage reports. Thanks for the suggestion and for building the prototype! If you click the (i) box in 2D Tools you’ll see you get a little shoutout :slight_smile:

For science!

2 Likes