JaneliaSciComp / SharkViewer

SharkViewer is a web-based viewer for SWC neuron files. It is written entirely in JavaScript using Three.js.
Other
24 stars 11 forks source link

Cannot render different parts with different colors #34

Closed liuyx599 closed 1 year ago

liuyx599 commented 1 year ago

When I load test cases old\swc\test.swc in https://janeliascicomp.github.io/SharkViewer/, all parts of the rendered neurons are red, while the default rendered example neurons on the homepage can be marked with different parts using different colors. The content of the test SWC file is as follows:

# ORIGINAL_SOURCE NeuronStudio 0.8.80
# CREATURE
# REGION
# FIELD/LAYER
# TYPE
# CONTRIBUTOR
# REFERENCE
# RAW
# EXTRAS
# SOMA_AREA
# SHINKAGE_CORRECTION 1.0 1.0 1.0
# VERSION_NUMBER 1.0
# VERSION_DATE 2007-07-24
# SCALE 1.0 1.0 1.0
1 1 14.566132 34.873772 7.857000 0.717830 -1
2 0 16.022520 33.760513 7.047000 0.463378 1
3 5 17.542000 32.604973 6.885001 0.638007 2
4 0 19.163984 32.022469 5.913000 0.602284 3
5 0 20.448090 30.822802 4.860000 0.436025 4
6 6 21.897903 28.881084 3.402000 0.471886 5
7 0 18.461960 30.289471 8.586000 0.447463 3
8 6 19.420759 28.730757 9.558000 0.496217 7
neomorphic commented 1 year ago

This is by design. The code in the index.js file sets all loaded neurons to red. https://github.com/JaneliaSciComp/SharkViewer/blob/f060680ce586c55de19557ee7e61e0204ef8bbea/lib/index.js#L13 If you don't want that to happen, you need to modify the line as follows

s.loadNeuron('foo', null, swc, true, false, true);