google / google/neuroglancer

2 questions / requests: controlling the key on startup and attaching to a running nglancer server

Open
#174 8 comments 0 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
1.5k
Forks
389
Avg merge
3d 21h
Merged PRs (30d)
3

Description

First question /request:
In a docker framework I'm building out as a combination quick data review tool and development platofrm we are launching a neuroglancer object using python with the `neuroglancer.Viewer()` command and then spinning to keep the process alive so that we can do some initial setup. While I'm guessing this isn't the only way to do this, I couldn't find a way to spin up a free standing neuroglancer instance and pre-load the configuration settings we want. However I'm working to put this all behind an apache proxy to give the end user a simple plane to talk to and can't control the token used to secure neuroglancer on startup so I can't put a simple reverse proxy layer in front of it. This appears to be due to the fact that instantiating a viewer object immediately has side effects before you can tune what you want. My current plan is to put a configurable proxy (https://github.com/jupyterhub/configurable-http-proxy) in front of the neuroglancer instance and use the run time token generation to populate that but i'd like to avoid the hop if possible. I need this conf proxy for volumes anyway but it would still be helpful to control this for smaller setups. If you could just enable passing `token=` into the `__init__` process that would fix this for our use case. I've included a copy of our neuroglancer launcher shim below.

Second question:
Is it possible to attach to a running neuroglancer instance from a remote location, I've got the approach where you instance a neuroglancer viewer object and feed configurations into it working and that works fine if you are doing that from inside a notebook or just spin locking it like we do below. But I'd like to be able to spin up a free standing neuroglancer instance, and then attach to it form a jupyternotebook to use as a hackable development interface. I'm hoping to have a new more capable push up soon to https://github.com/Wildcarde/nglancer-frame that demonstrates at least some of what we are thinking about in this direction.

in dev version of the launcher:
```python
#! /bin/env python

## basic shim to load up neuroglancer in a browser:
import neuroglancer
import logging
from time import sleep
import progproxy

logging.basicConfig(level=logging.DEBUG)
# we are currently using the seunglab hosted neuroglancer static resources
# ideally this would be self hosted for local development against nglancer
logging.info('configuring neuroglancer defaults')
neuroglancer.set_static_content_source(url='https://neuromancer-seung-import.appspot.com')

## set the tornado server that is launched to talk on all ips and at port 8080
neuroglancer.set_server_bind_address('0.0.0.0','8080')

logging.info('starting viewer subprocess')
#setup a viewer with pre-configured defaults and launch.
viewer = neuroglancer.Viewer()

logging.info('viewer token: {}'.format(viewer.token))

logging.info('setting viewers default volume')
#load data from cloudvolume container:
with viewer.txn() as s:
s.layers['segmentation'] = neuroglancer.SegmentationLayer(
source='precomputed://http://localhost/testcv/')

## need to retool this so it shows the correct link, the internal FQDN is not useful
logging.info("viewer at: {}".format(viewer))

logging.debug("neuroglancer viewer is now available")

while(1):
sleep(0.1)
```

edit: sorry about the empty notification email, hit enter early.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.