@vitessce/config 3.1.3 → 3.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +168 -26
- package/dist-tsc/VitessceConfig.d.ts +49 -8
- package/dist-tsc/VitessceConfig.d.ts.map +1 -1
- package/dist-tsc/VitessceConfig.js +106 -27
- package/dist-tsc/VitessceConfig.test.js +151 -15
- package/dist-tsc/index.d.ts +1 -1
- package/dist-tsc/index.js +1 -1
- package/package.json +3 -3
- package/src/VitessceConfig.js +108 -28
- package/src/VitessceConfig.test.js +158 -15
- package/src/index.js +1 -1
|
@@ -97,7 +97,7 @@ export class VitessceConfigDataset {
|
|
|
97
97
|
};
|
|
98
98
|
}
|
|
99
99
|
}
|
|
100
|
-
function
|
|
100
|
+
function useCoordinationByObjectHelper(scopes, coordinationScopes, coordinationScopesBy) {
|
|
101
101
|
// Set this.coordinationScopes and this.coordinationScopesBy by recursion on `scopes`.
|
|
102
102
|
/*
|
|
103
103
|
// Destructured, `scopes` might look like:
|
|
@@ -106,7 +106,7 @@ function useComplexCoordinationHelper(scopes, coordinationScopes, coordinationSc
|
|
|
106
106
|
{
|
|
107
107
|
scope: imageLayerScope,
|
|
108
108
|
children: {
|
|
109
|
-
[CoordinationType.
|
|
109
|
+
[CoordinationType.FILE_UID]: { scope: imageScope },
|
|
110
110
|
[CoordinationType.SPATIAL_LAYER_VISIBLE]: { scope: imageVisibleScope },
|
|
111
111
|
[CoordinationType.SPATIAL_LAYER_OPACITY]: { scope: imageOpacityScope },
|
|
112
112
|
[CoordinationType.SPATIAL_IMAGE_CHANNEL]: [
|
|
@@ -138,7 +138,7 @@ function useComplexCoordinationHelper(scopes, coordinationScopes, coordinationSc
|
|
|
138
138
|
};
|
|
139
139
|
this.coordinationScopesBy = {
|
|
140
140
|
[CoordinationType.SPATIAL_IMAGE_LAYER]: {
|
|
141
|
-
[CoordinationType.
|
|
141
|
+
[CoordinationType.FILE_UID]: {
|
|
142
142
|
[imageLayerScope.cScope]: imageScope.cScope,
|
|
143
143
|
},
|
|
144
144
|
[CoordinationType.SPATIAL_LAYER_VISIBLE]: {
|
|
@@ -260,14 +260,20 @@ export class VitessceConfigView {
|
|
|
260
260
|
});
|
|
261
261
|
return this;
|
|
262
262
|
}
|
|
263
|
-
|
|
263
|
+
/**
|
|
264
|
+
* Attach potentially multi-level coordination scopes to this view.
|
|
265
|
+
* @param {object} scopes A value returned by `VitessceConfig.addCoordinationByObject`.
|
|
266
|
+
* Not intended to be a manually-constructed object.
|
|
267
|
+
* @returns {VitessceConfigView} This, to allow chaining.
|
|
268
|
+
*/
|
|
269
|
+
useCoordinationByObject(scopes) {
|
|
264
270
|
if (!this.view.coordinationScopes) {
|
|
265
271
|
this.view.coordinationScopes = {};
|
|
266
272
|
}
|
|
267
273
|
if (!this.view.coordinationScopesBy) {
|
|
268
274
|
this.view.coordinationScopesBy = {};
|
|
269
275
|
}
|
|
270
|
-
const [nextCoordinationScopes, nextCoordinationScopesBy] =
|
|
276
|
+
const [nextCoordinationScopes, nextCoordinationScopesBy] = useCoordinationByObjectHelper(scopes, this.view.coordinationScopes, this.view.coordinationScopesBy);
|
|
271
277
|
this.view.coordinationScopes = nextCoordinationScopes;
|
|
272
278
|
this.view.coordinationScopesBy = nextCoordinationScopesBy;
|
|
273
279
|
return this;
|
|
@@ -364,6 +370,16 @@ export function vconcat(...views) {
|
|
|
364
370
|
class CoordinationLevel {
|
|
365
371
|
constructor(value) {
|
|
366
372
|
this.value = value;
|
|
373
|
+
this.cachedValue = null;
|
|
374
|
+
}
|
|
375
|
+
setCached(processedLevel) {
|
|
376
|
+
this.cachedValue = processedLevel;
|
|
377
|
+
}
|
|
378
|
+
getCached() {
|
|
379
|
+
return this.cachedValue;
|
|
380
|
+
}
|
|
381
|
+
isCached() {
|
|
382
|
+
return this.cachedValue !== null;
|
|
367
383
|
}
|
|
368
384
|
}
|
|
369
385
|
export function CL(value) {
|
|
@@ -423,27 +439,25 @@ export class VitessceConfigMetaCoordinationScope {
|
|
|
423
439
|
this.metaScope.setValue(metaScopesVal);
|
|
424
440
|
return this;
|
|
425
441
|
}
|
|
426
|
-
|
|
442
|
+
/**
|
|
443
|
+
* Attach potentially multi-level coordination scopes to this meta coordination
|
|
444
|
+
* scope instance.
|
|
445
|
+
* @param {object} scopes A value returned by `VitessceConfig.addCoordinationByObject`.
|
|
446
|
+
* Not intended to be a manually-constructed object.
|
|
447
|
+
* @returns {VitessceConfigView} This, to allow chaining.
|
|
448
|
+
*/
|
|
449
|
+
useCoordinationByObject(scopes) {
|
|
427
450
|
if (!this.metaScope.cValue) {
|
|
428
451
|
this.metaScope.setValue({});
|
|
429
452
|
}
|
|
430
453
|
if (!this.metaByScope.cValue) {
|
|
431
454
|
this.metaByScope.setValue({});
|
|
432
455
|
}
|
|
433
|
-
const [metaScopesVal, metaByScopesVal] =
|
|
456
|
+
const [metaScopesVal, metaByScopesVal] = useCoordinationByObjectHelper(scopes, this.metaScope.cValue, this.metaByScope.cValue);
|
|
434
457
|
this.metaScope.setValue(metaScopesVal);
|
|
435
458
|
this.metaByScope.setValue(metaByScopesVal);
|
|
436
459
|
return this;
|
|
437
460
|
}
|
|
438
|
-
/**
|
|
439
|
-
* Set the coordination value of the coordination scope.
|
|
440
|
-
* @param {any} cValue The value to set.
|
|
441
|
-
* @returns {VitessceConfigCoordinationScope} This, to allow chaining.
|
|
442
|
-
*/
|
|
443
|
-
setValue(cValue) {
|
|
444
|
-
this.cValue = cValue;
|
|
445
|
-
return this;
|
|
446
|
-
}
|
|
447
461
|
}
|
|
448
462
|
/**
|
|
449
463
|
* Class representing a Vitessce view config.
|
|
@@ -575,6 +589,11 @@ export class VitessceConfig {
|
|
|
575
589
|
});
|
|
576
590
|
return result;
|
|
577
591
|
}
|
|
592
|
+
/**
|
|
593
|
+
* Initialize a new meta coordination scope in the coordination space,
|
|
594
|
+
* and get a reference to it in the form of a meta coordination scope instance.
|
|
595
|
+
* @returns {VitessceConfigMetaCoordinationScope} A new meta coordination scope instance.
|
|
596
|
+
*/
|
|
578
597
|
addMetaCoordination() {
|
|
579
598
|
const prevMetaScopes = (this.config.coordinationSpace[CoordinationType.META_COORDINATION_SCOPES]
|
|
580
599
|
? Object.keys(this.config.coordinationSpace[CoordinationType.META_COORDINATION_SCOPES])
|
|
@@ -595,13 +614,26 @@ export class VitessceConfig {
|
|
|
595
614
|
this.config.coordinationSpace[CoordinationType.META_COORDINATION_SCOPES_BY][metaContainer.metaByScope.cScope] = metaContainer.metaByScope;
|
|
596
615
|
return metaContainer;
|
|
597
616
|
}
|
|
598
|
-
|
|
617
|
+
/**
|
|
618
|
+
* Set up the initial values for multi-level coordination in the coordination space.
|
|
619
|
+
* Get a reference to these values to pass to the `useCoordinationByObject` method
|
|
620
|
+
* of either view or meta coordination scope instances.
|
|
621
|
+
* @param {object} input A (potentially nested) object with coordination types as keys
|
|
622
|
+
* and values being either the initial coordination value, a `VitessceConfigCoordinationScope`
|
|
623
|
+
* instance, or a `CoordinationLevel` instance.
|
|
624
|
+
* The CL function takes an array of objects as its argument, and returns a CoordinationLevel
|
|
625
|
+
* instance, to support nesting.
|
|
626
|
+
* @returns {object} A (potentially nested) object with coordination types as keys and values
|
|
627
|
+
* being either { scope }, { scope, children }, or an array of these. Not intended to be
|
|
628
|
+
* manipulated before being passed to a `useCoordinationByObject` function.
|
|
629
|
+
*/
|
|
630
|
+
addCoordinationByObject(input) {
|
|
599
631
|
/*
|
|
600
632
|
// The value for `input` might look like:
|
|
601
633
|
{
|
|
602
634
|
[CoordinationType.SPATIAL_IMAGE_LAYER]: CL([
|
|
603
635
|
{
|
|
604
|
-
[CoordinationType.
|
|
636
|
+
[CoordinationType.FILE_UID]: 'S-1905-017737_bf',
|
|
605
637
|
[CoordinationType.SPATIAL_LAYER_VISIBLE]: true,
|
|
606
638
|
[CoordinationType.SPATIAL_LAYER_OPACITY]: 1,
|
|
607
639
|
[CoordinationType.SPATIAL_IMAGE_CHANNEL]: CL([
|
|
@@ -618,7 +650,7 @@ export class VitessceConfig {
|
|
|
618
650
|
]),
|
|
619
651
|
[CoordinationType.SPATIAL_SEGMENTATION_LAYER]: CL([
|
|
620
652
|
{
|
|
621
|
-
[CoordinationType.
|
|
653
|
+
[CoordinationType.FILE_UID]: 'S-1905-017737',
|
|
622
654
|
[CoordinationType.SPATIAL_LAYER_VISIBLE]: true,
|
|
623
655
|
[CoordinationType.SPATIAL_LAYER_OPACITY]: 1,
|
|
624
656
|
[CoordinationType.SPATIAL_SEGMENTATION_CHANNEL]: CL([
|
|
@@ -642,13 +674,13 @@ export class VitessceConfig {
|
|
|
642
674
|
]),
|
|
643
675
|
}
|
|
644
676
|
// Which would correspond to this `output`,
|
|
645
|
-
// a valid input for `VitessceConfigMetaCoordinationScope.
|
|
677
|
+
// a valid input for `VitessceConfigMetaCoordinationScope.useCoordinationByObject()`:
|
|
646
678
|
{
|
|
647
679
|
[CoordinationType.SPATIAL_IMAGE_LAYER]: [
|
|
648
680
|
{
|
|
649
681
|
scope: imageLayerScope,
|
|
650
682
|
children: {
|
|
651
|
-
[CoordinationType.
|
|
683
|
+
[CoordinationType.FILE_UID]: { scope: imageScope },
|
|
652
684
|
[CoordinationType.SPATIAL_LAYER_VISIBLE]: { scope: imageVisibleScope },
|
|
653
685
|
[CoordinationType.SPATIAL_LAYER_OPACITY]: { scope: imageOpacityScope },
|
|
654
686
|
[CoordinationType.SPATIAL_IMAGE_CHANNEL]: [
|
|
@@ -680,8 +712,11 @@ export class VitessceConfig {
|
|
|
680
712
|
// (otherwise assume it is the coordination value).
|
|
681
713
|
if (nextLevelOrInitialValue instanceof CoordinationLevel) {
|
|
682
714
|
const nextLevel = nextLevelOrInitialValue.value;
|
|
683
|
-
if (
|
|
684
|
-
result[cType] =
|
|
715
|
+
if (nextLevelOrInitialValue.isCached()) {
|
|
716
|
+
result[cType] = nextLevelOrInitialValue.getCached();
|
|
717
|
+
}
|
|
718
|
+
else if (Array.isArray(nextLevel)) {
|
|
719
|
+
const processedLevel = nextLevel.map((nextEl) => {
|
|
685
720
|
const [dummyScope] = this.addCoordination(cType);
|
|
686
721
|
// TODO: set a better initial value for dummy cases.
|
|
687
722
|
dummyScope.setValue('__dummy__');
|
|
@@ -690,17 +725,33 @@ export class VitessceConfig {
|
|
|
690
725
|
children: processLevel(nextEl),
|
|
691
726
|
};
|
|
692
727
|
});
|
|
728
|
+
nextLevelOrInitialValue.setCached(processedLevel);
|
|
729
|
+
result[cType] = processedLevel;
|
|
693
730
|
}
|
|
694
731
|
else {
|
|
695
|
-
|
|
732
|
+
const nextEl = nextLevel;
|
|
733
|
+
const [dummyScope] = this.addCoordination(cType);
|
|
734
|
+
// TODO: set a better initial value for dummy cases.
|
|
735
|
+
dummyScope.setValue('__dummy__');
|
|
736
|
+
const processedLevel = {
|
|
737
|
+
scope: dummyScope,
|
|
738
|
+
children: processLevel(nextEl),
|
|
739
|
+
};
|
|
740
|
+
nextLevelOrInitialValue.setCached(processedLevel);
|
|
741
|
+
result[cType] = processedLevel;
|
|
696
742
|
}
|
|
697
743
|
}
|
|
698
744
|
else {
|
|
699
745
|
// Base case.
|
|
700
746
|
const initialValue = nextLevelOrInitialValue;
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
747
|
+
if (initialValue instanceof VitessceConfigCoordinationScope) {
|
|
748
|
+
result[cType] = { scope: initialValue };
|
|
749
|
+
}
|
|
750
|
+
else {
|
|
751
|
+
const [scope] = this.addCoordination(cType);
|
|
752
|
+
scope.setValue(initialValue);
|
|
753
|
+
result[cType] = { scope };
|
|
754
|
+
}
|
|
704
755
|
}
|
|
705
756
|
});
|
|
706
757
|
return result;
|
|
@@ -731,6 +782,34 @@ export class VitessceConfig {
|
|
|
731
782
|
}
|
|
732
783
|
return this;
|
|
733
784
|
}
|
|
785
|
+
/**
|
|
786
|
+
* A convenience function for setting up multi-level and meta-coordination scopes
|
|
787
|
+
* across a set of views.
|
|
788
|
+
* @param {VitessceConfigView[]} views An array of view objects to link together.
|
|
789
|
+
* @param {object} input A (potentially nested) object with coordination types as keys
|
|
790
|
+
* and values being either the initial coordination value, a `VitessceConfigCoordinationScope`
|
|
791
|
+
* instance, or a `CoordinationLevel` instance.
|
|
792
|
+
* The CL function takes an array of objects as its argument, and returns a CoordinationLevel
|
|
793
|
+
* instance, to support nesting.
|
|
794
|
+
* @param {boolean} meta Should meta-coordination be used? Optional. By default, true.
|
|
795
|
+
* @returns {VitessceConfig} This, to allow chaining.
|
|
796
|
+
*/
|
|
797
|
+
linkViewsByObject(views, input, meta = true) {
|
|
798
|
+
const scopes = this.addCoordinationByObject(input);
|
|
799
|
+
if (meta) {
|
|
800
|
+
const metaScope = this.addMetaCoordination();
|
|
801
|
+
metaScope.useCoordinationByObject(scopes);
|
|
802
|
+
views.forEach((view) => {
|
|
803
|
+
view.useMetaCoordination(metaScope);
|
|
804
|
+
});
|
|
805
|
+
}
|
|
806
|
+
else {
|
|
807
|
+
views.forEach((view) => {
|
|
808
|
+
view.useCoordinationByObject(scopes);
|
|
809
|
+
});
|
|
810
|
+
}
|
|
811
|
+
return this;
|
|
812
|
+
}
|
|
734
813
|
/**
|
|
735
814
|
* Set the layout of views.
|
|
736
815
|
* @param {VitessceConfigView|VitessceConfigViewHConcat|VitessceConfigViewVConcat} viewConcat A
|
|
@@ -243,7 +243,7 @@ describe('src/api/VitessceConfig.js', () => {
|
|
|
243
243
|
schemaVersion: '1.0.16',
|
|
244
244
|
name: 'My config',
|
|
245
245
|
});
|
|
246
|
-
config.
|
|
246
|
+
config.addCoordinationByObject({
|
|
247
247
|
spatialImageLayer: CL([
|
|
248
248
|
{
|
|
249
249
|
image: 'S-1905-017737_bf',
|
|
@@ -314,7 +314,11 @@ describe('src/api/VitessceConfig.js', () => {
|
|
|
314
314
|
name: 'My config',
|
|
315
315
|
});
|
|
316
316
|
const dataset = config.addDataset('My dataset');
|
|
317
|
-
|
|
317
|
+
// Coordinate all segmentation channels on the same color,
|
|
318
|
+
// to test out the use of a coordination scope instance as a value.
|
|
319
|
+
const [colorScope] = config.addCoordination('spatialChannelColor');
|
|
320
|
+
colorScope.setValue([255, 0, 0]);
|
|
321
|
+
const scopes = config.addCoordinationByObject({
|
|
318
322
|
spatialImageLayer: CL([
|
|
319
323
|
{
|
|
320
324
|
image: 'S-1905-017737_bf',
|
|
@@ -323,11 +327,11 @@ describe('src/api/VitessceConfig.js', () => {
|
|
|
323
327
|
spatialImageChannel: CL([
|
|
324
328
|
{
|
|
325
329
|
spatialTargetC: 0,
|
|
326
|
-
spatialChannelColor: [
|
|
330
|
+
spatialChannelColor: [0, 255, 0],
|
|
327
331
|
},
|
|
328
332
|
{
|
|
329
333
|
spatialTargetC: 1,
|
|
330
|
-
spatialChannelColor: [0,
|
|
334
|
+
spatialChannelColor: [0, 0, 255],
|
|
331
335
|
},
|
|
332
336
|
]),
|
|
333
337
|
},
|
|
@@ -341,24 +345,24 @@ describe('src/api/VitessceConfig.js', () => {
|
|
|
341
345
|
{
|
|
342
346
|
obsType: 'Cortical Interstitia',
|
|
343
347
|
spatialTargetC: 0,
|
|
344
|
-
spatialChannelColor:
|
|
348
|
+
spatialChannelColor: colorScope,
|
|
345
349
|
},
|
|
346
350
|
{
|
|
347
351
|
obsType: 'Non-Globally Sclerotic Glomeruli',
|
|
348
352
|
spatialTargetC: 1,
|
|
349
|
-
spatialChannelColor:
|
|
353
|
+
spatialChannelColor: colorScope,
|
|
350
354
|
},
|
|
351
355
|
{
|
|
352
356
|
obsType: 'Globally Sclerotic Glomeruli',
|
|
353
357
|
spatialTargetC: 2,
|
|
354
|
-
spatialChannelColor:
|
|
358
|
+
spatialChannelColor: colorScope,
|
|
355
359
|
},
|
|
356
360
|
]),
|
|
357
361
|
},
|
|
358
362
|
]),
|
|
359
363
|
});
|
|
360
364
|
const spatialView = config.addView(dataset, 'spatial');
|
|
361
|
-
spatialView.
|
|
365
|
+
spatialView.useCoordinationByObject(scopes);
|
|
362
366
|
const configJSON = config.toJSON();
|
|
363
367
|
expect(configJSON).toEqual({
|
|
364
368
|
version: '1.0.16',
|
|
@@ -377,9 +381,7 @@ describe('src/api/VitessceConfig.js', () => {
|
|
|
377
381
|
spatialChannelColor: {
|
|
378
382
|
A: [255, 0, 0],
|
|
379
383
|
B: [0, 255, 0],
|
|
380
|
-
C: [
|
|
381
|
-
D: [255, 0, 0],
|
|
382
|
-
E: [255, 0, 0],
|
|
384
|
+
C: [0, 0, 255],
|
|
383
385
|
},
|
|
384
386
|
spatialSegmentationLayer: { A: '__dummy__' },
|
|
385
387
|
spatialSegmentationChannel: { A: '__dummy__', B: '__dummy__', C: '__dummy__' },
|
|
@@ -405,7 +407,7 @@ describe('src/api/VitessceConfig.js', () => {
|
|
|
405
407
|
},
|
|
406
408
|
spatialImageChannel: {
|
|
407
409
|
spatialTargetC: { A: 'A', B: 'B' },
|
|
408
|
-
spatialChannelColor: { A: '
|
|
410
|
+
spatialChannelColor: { A: 'B', B: 'C' },
|
|
409
411
|
},
|
|
410
412
|
spatialSegmentationLayer: {
|
|
411
413
|
image: { A: 'B' },
|
|
@@ -416,7 +418,7 @@ describe('src/api/VitessceConfig.js', () => {
|
|
|
416
418
|
spatialSegmentationChannel: {
|
|
417
419
|
obsType: { A: 'A', B: 'B', C: 'C' },
|
|
418
420
|
spatialTargetC: { A: 'C', B: 'D', C: 'E' },
|
|
419
|
-
spatialChannelColor: { A: '
|
|
421
|
+
spatialChannelColor: { A: 'A', B: 'A', C: 'A' },
|
|
420
422
|
},
|
|
421
423
|
},
|
|
422
424
|
x: 0,
|
|
@@ -433,7 +435,7 @@ describe('src/api/VitessceConfig.js', () => {
|
|
|
433
435
|
name: 'My config',
|
|
434
436
|
});
|
|
435
437
|
const dataset = config.addDataset('My dataset');
|
|
436
|
-
const scopes = config.
|
|
438
|
+
const scopes = config.addCoordinationByObject({
|
|
437
439
|
spatialImageLayer: CL([
|
|
438
440
|
{
|
|
439
441
|
image: 'S-1905-017737_bf',
|
|
@@ -477,7 +479,7 @@ describe('src/api/VitessceConfig.js', () => {
|
|
|
477
479
|
]),
|
|
478
480
|
});
|
|
479
481
|
const metaCoordinationScope = config.addMetaCoordination();
|
|
480
|
-
metaCoordinationScope.
|
|
482
|
+
metaCoordinationScope.useCoordinationByObject(scopes);
|
|
481
483
|
const spatialView = config.addView(dataset, 'spatial');
|
|
482
484
|
const lcView = config.addView(dataset, 'layerController');
|
|
483
485
|
spatialView.useMetaCoordination(metaCoordinationScope);
|
|
@@ -565,6 +567,140 @@ describe('src/api/VitessceConfig.js', () => {
|
|
|
565
567
|
initStrategy: 'auto',
|
|
566
568
|
});
|
|
567
569
|
});
|
|
570
|
+
it('can use _meta_ complex coordination via the linkViewsByObject convenience function', () => {
|
|
571
|
+
const config = new VitessceConfig({
|
|
572
|
+
schemaVersion: '1.0.16',
|
|
573
|
+
name: 'My config',
|
|
574
|
+
});
|
|
575
|
+
const dataset = config.addDataset('My dataset');
|
|
576
|
+
const spatialView = config.addView(dataset, 'spatial');
|
|
577
|
+
const lcView = config.addView(dataset, 'layerController');
|
|
578
|
+
config.linkViewsByObject([spatialView, lcView], {
|
|
579
|
+
spatialImageLayer: CL([
|
|
580
|
+
{
|
|
581
|
+
image: 'S-1905-017737_bf',
|
|
582
|
+
spatialLayerVisible: true,
|
|
583
|
+
spatialLayerOpacity: 1,
|
|
584
|
+
spatialImageChannel: CL([
|
|
585
|
+
{
|
|
586
|
+
spatialTargetC: 0,
|
|
587
|
+
spatialChannelColor: [255, 0, 0],
|
|
588
|
+
},
|
|
589
|
+
{
|
|
590
|
+
spatialTargetC: 1,
|
|
591
|
+
spatialChannelColor: [0, 255, 0],
|
|
592
|
+
},
|
|
593
|
+
]),
|
|
594
|
+
},
|
|
595
|
+
]),
|
|
596
|
+
spatialSegmentationLayer: CL([
|
|
597
|
+
{
|
|
598
|
+
image: 'S-1905-017737',
|
|
599
|
+
spatialLayerVisible: true,
|
|
600
|
+
spatialLayerOpacity: 1,
|
|
601
|
+
spatialSegmentationChannel: CL([
|
|
602
|
+
{
|
|
603
|
+
obsType: 'Cortical Interstitia',
|
|
604
|
+
spatialTargetC: 0,
|
|
605
|
+
spatialChannelColor: [255, 0, 0],
|
|
606
|
+
},
|
|
607
|
+
{
|
|
608
|
+
obsType: 'Non-Globally Sclerotic Glomeruli',
|
|
609
|
+
spatialTargetC: 1,
|
|
610
|
+
spatialChannelColor: [255, 0, 0],
|
|
611
|
+
},
|
|
612
|
+
{
|
|
613
|
+
obsType: 'Globally Sclerotic Glomeruli',
|
|
614
|
+
spatialTargetC: 2,
|
|
615
|
+
spatialChannelColor: [255, 0, 0],
|
|
616
|
+
},
|
|
617
|
+
]),
|
|
618
|
+
},
|
|
619
|
+
]),
|
|
620
|
+
});
|
|
621
|
+
const configJSON = config.toJSON();
|
|
622
|
+
expect(configJSON).toEqual({
|
|
623
|
+
version: '1.0.16',
|
|
624
|
+
name: 'My config',
|
|
625
|
+
datasets: [{ uid: 'A', name: 'My dataset', files: [] }],
|
|
626
|
+
coordinationSpace: {
|
|
627
|
+
dataset: { A: 'A' },
|
|
628
|
+
spatialImageLayer: { A: '__dummy__' },
|
|
629
|
+
image: { A: 'S-1905-017737_bf', B: 'S-1905-017737' },
|
|
630
|
+
spatialLayerVisible: { A: true, B: true },
|
|
631
|
+
spatialLayerOpacity: { A: 1, B: 1 },
|
|
632
|
+
spatialImageChannel: { A: '__dummy__', B: '__dummy__' },
|
|
633
|
+
spatialTargetC: {
|
|
634
|
+
A: 0, B: 1, C: 0, D: 1, E: 2,
|
|
635
|
+
},
|
|
636
|
+
spatialChannelColor: {
|
|
637
|
+
A: [255, 0, 0],
|
|
638
|
+
B: [0, 255, 0],
|
|
639
|
+
C: [255, 0, 0],
|
|
640
|
+
D: [255, 0, 0],
|
|
641
|
+
E: [255, 0, 0],
|
|
642
|
+
},
|
|
643
|
+
spatialSegmentationLayer: { A: '__dummy__' },
|
|
644
|
+
spatialSegmentationChannel: { A: '__dummy__', B: '__dummy__', C: '__dummy__' },
|
|
645
|
+
obsType: {
|
|
646
|
+
A: 'Cortical Interstitia',
|
|
647
|
+
B: 'Non-Globally Sclerotic Glomeruli',
|
|
648
|
+
C: 'Globally Sclerotic Glomeruli',
|
|
649
|
+
},
|
|
650
|
+
metaCoordinationScopes: {
|
|
651
|
+
A: {
|
|
652
|
+
spatialImageLayer: ['A'],
|
|
653
|
+
spatialSegmentationLayer: ['A'],
|
|
654
|
+
},
|
|
655
|
+
},
|
|
656
|
+
metaCoordinationScopesBy: {
|
|
657
|
+
A: {
|
|
658
|
+
spatialImageLayer: {
|
|
659
|
+
image: { A: 'A' },
|
|
660
|
+
spatialLayerVisible: { A: 'A' },
|
|
661
|
+
spatialLayerOpacity: { A: 'A' },
|
|
662
|
+
spatialImageChannel: { A: ['A', 'B'] },
|
|
663
|
+
},
|
|
664
|
+
spatialImageChannel: {
|
|
665
|
+
spatialTargetC: { A: 'A', B: 'B' },
|
|
666
|
+
spatialChannelColor: { A: 'A', B: 'B' },
|
|
667
|
+
},
|
|
668
|
+
spatialSegmentationLayer: {
|
|
669
|
+
image: { A: 'B' },
|
|
670
|
+
spatialLayerVisible: { A: 'B' },
|
|
671
|
+
spatialLayerOpacity: { A: 'B' },
|
|
672
|
+
spatialSegmentationChannel: { A: ['A', 'B', 'C'] },
|
|
673
|
+
},
|
|
674
|
+
spatialSegmentationChannel: {
|
|
675
|
+
obsType: { A: 'A', B: 'B', C: 'C' },
|
|
676
|
+
spatialTargetC: { A: 'C', B: 'D', C: 'E' },
|
|
677
|
+
spatialChannelColor: { A: 'C', B: 'D', C: 'E' },
|
|
678
|
+
},
|
|
679
|
+
},
|
|
680
|
+
},
|
|
681
|
+
},
|
|
682
|
+
layout: [{
|
|
683
|
+
component: 'spatial',
|
|
684
|
+
coordinationScopes: {
|
|
685
|
+
dataset: 'A',
|
|
686
|
+
metaCoordinationScopes: ['A'],
|
|
687
|
+
metaCoordinationScopesBy: ['A'],
|
|
688
|
+
},
|
|
689
|
+
// eslint-disable-next-line object-property-newline
|
|
690
|
+
x: 0, y: 0, w: 1, h: 1,
|
|
691
|
+
}, {
|
|
692
|
+
component: 'layerController',
|
|
693
|
+
coordinationScopes: {
|
|
694
|
+
dataset: 'A',
|
|
695
|
+
metaCoordinationScopes: ['A'],
|
|
696
|
+
metaCoordinationScopesBy: ['A'],
|
|
697
|
+
},
|
|
698
|
+
// eslint-disable-next-line object-property-newline
|
|
699
|
+
x: 0, y: 0, w: 1, h: 1,
|
|
700
|
+
}],
|
|
701
|
+
initStrategy: 'auto',
|
|
702
|
+
});
|
|
703
|
+
});
|
|
568
704
|
it('can add a coordination scope using the link views convenience function', () => {
|
|
569
705
|
const config = new VitessceConfig({
|
|
570
706
|
schemaVersion: '1.0.4',
|
package/dist-tsc/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { VitessceConfig, vconcat, hconcat } from "./VitessceConfig.js";
|
|
1
|
+
export { VitessceConfig, vconcat, hconcat, CL as CoordinationLevel } from "./VitessceConfig.js";
|
|
2
2
|
export { generateConfig, getHintOptions } from "./VitessceAutoConfig.js";
|
|
3
3
|
export { HINTS_CONFIG, HINT_TYPE_TO_FILE_TYPE_MAP } from "./constants.js";
|
|
4
4
|
//# sourceMappingURL=index.d.ts.map
|
package/dist-tsc/index.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export { VitessceConfig, vconcat, hconcat } from './VitessceConfig.js';
|
|
1
|
+
export { VitessceConfig, vconcat, hconcat, CL as CoordinationLevel } from './VitessceConfig.js';
|
|
2
2
|
export { generateConfig, getHintOptions } from './VitessceAutoConfig.js';
|
|
3
3
|
export { HINTS_CONFIG, HINT_TYPE_TO_FILE_TYPE_MAP } from './constants.js';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vitessce/config",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.2.0",
|
|
4
4
|
"author": "Gehlenborg Lab",
|
|
5
5
|
"homepage": "http://vitessce.io",
|
|
6
6
|
"repository": {
|
|
@@ -16,8 +16,8 @@
|
|
|
16
16
|
"dist-tsc"
|
|
17
17
|
],
|
|
18
18
|
"dependencies": {
|
|
19
|
-
"@vitessce/constants-internal": "3.
|
|
20
|
-
"@vitessce/utils": "3.
|
|
19
|
+
"@vitessce/constants-internal": "3.2.0",
|
|
20
|
+
"@vitessce/utils": "3.2.0"
|
|
21
21
|
},
|
|
22
22
|
"scripts": {
|
|
23
23
|
"bundle": "pnpm exec vite build -c ../../scripts/vite.config.js",
|