@@ -31,7 +31,7 @@ import {
31
31
REGIONS_STORED_SHAPES
32
32
} from '../events/events' ;
33
33
import {
34
- APP_NAME , IMAGE_CONFIG_RELOAD , IVIEWER , INITIAL_TYPES , LUTS_NAMES ,
34
+ APP_NAME , IMAGE_CONFIG_RELOAD , IVIEWER , INITIAL_TYPES ,
35
35
LUTS_PNG_URL , PLUGIN_NAME , PLUGIN_PREFIX , REQUEST_PARAMS , SYNC_LOCK ,
36
36
TABS , URI_PREFIX , WEB_API_BASE , WEBCLIENT , WEBGATEWAY
37
37
} from '../utils/constants' ;
@@ -301,39 +301,43 @@ export default class Context {
301
301
* @memberof Context
302
302
*/
303
303
setUpLuts ( ) {
304
- this . luts_png . url =
305
- this . server + this . getPrefixedURI ( WEBGATEWAY , true ) + LUTS_PNG_URL ;
306
-
307
- // determine the luts png height
308
- let lutsPng = new Image ( ) ;
309
- lutsPng . onload = ( e ) => {
310
- this . luts_png . height = e . target . naturalHeight ;
311
- this . luts_png . image = lutsPng ;
312
- for ( let [ id , conf ] of this . image_configs ) conf . changed ( ) ;
313
- }
314
- lutsPng . src = this . luts_png . url ;
315
-
316
- // now query the luts list
317
- let server = this . server ;
318
- let uri_prefix = this . getPrefixedURI ( WEBGATEWAY ) ;
319
304
$ . ajax (
320
- { url : server + uri_prefix + "/luts/" ,
305
+ { url : this . server + this . getPrefixedURI ( WEBGATEWAY ) + "/luts/" ,
321
306
success : ( response ) => {
322
- if ( typeof response !== 'object' || response === null ||
323
- ! Misc . isArray ( response . luts ) ) return ;
307
+ // Check first whether omero-web can provides LUT dynamically
308
+ // and set URL accordingly
309
+ let is_dynamic_lut = Boolean ( response . png_luts_new ) ;
310
+ if ( is_dynamic_lut ) {
311
+ this . luts_png . url =
312
+ this . server + this . getPrefixedURI ( WEBGATEWAY , false ) + "/luts_png/" ;
313
+ } else {
314
+ this . luts_png . url =
315
+ this . server + this . getPrefixedURI ( WEBGATEWAY , true ) + LUTS_PNG_URL ;
316
+ }
317
+
318
+ // determine the luts png height
319
+ let lutsPng = new Image ( ) ;
320
+ lutsPng . onload = ( e ) => {
321
+ this . luts_png . height = e . target . naturalHeight ;
322
+ this . luts_png . image = lutsPng ;
323
+ for ( let [ id , conf ] of this . image_configs ) conf . changed ( ) ;
324
+ }
325
+ lutsPng . src = this . luts_png . url ;
326
+
327
+ if ( is_dynamic_lut ) {
328
+ // If it's dynamic, uses the new list instead
329
+ response . png_luts = response . png_luts_new
330
+ }
324
331
325
- let i = 0 ;
326
- response . luts . map (
332
+ response . luts . forEach (
327
333
( l ) => {
328
- let isInList = LUTS_NAMES . indexOf ( l . name ) !== - 1 ;
329
334
let mapValue =
330
335
Object . assign ( {
331
336
nice_name :
332
337
l . name . replace ( / .l u t / g, "" ) . replace ( / _ / g, " " ) ,
333
- index : isInList ? i : - 1
338
+ index : is_dynamic_lut ? l . png_index_new : l . png_index
334
339
} , l ) ;
335
340
this . luts . set ( mapValue . name , mapValue ) ;
336
- if ( isInList ) i ++ ;
337
341
} ) ;
338
342
for ( let [ id , conf ] of this . image_configs ) conf . changed ( ) ;
339
343
}
@@ -463,7 +467,7 @@ export default class Context {
463
467
}
464
468
}
465
469
this . show_palette_only = ( this . initParams [ REQUEST_PARAMS . SHOW_PALETTE_ONLY ] != 'False' ) || false
466
- this . enable_mirror = ( this . initParams [ REQUEST_PARAMS . ENABLE_MIRROR ] != 'False' ) || false
470
+ this . enable_mirror = ( this . initParams [ REQUEST_PARAMS . ENABLE_MIRROR ] != 'False' ) || false
467
471
// nodedescriptors can be empty string or "None" (undefined)
468
472
let nds = this . initParams [ REQUEST_PARAMS . NODEDESCRIPTORS ] ;
469
473
// initially hide left and right panels?
0 commit comments