Giter Club home page Giter Club logo

neu3d's Introduction

Neu3D SWC visualization for fruitfly

Installation

npm install
npm run build

Test

Serve a HTML site from root of folder.

If using python3, in project root

python -m http.server

Usage

The module can be imported according to ES6 syntax as follows:

import Neu3D from 'neu3d';

Instantiate the visualization object by passing a HTMLDivElement with class vis-3d to it along with other optional configurations:

var ffbomesh = new Neu3D(
    parentDiv,  // parent div object with class `vis-3d`
    undefined,  // optionally add initalization JSON data
    { "globalCenter": { 'x': 0, 'y': -250, 'z': 0 } },  // optional metadata
    false);  // display stats panel on top left

window.ffbomesh = ffbomesh; // exposing to global namespace if desired

$.getJSON("./data/data.json", (json) => {
    ffbomesh.addJson({
        ffbo_json: json,
        showAfterLoadAll: true
    });
});

Consumption Example

  1. Global The class Neu3D is available if script is loaded as script tag. See index.html.
  2. ES6 See Usage section.
  3. TypeScript import Neu3D = require('neu3d');

Expected Formats

There are two ways to visualize: upload a file, or call ffbomesh.addJson with a json.

neu3D takes files of the following format:

Mesh:

A json file with the following dict items example

  • vertices: a list of flattened coordinates with x, y, z of each vertex appearing consecutively.
  • faces: a list of integers, every 3 of them indicates the ids of three vertices that form the face. The first vertex is 0.

Neuron:

An SWC file with columns in the following order example1 example2:

  • sample: sample ID of the node
  • identifier: type of the node, 0: unspecified, 1: soma
  • x: x coordinate of the node position
  • y: y coordinate of the node position
  • z: z coordinate of the node position
  • r or radius: width of the node
  • parent: sample ID of the parent node

In addition to SWC files, a neuron mesh in GLTF format, with '.gltf' extension, can also be visualized example.

Synapse:

A .syn file defined as a csv file with the columns in the following order example:

  • pre_x: x coordinate of the presynaptic site,
  • pre_y: y coordinate of the presynaptic site,
  • pre_z: z coordinate of the presynaptic site,
  • pre_r: radius of presynaptic site,
  • post_x: x coordinate of the postsynaptic site,
  • post_y: y coordinate of the postsynaptic site,
  • post_z: z coordinate of the postsynaptic site,
  • post_r: radius of the postsynaptic site.

The last four columns are optional.

To call ffbomesh.addJson, the json input should be of the following format:

Mesh: a dict with the following fields:

  • vertices: a list of flattened coordinates with x, y, z of each vertex appearing consecutively.
  • faces: a list of integers, every 3 of them indicates the ids of three vertices that form the face. The first vertex is 0.

Neuron: a dict with the following fields:

  • sample: sample ID of the node
  • identifier: type of the node, 0: unspecified, 1: soma
  • x: x coordinate of the node position
  • y: y coordinate of the node position
  • z: z coordinate of the node position
  • r or radius: width of the node
  • parent: sample ID of the parent node

Synapse: a dict with the following fields:

  • sample: list of unique integers
  • identifier: a list of same length as sample (not used).
  • x: a list of x coordinates, with the first half for presynaptic sites and the second half for postsynaptic sites.
  • y: a list of y coordinates, with the first half for presynaptic sites and the second half for postsynaptic sites.
  • z: a list of z coordinates, with the first half for presynaptic sites and the second half for postsynaptic sites.
  • r or radius: a list of radius, with the first half for presynaptic sites and the second half for postsynaptic sites.
  • parent: a list of integers: -1 for the first half (presynaptic sites), and for the second half, the sample ID of their presynaptic site.

Authors

This library is developed and maintained by:

Developer Emeriti:

Acknowledgements

A part of this library is inspired by the Sharkviewer project, developed at the Janelia Research Campus.

neu3d's People

Contributors

tk-21st avatar yiyin avatar mkturkcan avatar chungheng avatar dependabot[bot] avatar vivvyk avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.