Skip to content

Commit ecad238

Browse files
authored
Merge pull request #405 from DigitalSlideArchive/update-plottable
Update plottable data to match changes in large_image.
2 parents 7c19cb7 + a20cc2a commit ecad238

File tree

4 files changed

+28
-24
lines changed

4 files changed

+28
-24
lines changed

histomicsui/web_client/panels/MetadataPlot.js

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -156,12 +156,12 @@ var MetadataPlot = Panel.extend({
156156
requiredKeys.push(this.plotConfig[k]);
157157
}
158158
});
159-
keys = keys.concat(['_0_item.name', '_2_item.id', '_bbox.x0', '_bbox.y0', '_bbox.x1', '_bbox.y1']);
159+
keys = keys.concat(['item.name', 'item.id', 'bbox.x0', 'bbox.y0', 'bbox.x1', 'bbox.y1']);
160160
if (this._currentAnnotations && this._currentAnnotations.length > 1) {
161-
keys = keys.concat(['_1_annotation.name']);
161+
keys = keys.concat(['annotation.name']);
162162
}
163163
if (this._currentAnnotations && this._currentAnnotations.length >= 1) {
164-
keys = keys.concat(['_3_annotation.id', '_5_annotationelement.id']);
164+
keys = keys.concat(['annotation.id', 'annotationelement.id']);
165165
}
166166
const fetch = {
167167
adjacentItems: !!this.plotConfig.folder,
@@ -250,7 +250,7 @@ var MetadataPlot = Panel.extend({
250250
}
251251
return;
252252
}
253-
if (plotData.colDict['_3_annotation.id'] === undefined || plotData.colDict['_5_annotationelement.id'] === undefined) {
253+
if (plotData.colDict['annotation.id'] === undefined || plotData.colDict['annotationelement.id'] === undefined) {
254254
return;
255255
}
256256
// evt is undefined when the selection is cleared
@@ -263,8 +263,8 @@ var MetadataPlot = Panel.extend({
263263
const elements = [];
264264
evt.points.forEach((pt) => {
265265
const row = plotData.data[pt.pointIndex];
266-
const annotid = row[plotData.colDict['_3_annotation.id'].index];
267-
const elid = row[plotData.colDict['_5_annotationelement.id'].index];
266+
const annotid = row[plotData.colDict['annotation.id'].index];
267+
const elid = row[plotData.colDict['annotationelement.id'].index];
268268
if (annotid === undefined || elid === undefined) {
269269
return;
270270
}
@@ -286,14 +286,14 @@ var MetadataPlot = Panel.extend({
286286
},
287287

288288
onElementSelect: function (elements) {
289-
if (!this.lastPlotData || !this.lastPlotData.colDict['_5_annotationelement.id'] || !elements.models) {
289+
if (!this.lastPlotData || !this.lastPlotData.colDict['annotationelement.id'] || !elements.models) {
290290
return;
291291
}
292292
const ids = {};
293293
elements.models.forEach((el) => {
294294
ids[el.id] = true;
295295
});
296-
const colidx = this.lastPlotData.colDict['_5_annotationelement.id'].index;
296+
const colidx = this.lastPlotData.colDict['annotationelement.id'].index;
297297
const points = this.lastPlotData.data.map((row, idx) => ids[row[colidx]] ? idx : null).filter((idx) => idx !== null);
298298
if (!points.length) {
299299
return;
@@ -335,12 +335,12 @@ var MetadataPlot = Panel.extend({
335335
_hoverText: function (d, plotData) {
336336
const used = {};
337337
let parts = [];
338-
let key = '_0_item.name';
338+
let key = 'item.name';
339339
if (plotData.adjacentItems && plotData.colDict[key] && d[plotData.colDict[key].index] !== undefined && plotData.colDict[key].distinctcount !== 1) {
340340
used[key] = true;
341341
parts.push(plotData.colDict[key]);
342342
}
343-
key = '_1_annotation.name';
343+
key = 'annotation.name';
344344
if (plotData.colDict[key] && d[plotData.colDict[key].index] !== undefined) {
345345
used[key] = true;
346346
parts.push(plotData.colDict[key]);
@@ -354,11 +354,11 @@ var MetadataPlot = Panel.extend({
354354
parts = parts.map((col) => `${col.title}: ${col.type === 'number' ? this._formatNumber(d[col.index]) : d[col.index]}`);
355355

356356
const imageDict = {
357-
id: '_2_item.id',
358-
left: '_bbox.x0',
359-
top: '_bbox.y0',
360-
right: '_bbox.x1',
361-
bottom: '_bbox.y1'
357+
id: 'item.id',
358+
left: 'bbox.x0',
359+
top: 'bbox.y0',
360+
right: 'bbox.x1',
361+
bottom: 'bbox.y1'
362362
};
363363
if (Object.values(imageDict).every((v) => plotData.colDict[v] && d[plotData.colDict[v].index] !== undefined)) {
364364
d.image = {};

histomicsui/web_client/templates/dialogs/metadataPlot.pug

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,10 @@
2222
{key: 'r', label: 'Radius'},
2323
{key: 'c', label: 'Color'},
2424
{key: 's', label: 'Symbol', string: true, comment: 'Grouping for violin plots'}]
25+
-
26+
var numNumbers = 0;
27+
var numIndex = [];
28+
plotOptions.forEach((po, idx) => { numIndex.push(numNumbers); if (po.type === 'number') { numNumbers += 1; }});
2529
for series, seriesidx in seriesList
2630
.form-group
2731
label(for='h-plot-series-' + series.key) #{series.label}
@@ -33,7 +37,7 @@
3337
each opt, optidx in plotOptions
3438
if (!series.number || opt.type === 'number') && (!series.string || opt.type === 'string' || opt.distinct)
3539
- var selected = plotConfig[series.key] === opt.key
36-
- if (plotConfig[series.key] === undefined && series.number === true && optidx === seriesidx) { selected = true; }
40+
- if (plotConfig[series.key] === undefined && series.number === true && numIndex[optidx] === seriesidx) { selected = true; }
3741
option(value=opt.key, selected=selected) #{opt.title}
3842
.form-group
3943
label(for='h-plot-folder')

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ def prerelease_local_scheme(version):
4242
'Programming Language :: Python :: 3.12',
4343
],
4444
install_requires=[
45-
'girder-large-image-annotation>=1.29.2',
45+
'girder-large-image-annotation>=1.29.4',
4646
'girder-slicer-cli-web[girder]>=1.4.0',
4747
'cachetools',
4848
'orjson',

tests/web_client_specs/metadataPlotSpec.js

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -103,11 +103,11 @@ girderTest.promise.done(function () {
103103
return $('#h-plot-series-x').length;
104104
}, 'dialog controls to exist');
105105
runs(function () {
106-
$('#h-plot-series-x').val('gloms.pas.item');
107-
$('#h-plot-series-y').val('gloms.area.item');
108-
$('#h-plot-series-r').val('gloms.aspect.item');
109-
$('#h-plot-series-c').val('gloms.label.item');
110-
$('#h-plot-series-s').val('_0_item.name');
106+
$('#h-plot-series-x').val('data.gloms.0.pas');
107+
$('#h-plot-series-y').val('data.gloms.0.area');
108+
$('#h-plot-series-r').val('data.gloms.0.aspect');
109+
$('#h-plot-series-c').val('data.gloms.0.label');
110+
$('#h-plot-series-s').val('item.name');
111111
$('.h-submit').click();
112112
});
113113
girderTest.waitForLoad();
@@ -130,8 +130,8 @@ girderTest.promise.done(function () {
130130
girderTest.waitForDialog();
131131
runs(function () {
132132
// switch some other options, too.
133-
$('#h-plot-series-r').val('gloms.label.item');
134-
$('#h-plot-series-c').val('gloms.average.item');
133+
$('#h-plot-series-r').val('data.gloms.0.label');
134+
$('#h-plot-series-c').val('data.gloms.0.average');
135135
$('#h-plot-folder').prop('checked', false);
136136
$('.h-submit').click();
137137
});

0 commit comments

Comments
 (0)