-
Notifications
You must be signed in to change notification settings - Fork 6
/
2dSpectrumTool.html
260 lines (223 loc) · 10.9 KB
/
2dSpectrumTool.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
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
<html>
<head>
<!--libraries-->
<script src='scripts/HTMLImports.min.js' type="text/javascript"></script>
<script type='text/javascript' src='scripts/heatmap.js'></script>
<script src="scripts/jquery1-11-3.min.js" type="text/javascript"></script>
<script src="scripts/bootstrap3-3-5.min.js" type="text/javascript"></script>
<script src="scripts/mustache.js" type="text/javascript"></script>
<script src='scripts/easeljs-1.0.0.min.js' type="text/javascript"></script>
<script src='scripts/regression.min.js' type="text/javascript"></script>
<script src='scripts/gammaSpectrum.js' type="text/javascript"></script>
<script src='scripts/fitit.js' type="text/javascript"></script>
<!--stylesheets-->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css">
<link rel="stylesheet" type="text/css" href="css/custom.css"/>
<!--scripts-->
<script src="scripts/helpers.js" type="text/javascript"></script>
<script src="scripts/2dSpectrumTool.js" type="text/javascript"></script>
<!--templates-->
<link rel="shortcut icon" type="image/x-icon" href="favicon.ico">
<link id='plotListHeader' rel="import" href="templates/plotList/plotListDynamic.html">
<link id='plotList' rel="import" href="templates/plotList/plotListDynamic.html">
<link id='plotGrid' rel="import" href="templates/plotGrid/plotGrid.html">
<link id='plotControl' rel="import" href="templates/plotControl/plotControl.html">
<link id='auxPlotControl' rel="import" href="templates/auxPlotControl/auxPlotControl.html">
<link id='auxPlotControlTable' rel="import" href="templates/auxPlotControl/auxPlotControlTable.html">
<link id='fitRow' rel="import" href="templates/auxPlotControl/fitRow.html">
<link id='gateControl' rel="import" href="templates/gateControl/gateControl.html">
<link id='cutVertex' rel="import" href="templates/2dSpectrumViewer/cutVertex.html">
<link id='footer' rel="import" href="templates/footer/footer.html">
</head>
<body>
<div id='histo-list-container' class='container-fluid'>
<div id='histo-list-server-div' class='col-md-3'></div>
<div id='histo-list-directory-div' class='col-md-6'>Histogram Directory: </div>
<div id='histo-list-menu-div' class='col-md-3'></div>
</div>
<div id='messageDiv' class='col-md-12'></div>
<div id='analyzerPlots'>
<nav class="navbar navbar-default">
<div class="container-fluid">
<!-- Brand and toggle get grouped for better mobile display -->
<div class="navbar-header" id='navbar-header-div'></div>
<!-- Collect the nav links, forms, and other content for toggling -->
<div class="collapse navbar-collapse" id="navbar-content-div"></div>
</div><!-- /.container-fluid -->
</nav>
</div>
<!--Plotting-->
<div id='topControls' class='col-md-12'>
<div id='functionalityWrap' class='col-md-3'>
<h4>Viewing Mode</h4>
<button id='modeBtn1d' class='btn btn-default btn-sm' onclick='toggle1DMode()'>1D Histogram</button>
<button id='modeBtn2d' class='btn btn-success btn-sm' onclick='toggleHeatmapMode()'>2D Heatmap</button>
<button id='modeBtnGate' class='btn btn-default btn-sm hidden' onclick='toggleGatingMode()'>Gating</button>
</div>
<div id='functionalityWrap2' class='col-md-3'>
<h4 id='projectionsTitleDiv' class="hidden">Projections</h4>
<button id="showXproj" class="btn btn-default btn-sm hidden" disabled='true' type="button">Total X projection</button>
<button id="showYproj" class="btn btn-default btn-sm hidden" disabled='true' type="button">Total Y projection</button>
</div>
<div id='updateWrapPeriodic' class='col-md-6'>
<h4>Data Fetching</h4>
<div class="input-group input-group-sm">
<span class="input-group-addon">Update Every:</span>
<select id="upOptions" class='form-control' style='max-width:7em' autocomplete='off'>
<option value="3000">3 s</option>
<option value="5000">5 s</option>
<option value="10000">10 s</option>
<option value="-1" selected="selected">never</option>
</select>
<button id="upNow" class="btn btn-default btn-sm" type="button">Update Now</button>
</div>
</div>
</div>
<div id='plotRegion' class='sectionWrapper item'>
<div id='plotWrap2D' class='col-md-6 col-md-offset-1 plotRegion'>
<div id='heatmapTarget' class='well no-pad'>
<div id='intro-plot-picker' class="alert alert-warning" role="alert">
<span class="glyphicon glyphicon-check" aria-hidden="true"></span>
Choose a plot from the menu at the top to get started.
</div>
</div>
</div>
<div id='plotWrap1D' class='col-md-9 plotRegion' style='display: none'>
<div id='plottingGrid'></div>
</div>
<div id='plotWrap1DGating' class='col-md-9 plotRegion' style='display: none'>
<div id='gatingGridActiveMatrixDiv' class='col-md-12'></div>
<div id='gatingGridUpper'></div>
<div id='gatingGridLower'></div>
</div>
<div class='col-md-3 no-pad'>
<div id='plotControl'>
<div id='colorPalette' class='ui-group-vertical noselect'>
<h4 class='noselect'>Color Palette</h4>
<div id='colorPaletteSelectDiv'></div>
</div>
<div id='cutBounds' class='ui-group-vertical noselect'>
<h4 class='noselect'>Cut Bounds</h4>
<div id='intro-shift-click' class="alert alert-warning hidden" role="alert">
<span class="glyphicon glyphicon-check" aria-hidden="true"></span>
Shift-click several points on the plot to mark a region of interest.
</div>
<ul id='cutPolyVertices' class='list-unstyled'></ul>
<button class='btn btn-success btn-sm' onclick='saveCutToODB()'>Save 2D Gate Region to ODB</button>
</div>
<div id='plotCtrl1D' style='display: none'></div>
<div id='gateCtrl1D' style='display: none'></div>
<div id='info-slow-data' class="alert alert-info hidden" role="alert">
<span class="glyphicon glyphicon-picture" aria-hidden="true"></span>
Painting your histogram...
</div>
<div id='info-downloading' class="alert alert-info hidden" role="alert">
<span class="glyphicon glyphicon-picture" aria-hidden="true"></span>
Downloading your histogram...
</div>
</div>
</div>
</div>
<!-- Extra control features and fitting results table -->
<div id='auxCtrlWrap' class='sectionWrapper' style='display: none'>
<hr style='width:60%; border-top: 1px solid #999'></hr>
<div class='col-md-12'>
<div id='auxCtrl'></div>
</div>
</div>
<div id='foot'></div>
<script>
window.addEventListener('HTMLImportsLoaded', function(e) {
// 2D viewer and shared object setup
var _plotList, dim;
//generic asset setup
dataStore.templates = prepareTemplates(['plotListHeader', 'plotList', 'cutVertex', 'footer', 'plotGrid', 'plotControl', 'auxPlotControl', 'auxPlotControlTable', 'gateControl', 'fitRow']);
dataStore._plotListHeader = new plotListHeader('navbar-header-div');
_plotControl2d = new plotControl2d('plotControl');
dataStore._plotListHeader.setup();
document.getElementById('navbar-content-div').innerHTML = 'Spectrum menu is loading...';
_plotControl2d.setup();
setupFooter('foot');
//start with Coincidence matrix menu displayed
// document.getElementById(dataStore.backendHost).onclick();
//empty plot
dim = Math.min(document.getElementById('heatmapTarget').offsetWidth, window.innerHeight)
dataStore.hm = new heatmap(dim,dim);
document.getElementById('heatmapTarget').appendChild(dataStore.hm.canvas);
dataStore.hm.preRender = generateOverlay;
dataStore.hm.slowDataWarning = function(state){
if(state === 'on')
document.getElementById('info-slow-data').classList.remove('hidden');
else
document.getElementById('info-slow-data').classList.add('hidden');
};
dataStore.hm.DataDownloading = function(state){
if(state === 'on')
document.getElementById('info-downloading').classList.remove('hidden');
else
document.getElementById('info-downloading').classList.add('hidden');
};
// 1D viewer setup
dataStore._plotGrid = new plotGrid('plottingGrid');
dataStore._plotControl = new plotControl('plotCtrl1D', 'vertical');
dataStore._gateControl = new gateControl('gateCtrl1D');
dataStore._auxCtrl = new auxPlotControl('auxCtrl');
dataStore._plotGrid.setup();
dataStore._plotControl.setup();
dataStore._gateControl.setup();
dataStore._auxCtrl.setup();
// Gating viewer setup
// Create the upper viewer that will be used for total projections to set gates
var wrapper = 'gatingGridUpper';
var label = 'UpperViewer';
dataStore._gatingGrid = new plotGrid(wrapper);
dataStore._gatingGrid.setup();
addSingleSpectrumViewer(wrapper,label,false);
// Create the lower viewer that will be used for showing the gates created
var wrapper = 'gatingGridLower';
var label = 'LowerViewer';
dataStore._gatingGrid = new plotGrid(wrapper);
dataStore._gatingGrid.setup();
addSingleSpectrumViewer(wrapper,label,false);
$(function () {
$('[data-toggle="tooltip"]').tooltip()
})
// Display the analyzer server name
document.getElementById('histo-list-server-div').innerHTML = dataStore.spectrumServer;
// Create the text input for the Histogram file directory
newInput = document.createElement('input');
newInput.id = 'HistoDirectoryInput';
newInput.type = 'text';
newInput.style.width = '300px';
newInput.value = dataStore.histoFileDirectoryPath;
newInput.onchange = function(){
dataStore.histoFileDirectoryPath = this.value;
getHistoFileListFromServer();
}.bind(newInput);
document.getElementById('histo-list-directory-div').appendChild(newInput);
// Create a select input for the color palette
var newSelect = document.createElement("select");
newSelect.id = 'colorPaletteSelect';
newSelect.name = 'colorPaletteSelect';
newSelect.onchange = function(){
dataStore.hm.colorscale = this.value;
if(dataStore.hm._raw != null){
// trigger a redraw with the new colorScale
dataStore.hm.zoom(dataStore.hm.xmin,dataStore.hm.ymin,dataStore.hm.xmax,dataStore.hm.ymax);
}
}.bind(newSelect);
document.getElementById('colorPaletteSelectDiv').appendChild(newSelect);
// Add the list of colorScales available as the options
thisSelect = document.getElementById('colorPaletteSelect');
var keys = Object.keys(dataStore.hm.colorscales)
for(i=0; i<keys.length; i++){
thisSelect.add( new Option(keys[i], keys[i]) );
}
// Set the default
thisSelect.value = 'turbo';
// Try and inject the spectrum menu if the data is available
constructNewSpectrumMenu();
});
</script>
</body>
</html>