@@ -21,7 +21,6 @@ import Backbone from "backbone";
2121import $ from "jquery" ;
2222import _ from 'underscore' ;
2323import * as bootstrap from "bootstrap"
24- import * as omezarr from "ome-zarr.js" ;
2524
2625import lut_picker_template from '../../templates/lut_picker.template.html?raw' ;
2726import { showModal , getJson } from "./util" ;
@@ -39,10 +38,6 @@ var LutPickerView = Backbone.View.extend({
3938 initialize :function ( ) {
4039 this . lutModal = new bootstrap . Modal ( '#lutpickerModal' ) ;
4140 this . lut_names = [ ] ;
42-
43- // These will be overwritten with LUTs from OMERO if served by OMERO
44- this . luts = omezarr . getLuts ( ) ;
45-
4641 this . loadLuts ( ) ;
4742 } ,
4843
@@ -63,24 +58,13 @@ var LutPickerView = Backbone.View.extend({
6358 this . pickedLut = lutName ;
6459
6560 // Update preview to show LUT
66- var lut = this . luts . find ( lut => lut . name == lutName ) ;
67- if ( lut . png ) {
68- $ ( ".lutPreview" , this . el ) . css ( { 'background-position' : '0 0' , 'background-image' : "url('" + lut . png + "')" , 'background-size' : '100% 100%' } ) ;
69- } else {
70- var bgPos = this . getLutBackgroundPosition ( lutName ) ;
71- $ ( ".lutPreview" , this . el ) . css ( { 'background-position' : bgPos , 'background-image' : `url(${ this . lutsPngUrl } )` } ) ;
72- }
61+ var bgPos = this . getLutBackgroundPosition ( lutName ) ;
62+ $ ( ".lutPreview" , this . el ) . css ( { 'background-position' : bgPos , 'background-image' : `url(${ this . lutsPngUrl } )` } ) ;
7363 // Enable OK button
7464 $ ( "button[type='submit']" , this . el ) . removeAttr ( 'disabled' ) ;
7565 } ,
7666
7767 loadLuts : async function ( force_reload = false ) {
78- if ( ! APP_SERVED_BY_OMERO ) {
79- $ ( ":root" ) . css ( {
80- "--pngHeight" : "100%"
81- } ) ;
82- return ;
83- }
8468 var url = WEBGATEWAYINDEX + 'luts/' ;
8569 let cors_headers = { mode : 'cors' , credentials : 'include' } ;
8670 if ( force_reload || this . lut_names === undefined || this . lutsPngUrl === undefined || this . luts === undefined ) {
@@ -116,14 +100,6 @@ var LutPickerView = Backbone.View.extend({
116100 return this . lutsPngUrl
117101 } ,
118102
119- getLutPng ( lutName ) {
120- // This will return undefined if the LUTs are loaded from OMERO
121- var lut = this . luts . find ( lut => lut . name == lutName ) ;
122- if ( lut && lut . png ) {
123- return lut . png ;
124- }
125- } ,
126-
127103 getLutBackgroundPosition : function ( lutName ) {
128104 var lutIndex = this . lut_names . indexOf ( lutName ) ;
129105 if ( lutIndex > - 1 ) {
@@ -149,7 +125,8 @@ var LutPickerView = Backbone.View.extend({
149125 if ( options . success ) {
150126 this . success = options . success ;
151127 }
152- this . render ( ) ;
128+
129+ this . loadLuts ( ) . then ( ( ) => this . render ( ) ) ;
153130 } ,
154131
155132 render :function ( ) {
@@ -163,7 +140,6 @@ var LutPickerView = Backbone.View.extend({
163140 // Add css background-position to each lut to offset luts_10.png
164141 return { 'bgPos' : this . getLutBackgroundPosition ( lut . name ) ,
165142 'name' : lut . name ,
166- 'png' : lut . png , // if LUT is from omezarr.js, we have png in hand
167143 'displayName' : this . formatLutName ( lut . name ) } ;
168144 } . bind ( this ) ) ;
169145
@@ -175,4 +151,4 @@ var LutPickerView = Backbone.View.extend({
175151
176152const FigureLutPicker = new LutPickerView ( ) ;
177153
178- export default FigureLutPicker ;
154+ export default FigureLutPicker
0 commit comments