Skip to content

Commit 54a9a7f

Browse files
committed
Add MAX_ACTIVE_CHANNELS to iviewer_settings.py
1 parent aa308d1 commit 54a9a7f

File tree

5 files changed

+14
-7
lines changed

5 files changed

+14
-7
lines changed

plugin/omero_iviewer/iviewer_settings.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,14 @@
3535
"omero.pixeldata.max_projection_bytes will be used or "
3636
"the lower value if both are set.")],
3737

38+
"omero.web.iviewer.max_active_channels":
39+
["MAX_ACTIVE_CHANNELS",
40+
10,
41+
int,
42+
("Default maximum number of active channels. If the /omero_ms_image_region/ "
43+
"microservice endpoint is provided, the options.maxActiveChannels "
44+
"from that response will be used instead.")],
45+
3846
"omero.web.iviewer.roi_page_size":
3947
["ROI_PAGE_SIZE",
4048
500,

plugin/omero_iviewer/views.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@
5050
ROI_PAGE_SIZE = getattr(iviewer_settings, 'ROI_PAGE_SIZE')
5151
ROI_PAGE_SIZE = min(MAX_LIMIT, ROI_PAGE_SIZE)
5252
MAX_PROJECTION_BYTES = getattr(iviewer_settings, 'MAX_PROJECTION_BYTES')
53+
MAX_ACTIVE_CHANNELS = getattr(iviewer_settings, 'MAX_ACTIVE_CHANNELS')
5354
ROI_COLOR_PALETTE = getattr(iviewer_settings, 'ROI_COLOR_PALETTE')
5455
SHOW_PALETTE_ONLY = getattr(iviewer_settings, 'SHOW_PALETTE_ONLY')
5556
ENABLE_MIRROR = getattr(iviewer_settings, 'ENABLE_MIRROR')
@@ -114,6 +115,7 @@ def index(request, iid=None, conn=None, **kwargs):
114115
nodedescriptors = None
115116

116117
params['MAX_PROJECTION_BYTES'] = max_bytes
118+
params['MAX_ACTIVE_CHANNELS'] = MAX_ACTIVE_CHANNELS
117119
params['NODEDESCRIPTORS'] = nodedescriptors
118120
params['ROI_COLOR_PALETTE'] = ROI_COLOR_PALETTE
119121
params['SHOW_PALETTE_ONLY'] = SHOW_PALETTE_ONLY

src/app/context.js

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -192,14 +192,12 @@ export default class Context {
192192
luts = new Map();
193193

194194
/**
195-
* max active channels
196-
*
197-
* // TODO: make the default configurable.
195+
* max active channels - default is loaded from iviewer_settings
198196
*
199197
* @memberof Context
200198
* @type {number}
201199
*/
202-
max_active_channels = 20;
200+
max_active_channels = 10;
203201

204202
/**
205203
* the lookup png
@@ -360,11 +358,9 @@ export default class Context {
360358
loadMaxActiveChannels() {
361359
// query microservice endpoint...
362360
let url = this.server + "/omero_ms_image_region/";
363-
console.log(url);
364361
fetch(url, {method: "OPTIONS"})
365362
.then(r => r.json())
366363
.then(data => {
367-
console.log('data', data);
368364
if (Number.isInteger(data.options?.maxActiveChannels)) {
369365
this.max_active_channels = data.options.maxActiveChannels;
370366
// in case the images loaded already (this query took longer than
@@ -492,6 +488,7 @@ export default class Context {
492488
this.max_projection_bytes = parseInt(this.initParams[REQUEST_PARAMS.MAX_PROJECTION_BYTES], 10)
493489
|| (1024 * 1024 * 256);
494490
this.max_projection_bytes = parseInt(this.initParams[REQUEST_PARAMS.MAX_PROJECTION_BYTES], 10) || (1024 * 1024 * 256);
491+
this.max_active_channels = parseInt(this.initParams[REQUEST_PARAMS.MAX_ACTIVE_CHANNELS], 10) || 10;
495492
let userPalette = `${this.initParams[REQUEST_PARAMS.ROI_COLOR_PALETTE]}`
496493
if (userPalette) {
497494
let arr = userPalette.match(/\[[^\[\]]*\]/g)

src/model/image_info.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -475,7 +475,6 @@ export default class ImageInfo {
475475

476476
applyMaxActiveChannels(max_active_channels) {
477477
// let conf = this.context.getImageConfig(this.config_id);
478-
console.log("applyMaxActiveChannels", max_active_channels, this.channels);
479478
if (this.channels == null) {
480479
return;
481480
}

src/utils/constants.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,7 @@ export const REQUEST_PARAMS = {
134134
ZOOM: 'ZM',
135135
ROI_PAGE_SIZE: 'ROI_PAGE_SIZE',
136136
MAX_PROJECTION_BYTES: 'MAX_PROJECTION_BYTES',
137+
MAX_ACTIVE_CHANNELS: 'MAX_ACTIVE_CHANNELS',
137138
ROI_COLOR_PALETTE: 'ROI_COLOR_PALETTE',
138139
SHOW_PALETTE_ONLY: 'SHOW_PALETTE_ONLY',
139140
ENABLE_MIRROR: 'ENABLE_MIRROR',

0 commit comments

Comments
 (0)