<NME> example.py
<BEF> from __future__ import print_function

import numpy as np

import neuroglancer

a = np.zeros((3, 100, 100, 100), dtype=np.uint8)
ix, iy, iz = np.meshgrid(* [np.linspace(0, 1, n) for n in a.shape[1:]], indexing='ij')
a[0, :, :, :] = np.abs(np.sin(4 * (ix + iy))) * 255
        name='a',
        layer=neuroglancer.LocalVolume(
            data=a,
            dimensions=neuroglancer.CoordinateSpace(
                names=['c^', 'x', 'y', 'z'],
                units=['', 'nm', 'nm', 'nm'],
                scales=[1, 10, 10, 10],
                coordinate_arrays=[
                    neuroglancer.CoordinateArray(labels=['red', 'green', 'blue']), None, None, None
                ]),
            voxel_offset=(0, 20, 30, 15),
        ),
        shader="""
void main() {
  emitRGB(vec3(toNormalized(getDataValue(0)),
               toNormalized(getDataValue(1)),
               toNormalized(getDataValue(2))));
}
""",
    )
    state.layers.append(
        name='b',
        layer=neuroglancer.LocalVolume(
            data=b,
            dimensions=dimensions,
        ),
            data=b,
            voxel_size=s.voxel_size,
        ))
print(viewer)
    ap = argparse.ArgumentParser()
    neuroglancer.cli.add_server_arguments(ap)
    args = ap.parse_args()
    neuroglancer.cli.handle_server_arguments(args)
    viewer = neuroglancer.Viewer()
    with viewer.txn() as s:
        a, b = add_example_layers(s)
    print(viewer)

<MSG> feat(python): examples/example.py: make static content source and bind address configurable

<DFF> @@ -1,9 +1,24 @@
 from __future__ import print_function
 
+import argparse
 import numpy as np
 
 import neuroglancer
 
+ap = argparse.ArgumentParser()
+ap.add_argument(
+    '-a',
+    '--bind-address',
+    help='Bind address for Python web server.  Use 127.0.0.1 (the default) to restrict access '
+    'to browers running on the local machine, use 0.0.0.0 to permit access from remote browsers.')
+ap.add_argument(
+    '--static-content-url', help='Obtain the Neuroglancer client code from the specified URL.')
+args = ap.parse_args()
+if args.bind_address:
+    neuroglancer.set_server_bind_address(args.bind_address)
+if args.static_content_url:
+    neuroglancer.set_static_content_source(url=args.static_content_url)
+
 a = np.zeros((3, 100, 100, 100), dtype=np.uint8)
 ix, iy, iz = np.meshgrid(* [np.linspace(0, 1, n) for n in a.shape[1:]], indexing='ij')
 a[0, :, :, :] = np.abs(np.sin(4 * (ix + iy))) * 255
@@ -36,4 +51,5 @@ void main() {
             data=b,
             voxel_size=s.voxel_size,
         ))
+
 print(viewer)

feat(python): examples/example.py: make static content source and bind address configurable