Skip to content

utils

ngtools.utils

Various utilities.

neuroglancer_state_to_neuroglancer_url

neuroglancer_state_to_neuroglancer_url(state, base_url=NG_URLS['ng'])

Take the current state of the Neuroglancer viewer and convert it into a url-encoded value for the browser.

Wraps

Wraps(kls)

Return a wrapper type that inherits from kls but never calls super().__init__().

Instead, it stores an instance of the parent class and overloads attribute access so that attributes of the parent instance -- rather than self -- are accessed and set.

This is necessary when wrapping neuroglancer types into our own types.

find_available_port

find_available_port(port=0, ip='')

Return an available port and the local IP.

get_server_url

get_server_url(bind_address, port)

Get server URL, which works even if we are in a colab notebook.