forked from JaneliaSciComp/SharkViewer
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
110 lines (103 loc) · 3.37 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
<!doctype html>
<html>
<head>
<title>Shark Viewer</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, user-scalable=no, minimum-scale=1.0, maximum-scale=1.0">
<script src="js/threejs/three.js"></script>
<script src="js/threejs/TrackballControls.js"></script>
<script src="./js/shark_viewer.js"></script>
<!-- optional only if show_stats = true -->
<script src="js/threejs/Stats.js"></script>
<!-- optional only if effect='rift' -->
<script src="js/threejs/OculusRiftEffect.js"></script>
<!-- optional only if effect='parallax' -->
<script src="js/threejs/ParallaxBarrierEffect.js"></script>
<script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
ga('create', 'UA-50908307-1', 'janeliascicomp.github.io');
ga('send', 'pageview');
</script>
<script id="swc" type='text/plain'>
# 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
</script>
<script id='metadata_swc' type='text/plain'>
[{"label":"undefined","type":0},{"label":"soma","type":1},{"label":"axon","type":2},{"label":"dendrite","type":3},{"label":"apical dendrite","type":4},{"label":"fork point","type":5},{"label":"end point","type":6},{"label":"custom","type":7}]
</script>
</head>
<body>
<label for='swc_input'>Upload a swc file to view it in the SharkViewer:</label><input type='file' name='swc_input' id='swc_input' />
<!-- three.js container -->
<div id="container" style='position:relative'></div>
<!-- info on screen display -->
<script type='text/javascript'>
var mdata;
function readSwcFile(e) {
var f = e.target.files[0];
console.log(f);
if (f) {
var r = new FileReader();
r.onload = function(e2) {
var swc_txt = e2.target.result;
var swc = swc_parser(swc_txt);
if ( Object.keys(swc).length > 0 ) {
document.getElementById('container').innerHTML = "";
var s = new SharkViewer({
swc: swc,
dom_element: 'container',
center_node: -1,
show_stats: true,
metadata: mdata
});
s.init();
s.animate();
}
else {
alert("Please upload a valid swc file.");
}
}
r.readAsText(f);
} else {
alert("Failed to load file");
}
}
window.onload = function() {
document.getElementById('swc_input').addEventListener('change', readSwcFile, false);
var swc = swc_parser(document.getElementById("swc").text);
mdata = JSON.parse(document.getElementById("metadata_swc").text);
var s = new SharkViewer({
swc: swc,
dom_element: 'container',
center_node: -1,
show_stats: true,
metadata: mdata});
s.init();
s.animate();
}
</script>
</body>
</html>