0.1.15
The EventManager deals with events, create them, call them. This class is mostly for being inherited from.
The MorphologyPolycylinder is a tubular representation of a morphology, using cylinders. this alternative to MorphologyPolyline is heavier on CPU and GPU so is more made when displaying a small number of morphologies. MorphologyPolycylinder extends from THREE.Object so that it's easy to integrate. It's constructor
Extends MorphologyShapeBase
(Array<THREE.BufferGeometry>)
(any)
THREE.BufferGeometry
:
(Array<THREE.BufferAttribute>)
THREE.BufferAttribute
:
The MorphologyPolyline is the simplest 3D representation of a morphology, using simple polylines. Compared to its cylinder-based alternative (MorphologyPolycylinder), this one is more suitable for displaying several morphologies (up to maybe a hundred, depending on length and machine performance) MorphologyPolyline extends from THREE.Object so that it's easy to integrate. It's constructor
Extends MorphologyShapeBase
(Morphology)
raw object that describes a morphology (usually straight from a JSON file)
(object)
the option object
This is the base class for MorphologyPolyline
and MorphologyPolycylinder
.
It handles the common features, mainly related to soma creation
Extends THREE.Object3D
(Object)
raw object that describes a morphology (usually straight from a JSON file)
(object)
the option object
The MorphoViewer class is the entry point object of the MorphoViewer project and is the only object the user should be dealing with.
(any
= null
)
Add a morphology to the collection so that it displays.
((Object | morphologycorejs.Morphology))
describes the morphology of a neuron.
This data comes straight from the JSON file or it can also be a Morphology object from
morphologycorejs
(object)
the optional values
Name | Description |
---|---|
options.name String
|
The name to give to this morphology. Will be used as an identifier for several operations |
options.asPolyline Boolean
|
if true: shows a polyline view. false: shows a tubular view (default: true) |
options.focusOn Boolean
|
if true, the camera will focus on this added morphology. If false, the camera will not change |
options.color Number
|
the color of the polyline. If provided, the whole neurone will be of the given color, if not provided, the axon will be green, the basal dendrite will be red and the apical dendrite will be green |
options.somaMode String
|
"default" to display only the soma data or "fromOrphanSections" to build a soma using the orphan sections |
options.onDone Function
|
callback when the morphology is displayed. Called with the name (given or generated) of the morphology |
options.distance Number
|
the distance between the camera and the soma. Only relevant if
onFocus
is
true
|
Adds a mesh from its URL. The mesh has to encoded into the STL format
(String)
the url of the STL file
(Object)
the options object
Name | Description |
---|---|
options.name String
|
optional name of this mesh (useful for further operations such as centering the view) |
options.focusOn Boolean
|
if true, the camera will focus on this added mesh. If false, the camera will not change |
options.opacity Number
|
the opacity of the mesh |
options.color Number
|
the color of the mesh |
options.wireframe Number
|
only the wireframe will display if true. If false, the regular mesh will show |
options.wireframe Number
|
only the wireframe will display if true. If false, the regular mesh will show |
options.onDone Function
|
callback to be called when the mesh is added. Called with the name of the mesh in argument |
Kill all to save up memory, stop the annimation, removes events, delete the canvas
Make the camera look at the soma of a morphology (or the center of it's bounding box if the neuron does not have soma data)
Define a callback associated with clicking on a section. The callback function
is called with the morphologycorejs.Section
instance as arguments (or undefined
)
(any)
Adds a OBJ mesh to the scene
(String)
the string from the OBJ file
(Object)
the options object
Name | Description |
---|---|
options.name String
|
optional name of this mesh (useful for further operations such as centering the view) |
options.focusOn Boolean
|
if true, the camera will focus on this added mesh. If false, the camera will not change |
options.opacity Number
|
the opacity of the mesh |
options.color Number
|
the color of the mesh |
options.wireframe Number
|
only the wireframe will display if true. If false, the regular mesh will show |
options.wireframe Number
|
only the wireframe will display if true. If false, the regular mesh will show |
options.onDone Function
|
callback to be called when the mesh is added. Called with the name of the mesh in argument |
ThreeContext creates a WebGL context using THREEjs. It also handle mouse control.
A MorphologyPolyline instance is added to it.
An event can be associated to a ThreeContext instance: onRaycast
with the method
.on("onRaycast", function(s){...})
where s
is the section object being raycasted.
Extends EventManager
(DONObject
= null
)
the div object as a DOM element.
Will be used to host the WebGL context
created by THREE
Adds a mesh from its URL. The mesh has to encoded into the STL format
(String)
the url of the STL file
(Object)
the options object
Name | Description |
---|---|
options.name String
|
optional name of this mesh (useful for further operations such as centering the view) |
options.focusOn Boolean
|
if true, the camera will focus on this added mesh. If false, the camera will not change |
options.opacity Number
|
the opacity of the mesh |
options.color Number
|
the color of the mesh |
options.wireframe Number
|
only the wireframe will display if true. If false, the regular mesh will show |
options.wireframe Number
|
only the wireframe will display if true. If false, the regular mesh will show |
options.onDone Function
|
callback to be called when the mesh is added. Called with the name of the mesh in argument |
Add a OBJ mesh to the scene
(String)
string that comes from the obj file
(Object)
the options object
Name | Description |
---|---|
options.name String
|
optional name of this mesh (useful for further operations such as centering the view) |
options.focusOn Boolean
|
if true, the camera will focus on this added mesh. If false, the camera will not change |
options.opacity Number
|
the opacity of the mesh |
options.color Number
|
the color of the mesh |
options.wireframe Number
|
only the wireframe will display if true. If false, the regular mesh will show |
options.wireframe Number
|
only the wireframe will display if true. If false, the regular mesh will show |
options.onDone Function
|
callback to be called when the mesh is added. Called with the name of the mesh in argument |
Add a MorphoPolyline object (which are ThreeJS Object3D) into the scene of this ThreeContext.
(MorphoPolyline)
a MorphoPolyline instance
(Object)
the option object
Name | Description |
---|---|
options.name String
|
the identifier to give to the MorphoPolyline instance within a local collection |
options.focusOn Boolean
|
if true, the camera will focus on this added morphology. If false, the camera will not change |
options.onDone Function
|
callback to be called when the morphology polyline is added. Called with the name of the morpho in argument |
Get the png image data as base64, in order to later, export as a file
Kills the scene, interaction, animation and reset all objects to null
Some handy static functions to do stuff that are not strictly related to the business of the project
Handy function to deal with option object we pass in argument of function.
Allows the return of a default value if the optionName
is not available in
the optionObj