client-side JS construction of neuroglancer URLs

71 views
Skip to first unread message

davis.v...@gmail.com

unread,
Jan 9, 2020, 10:25:57 AM1/9/20
to Neuroglancer
I need to programmatically generate a list of neuroglancer URLs encoding a lot of viewer state from n5 containers stored on s3. For each n5 container in an s3 bucket, I need to parse the attributes.json file and use that information to create either an image layer or a segmentation layer, adjust transformation matrices, etc.

I could manually construct the viewer state as JSON then escape out all the stuff that's not allowed in a URL, but I wondered if there was an easier way, e.g. to access ViewerState and other neuroglancer classes from clientside javascript, then use methods of those classes to generate a URL. This is the approach I would use if I were doing things in python, but I can't quite see how to do it easily in client-side JS. Complicating things is the fact that I'm very inexperienced with JS...

So, any examples or suggestions would be greatly appreciated!

Ecks Gee

unread,
Sep 26, 2020, 6:29:34 AM9/26/20
to Neuroglancer
Wow, since Jan 9. You might have better luck asking the question on NG github?

AFAIK, in the global scope, there is a viewer object, which you can find various useful info

client side JS also provide encodeURI and encodeURIComponent methods, which should make escaping URL less painful

Reply all
Reply to author
Forward
0 new messages