2.5.1 • Published 6 months ago

@janelia-flyem/react-neuroglancer v2.5.1

Weekly downloads
8
License
MIT
Repository
-
Last release
6 months ago

react-neuroglancer

Overview

react-neuroglancer is a react wrapper around an old fork of neuroglancer. It is used to embbed the neuroglancer viewer into a react application and allow the parent application to interact with the contents of the neuroglancer view and vice versa.

Installation

npm install @janelia-flyem/react-neuroglancer
# or
yarn add @janelia-flyem/react-neuroglancer

Usage

import Neuroglancer from '@janelia-flyem/react-neuroglancer';

const Example = () => {
    return (
      <Neuroglancer
        perspectiveZoom={80}
        viewerState={viewerState}
        brainMapsClientId="NOT_A_VALID_ID"
        ngServer="https://clio-ng.janelia.org"
        onViewerStateChanged={onViewerStateChanged}
      />
    );
};

Components

Neuroglancer

The main component that will show the neuroglancer viewer.

Props

PropTypeDefaultDescription
perspectiveZoomnumber20The starting zoom level of the viewer
viewerStateobject{}The core object that describes the current state of the neuroglancer viewer.
brainMapsClientIdstringNOT_A_VALID_IDClient ID used to access Google brainmaps API
eventBindingsToUpdateobject[][]An array of event bindings to change in Neuroglancer. The array format is as follows: [old-event1, new-event1, old-event2, old-event3] Here, old-event1's will be unbound and its action will be re-bound to new-event1. The bindings for old-event2 and old-event3 will be removed. Neuroglancer has its own syntax for event descriptors, and here are some examples:'keya', 'shift+keyb' 'control+keyc', 'digit4', 'space', 'arrowleft', 'comma', 'period', 'minus', 'equal', 'bracketleft'.
onViewerStateChangedfunction(viewerState) => { return }A callback function that is called whenever a change is made to the state of the neuroglancer component. This can be used to update values in the containing application.
ngServerurl'https://neuroglancer-demo.appspot.com/'Base url for a neuroglancer server that will be used to create external links

Example viewerState

The viewerState should be defined before creating the neuroglancer viewer. Here is a simple example of a state that shows two lawyers in the viewer.

{
    layers: {
        grayscale: {
            type: "image",
            source:
              "dvid://https://flyem.dvid.io/ab6e610d4fe140aba0e030645a1d7229/grayscalejpeg"
        },
        segmentation: {
            type: "segmentation",
            source:
              "dvid://https://flyem.dvid.io/d925633ed0974da78e2bb5cf38d01f4d/segmentation"
        }
    },
    perspectiveZoom: 20,
    navigation: {
        zoomFactor: 8
    }
}

To see more complicated examples, click on the '{}' button located at the top right in neuroglancer and view the JSON object that is displayed.

License

3-Clause BSD License

2.5.0

9 months ago

2.5.1

6 months ago

2.4.13

1 year ago

2.4.12

2 years ago

2.4.11

2 years ago

2.4.10

3 years ago

2.4.9

3 years ago

2.4.8

3 years ago

2.4.7

3 years ago

2.4.6

3 years ago

2.4.3

4 years ago

2.4.2

4 years ago

2.4.5

4 years ago

2.4.4

4 years ago

2.4.1

4 years ago

2.4.0

4 years ago

2.3.12

4 years ago

2.3.11

4 years ago

2.3.10

4 years ago

2.3.9

4 years ago

2.3.8

4 years ago

2.3.7

4 years ago

2.3.6

4 years ago

2.3.5

4 years ago

2.3.2

4 years ago

2.3.4

4 years ago

2.3.3

4 years ago

2.2.7

4 years ago

2.2.6

4 years ago

2.3.0

4 years ago

2.3.1

4 years ago

2.2.5

5 years ago

2.2.4

5 years ago

2.2.3

5 years ago

2.2.2

5 years ago

2.2.1

5 years ago

2.1.2

5 years ago

2.2.0

5 years ago

2.1.1

5 years ago

2.1.0

5 years ago

2.0.4

5 years ago

2.0.3

5 years ago

2.0.2

5 years ago

2.0.1

5 years ago

2.0.0

5 years ago

1.13.0

5 years ago

1.12.0

5 years ago

1.11.1

5 years ago

1.11.0

5 years ago

1.10.1

5 years ago

1.10.0

5 years ago

1.9.0

5 years ago

1.8.3

5 years ago

1.8.2

5 years ago

1.8.1

5 years ago

1.8.0

5 years ago

1.7.0

5 years ago

1.6.0

5 years ago

1.5.3

6 years ago

1.5.2

6 years ago

1.5.1

6 years ago

1.5.0

6 years ago

1.4.1

6 years ago

1.3.0

6 years ago

1.2.2

6 years ago

1.2.1

6 years ago

1.2.0

6 years ago

1.1.4

6 years ago

1.1.3

6 years ago

1.1.2

6 years ago

1.1.1

6 years ago

1.1.0

7 years ago

1.0.1

7 years ago

1.0.0

7 years ago