-
Notifications
You must be signed in to change notification settings - Fork 9
/
select_psf_popup.php
202 lines (156 loc) · 6.54 KB
/
select_psf_popup.php
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
<?php
// This file is part of the Huygens Remote Manager
// Copyright and license notice: see license.txt
use hrm\Fileserver;
require_once dirname(__FILE__) . '/inc/bootstrap.php';
session_start();
if (!isset($_SESSION['user']) || !$_SESSION['user']->isLoggedIn()) {
header("Location: " . "login.php");
exit();
}
// fileserver related code
if (!isset($_SESSION['fileserver'])) {
$name = $_SESSION['user']->name();
$_SESSION['fileserver'] = new Fileserver($name);
}
$mTypeSetting = $_SESSION['setting']->parameter(
"MicroscopeType")->translatedValue();
$twoPhoton = $_SESSION['setting']->isTwoPhoton();
if ($twoPhoton) {
$mTypeSetting = "multiphoton";
}
$NAsetting = $_SESSION['setting']->parameter(
"NumericalAperture")->value();
$emSettingArr = $_SESSION['setting']->parameter(
"EmissionWavelength")->value();
$chan = $_GET["channel"];
$emSetting = $emSettingArr[$chan];
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Huygens Remote Manager</title>
<!-- Include jQuery -->
<script type="text/javascript" src="scripts/jquery-1.8.3.min.js"></script>
<script type="text/javascript">
<!--
function lock(l) {
var psf = l.options[l.options.selectedIndex].value;
window.opener.document.forms["select"].elements["<?php echo "psf" . $_GET["channel"] ?>"].value = psf;
window.opener.document.forms["select"].elements["<?php echo "psf" . $_GET["channel"] ?>"].style.color = "black";
}
//-->
</script>
<!-- Theming support -->
<script type="text/javascript" src="scripts/theming.js"></script>
<!-- Main stylesheets -->
<link rel="stylesheet" type="text/css" href="css/fonts.css?v=3.7">
<link rel="stylesheet" type="text/css" href="css/default.css?v=3.7">
<!-- Themes -->
<link rel="stylesheet" type="text/css" href="css/themes/dark.css?v=3.7" title="dark">
<link rel="alternate stylesheet" type="text/css" href="css/themes/light.css?v=3.7" title="light">
</head>
<body>
<div>
<form method="get" action="">
<fieldset>
<legend>Available PSF files</legend>
<?php
$files = $_SESSION['fileserver']->getPSFiles();
$data = $_SESSION['fileserver']->getMetaDataFromFiles($files);
?>
<div id="userfiles">
<select name="userfiles[]"
title="Available PSF files"
class="selection"
size="10"
onchange="lock(this)">
<?php
$showWarning = false;
foreach ($files as $file) {
$mType = $data[$file]['mType'][0];
$nChan = $data[$file]['dimensions'][4];
if ($nChan == 0) {
$nChan = 1;
}
$NA = $data[$file]['NA'][0];
$pCnt = $data[$file]['photonCnt'][0];
if ($pCnt > 1) {
$mType = "multiphoton";
}
$ex = $data[$file]['lambdaEx'][0];
$em = $data[$file]['lambdaEm'][0];
$style = "";
$mismatch = false;
if ($mType != $mTypeSetting) {
$mismatch = true;
}
if (!isset($NA) || $NA == '') {
$NA = "unknown";
$mismatch = true;
} elseif (abs($NA - $NAsetting) / $NA > .02) {
$mismatch = true;
}
if (!isset($emSetting) || $emSetting == '') {
$mismatch = true;
} elseif (abs($em - $emSetting) / $emSetting > .05) {
$mismatch = true;
}
if ($mismatch) {
$showWarning = true;
$style = "class=\"highlightedPSF\" ";
}
print " <option value=\"$file\" $style>$file " .
"($mType, NA = $NA, em = $em nm, $nChan chan) </option>\n";
}
?>
</select>
</div>
</fieldset>
<div>
<input name="channel"
type="hidden"
value="<?php echo $_GET["channel"] ?>"/>
<input name="update"
type="submit"
value=""
class="icon update"/>
</div>
<div>
<input type="button" value="close" onclick="window.close()"/>
</div>
<div>
<?php
if ($showWarning) {
if (!isset($mTypeSetting) || $mTypeSetting == '') {
$mTypeDisplay = "type: unspecified";
} else {
$mTypeDisplay = "type: $mTypeSetting";
}
if (!isset($NAsetting) || $NAsetting == '') {
$NADisplay = "NA = unspecified";
} else {
$NADisplay = "NA = $NAsetting";
}
if (!isset($emSetting) || $emSetting == '') {
$emSettingDisplay = "Emission wavelength: unspecified";
} else {
$emSettingDisplay = "Emission wavelength: $emSetting nm";
}
echo("<p class=\"message_small\"> <br />" .
"Files with parameters very different than current ones (<b>" .
"$mTypeDisplay, $NADisplay, $emSettingDisplay" .
"</b>) are <i class=\"highlightedPSF\">highligthed</i>
since they could produce wrong or unexpected results.</p>");
}
// The PSF popup sets the fileserver to HDF5 and ICS in order to be able to read
// metadata. Reset it to ALL files to avoid problems with the image selector.
$_SESSION['fileserver']->resetFiles();
$files = $_SESSION['fileserver']->files();
?>
</div>
</form>
</div>
</body>
</html>