Skip to content

viewer

ngtools.local.viewer

Local neuroglancer instance with a shell-like interface.

OSMixin

Operating system actions.

cd

cd(path)

Change directory.

ls

ls(path, **kwargs)

List files.

pwd

pwd()

Path to working directory.

stdin

stdin(stdin=None)

Input stream.

stdout

stdout(stdout=None)

Output stream.

stderr

stderr(stderr=None)

Error stream.

LocalNeuroglancer

LocalNeuroglancer(port=0, ip='localhost', token=1, fileserver=True, **console_kwargs)

Bases: OSMixin

A local instance of neuroglancer that can launch its own local fileserver.

It also comes with a shell-like interface that allows loading, unloading, applying transforms, etc.

Parameters:

Name Type Description Default
port int

Port to use.

0
ip str

IP to use.

'localhost'
token str

Unique id for the instance.

1
fileserver bool | int | LocalFileServer

Whether to run a local fileserver. If an int, should be the port to use.

True
debug bool

Print full trace when an error is encountered.

required

txn

txn()

Context manager that returns the underlying neuroglancer state. Transactions are written into the viewer at exit.

scene

scene()

Context manager that returns the underlying state as a Scene. It writes all changes to the scene back into the state at exit.

get_server_url

get_server_url(regular=False)

URL of the neuroglancer server.

get_viewer_url

get_viewer_url(regular=False)

URL of the viewer.

get_fileserver_url

get_fileserver_url(regular=True)

URL of the neuroglancer server.

await_input

await_input()

Launch shell-like interface.

help

help(action=None)

Display help.

Parameters:

Name Type Description Default
action str

Action for which to display help

None

exit

exit()

Exit gracefully.

cd

cd(path)

Change directory.

ls

ls(path, **kwargs)

List files.

pwd

pwd()

Path to working directory.

stdin

stdin(stdin=None)

Input stream.

stdout

stdout(stdout=None)

Output stream.

stderr

stderr(stderr=None)

Error stream.

action

action(needstate=False)

Decorate a neuroglancer action.

These actions can thereby be triggered by argparse.

state_action

state_action(name)

Generate a state action that wraps a scene action.

ensure_list

ensure_list(x)

Ensure that an object is a list. Make one if needed.