-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathindex.html
156 lines (145 loc) · 6.89 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
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
<!DOCTYPE html>
<html>
<head lang="en">
<meta charset="UTF-8">
<title>NIDM viewer</title>
<!--
<link rel="stylesheet" type="text/css" href="http://rii.uthscsa.edu/mango/papaya/papaya.css?version=0.6.5&build=692" />
<script type="text/javascript" src="http://rii.uthscsa.edu/mango/papaya/papaya.js?version=0.6.5&build=692"></script>
-->
<link rel="stylesheet" type="text/css" href="css/papaya.css"/>
<script type="text/javascript" src="js/papaya.js"></script>
<!--
<script type="text/javascript" src="https://rawgit.com/antoniogarrote/rdfstore-js/master/dist/rdf_interface_api/browser/rdf_interface_api_min.js"></script>
-->
<link rel="stylesheet" href="css/slick.grid.css" type="text/css"/>
<link rel="stylesheet" href="css/jquery-ui-1.8.16.custom.css" type="text/css"/>
<link rel="stylesheet" href="css/examples.css" type="text/css"/>
<script type="text/javascript" src="js/rdf_store_min.js"></script>
<script src="js/jquery-1.7.min.js"></script>
<script src="js/jquery.event.drag-2.2.js"></script>
<script src="js/slick.core.js"></script>
<script src="js/slick.grid.js"></script>
<script type="text/javascript">
var params = [];
params["worldSpace"] = true;
params["expandable"] = true;
//params["luts"] = [{"name":"PuBu", "data":[[0,1,0.968627,0.984314],[0.125,0.92549,0.905882,0.94902],[0.25,0.815686,0.819608,0.901961],[0.375,0.65098,0.741176,0.858824],[0.5,0.454902,0.662745,0.811765],[0.625,0.211765,0.564706,0.752941],[0.75,0.0196078,0.439216,0.690196],[0.875,0.0156863,0.352941,0.552941],[1,0.00784314,0.219608,0.345098]]},
// {"name":"OrRd", "data":[[0,1,0.968627,0.92549],[0.125,0.996078,0.909804,0.784314],[0.25,0.992157,0.831373,0.619608],[0.375,0.992157,0.733333,0.517647],[0.5,0.988235,0.552941,0.34902],[0.625,0.937255,0.396078,0.282353],[0.75,0.843137,0.188235,0.121569],[0.875,0.701961,0,0],[1,0.498039,0,0]]}];
</script>
</head>
<body>
<div id="myform" style="width:1000px">
<form ACTION="" METHOD="GET">
<input type="button" value="Click here" name="submit" style="width:200px;height:20px;" onClick="processURL(this.form.url.value);">
<b>Nidm URL: </b>
<input type="url" name="url" style="width:600px;height:20px;" value="https://dl.dropboxusercontent.com/u/363467/ds000001/RESULTS/Group/Con1/nidm_001/test.ttl">
</form>
</div>
<div style="width:600px; height:500px;">
<div class="papaya" data-params="params"></div>
</div>
<div id="myGrid" style="width:1024px;height:500px;"></div>
<script>
function processURL (URL) {
console.log(URL)
$.ajax({
type: "GET",
url: URL,
success: function(data){
//console.log(data);
store = new rdfstore.Store();
store.load("text/turtle", data,
function(success, results) {
//console.log(results);
store.execute(
"PREFIX nidm: <http://purl.org/nidash/nidm#> \
PREFIX prov: <http://www.w3.org/ns/prov#> \
prefix peak: <http://purl.org/nidash/nidm#NIDM_0000062> \
prefix significant_cluster: <http://purl.org/nidash/nidm#NIDM_0000070> \
prefix coordinate: <http://purl.org/nidash/nidm#NIDM_0000086> \
prefix equivalent_zstatistic: <http://purl.org/nidash/nidm#NIDM_0000092> \
prefix pvalue_fwer: <http://purl.org/nidash/nidm#NIDM_0000115> \
prefix pvalue_uncorrected: <http://purl.org/nidash/nidm#NIDM_0000116> \
prefix statistic_map: <http://purl.org/nidash/nidm#NIDM_0000076> \
prefix statistic_type: <http://purl.org/nidash/nidm#NIDM_0000123> \
prefix coordinateVector: <http://purl.org/nidash/nidm#NIDM_0000086> \
SELECT DISTINCT ?cluster ?peak ?x ?equiv_z ?pval_fwer ?stat WHERE \
{ ?peak a peak: . \
?cluster a significant_cluster: . \
?peak prov:wasDerivedFrom ?cluster .\
?peak prov:atLocation ?coordinate . \
?coordinate coordinateVector: ?x . \
?peak equivalent_zstatistic: ?equiv_z .\
?peak pvalue_fwer: ?pval_fwer .\
?cluster prov:wasDerivedFrom/prov:wasGeneratedBy/prov:used ?statmap .\
?statmap a statistic_map: .\
?statmap statistic_type: ?stat .\
}\
ORDER BY ?cluster ?peak\
",
function(success, results) {
columns = []
data = []
console.log(results);
for(var i=0; i<results.length; i++) {
if (columns.length == 0){
for (var key in results[i]) {
columns.push({id: key, name: key, field: key})
}
}
var datum = {}
for (var key in results[i]) {
datum[key] = results[i][key]["value"].replace('http://iri.nidash.org/', '').replace('http://www.incf.org/ns/nidash/nidm#', '')
}
data.push(datum)
//console.log(datum);
}
//console.log(columns)
var options = {
enableCellNavigation: true,
enableColumnReorder: false
};
grid = new Slick.Grid("#myGrid", data, columns, options);
});
store.execute(
"PREFIX nidm: <http://purl.org/nidash/nidm#> \
PREFIX prov: <http://www.w3.org/ns/prov#> \
prefix nfo: <http://www.semanticdesktop.org/ontologies/2007/03/22/nfo#> \
SELECT ?filename ?location WHERE \
{ ?file prov:atLocation ?location . \
?file nfo:fileName ?filename . \
FILTER regex(?filename, \"TS*\")\
}\
",
function(success, results) {
var params = [];
var niifiles2load = []
console.log(results)
for(var i=0; i<results.length; i++) {
console.log(results[i]["location"])
//console.log(results[i]["location"]["value"])
niifiles2load.push(results[i]["location"]["value"]);
var filename = results[i]["location"]["value"].replace(/^.*[\\\/]/, '')
params[filename] = {"parametric": true, "lut":"OrRd", "negative_lut":"PuBu", "alpha":"0.75"};
}
console.log(niifiles2load)
container = papayaContainers[papayaContainers.length - 1]
viewer = container.viewer
viewer.resetViewer();
viewer.container.clearParams();
papaya.utilities.UrlUtils.getQueryParams(params);
viewer.container.params.images = []
viewer.container.loadingImageIndex = -1
for (var i = 0; i < niifiles2load.length; i++) {
viewer.container.params.images[viewer.container.params.images.length] = niifiles2load[i]
}
viewer.loadBaseImage(["MNI152_T1_1mm.nii.gz"], true, false);
});
});
}
});
};
</script>
</body>
</html>