Skip to content

Commit 3e50fb0

Browse files
committed
Check response.png_luts_new for is_dynamic_lut
1 parent ea6c2ee commit 3e50fb0

File tree

2 files changed

+17
-30
lines changed

2 files changed

+17
-30
lines changed

plugin/omero_iviewer/urls.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,4 @@
4949
# Find the index of an ROI within all ROIs for the Image (for pagination)
5050
re_path(r'^(?P<obj_type>(roi|shape))/(?P<obj_id>[0-9]+)/page_data/$',
5151
views.roi_page_data, name='omero_iviewer_roi_page_data'),
52-
re_path('^is_dynamic_lut/$', views.is_dynamic_lut,
53-
name='iviewer_dynamic_lut'),
5452
]

src/app/context.js

Lines changed: 17 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -302,11 +302,11 @@ export default class Context {
302302
*/
303303
setUpLuts() {
304304
$.ajax(
305-
{url : this.server + this.getPrefixedURI(IVIEWER) + "/is_dynamic_lut/",
305+
{url : this.server + this.getPrefixedURI(WEBGATEWAY) + "/luts/",
306306
success : (response) => {
307307
// Check first whether omero-web can provides LUT dynamically
308308
// and set URL accordingly
309-
let is_dynamic_lut = response.is_dynamic_lut;
309+
let is_dynamic_lut = Boolean(response.png_luts_new);
310310
if (is_dynamic_lut) {
311311
this.luts_png.url =
312312
this.server + this.getPrefixedURI(WEBGATEWAY, false) + "/luts_png/";
@@ -324,33 +324,22 @@ export default class Context {
324324
}
325325
lutsPng.src = this.luts_png.url;
326326

327-
// now query the luts list
328-
let server = this.server;
329-
let uri_prefix = this.getPrefixedURI(WEBGATEWAY);
330-
$.ajax(
331-
{url : server + uri_prefix + "/luts/",
332-
success : (response) => {
333-
if (typeof response !== 'object' || response === null ||
334-
!Misc.isArray(response.luts)) return;
335-
336-
if (is_dynamic_lut) {
337-
// If it's dynamic, uses the new list instead
338-
response.png_luts = response.png_luts_new
339-
}
327+
if (is_dynamic_lut) {
328+
// If it's dynamic, uses the new list instead
329+
response.png_luts = response.png_luts_new
330+
}
340331

341-
response.luts.map(
342-
(l) => {
343-
let mapValue =
344-
Object.assign({
345-
nice_name :
346-
l.name.replace(/.lut/g, "").replace(/_/g, " "),
347-
index : is_dynamic_lut ? l.png_index_new : l.png_index
348-
}, l);
349-
this.luts.set(mapValue.name, mapValue);
350-
});
351-
for (let [id, conf] of this.image_configs) conf.changed();
352-
}
353-
});
332+
response.luts.forEach(
333+
(l) => {
334+
let mapValue =
335+
Object.assign({
336+
nice_name :
337+
l.name.replace(/.lut/g, "").replace(/_/g, " "),
338+
index : is_dynamic_lut ? l.png_index_new : l.png_index
339+
}, l);
340+
this.luts.set(mapValue.name, mapValue);
341+
});
342+
for (let [id, conf] of this.image_configs) conf.changed();
354343
}
355344
});
356345
}

0 commit comments

Comments
 (0)