dicom-microscopy-viewer 0.36.3 → 0.37.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/README.md +44 -42
- package/dist/dicom-microscopy-viewer.js +1 -1
- package/dist/dicom-microscopy-viewer.js.map +1 -1
- package/docs/annotation.AnnotationGroup.html +142 -43
- package/docs/annotation.html +2 -2
- package/docs/annotation.js.html +47 -34
- package/docs/annotations__AnnotationManager.js.html +2 -2
- package/docs/annotations_markups__MarkupManager.js.html +2 -2
- package/docs/api.html +2 -2
- package/docs/color.PaletteColorLookupTable.html +42 -14
- package/docs/color.html +6 -6
- package/docs/color.js.html +14 -14
- package/docs/dicom-microscopy-viewer.js.html +2 -2
- package/docs/events.html +316 -2
- package/docs/events.js.html +13 -4
- package/docs/index.html +44 -44
- package/docs/mapping.ParameterMapping.html +342 -27
- package/docs/mapping.Transformation.html +221 -14
- package/docs/mapping.html +2 -2
- package/docs/mapping.js.html +41 -32
- package/docs/metadata.Comprehensive3DSR.html +254 -5
- package/docs/metadata.MicroscopyBulkSimpleAnnotations.html +254 -5
- package/docs/metadata.ParametricMap.html +254 -5
- package/docs/metadata.SOPClass.html +399 -0
- package/docs/metadata.Segmentation.html +254 -5
- package/docs/metadata.VLWholeSlideMicroscopyImage.html +255 -7
- package/docs/metadata.html +14 -32
- package/docs/metadata.js.html +55 -21
- package/docs/opticalPath.OpticalPath.html +453 -26
- package/docs/opticalPath.html +2 -2
- package/docs/opticalPath.js.html +17 -18
- package/docs/pyramid.js.html +2 -2
- package/docs/roi.ROI.html +317 -25
- package/docs/roi.html +2 -2
- package/docs/roi.js.html +26 -19
- package/docs/scoord3d.Ellipse.html +14 -18
- package/docs/scoord3d.Ellipsoid.html +14 -18
- package/docs/scoord3d.Multipoint.html +14 -18
- package/docs/scoord3d.Point.html +13 -17
- package/docs/scoord3d.Polygon.html +14 -18
- package/docs/scoord3d.Polyline.html +14 -18
- package/docs/scoord3d.Scoord3D.html +608 -0
- package/docs/scoord3d.html +5 -2
- package/docs/scoord3d.js.html +101 -54
- package/docs/segment.Segment.html +160 -48
- package/docs/segment.html +2 -2
- package/docs/segment.js.html +37 -33
- package/docs/utils.html +148 -4
- package/docs/utils.js.html +6 -6
- package/docs/viewer.LabelImageViewer.html +14 -15
- package/docs/viewer.OverviewImageViewer.html +15 -15
- package/docs/viewer.VolumeImageViewer.html +722 -396
- package/docs/viewer.html +2 -2
- package/docs/viewer.js.html +416 -407
- package/package.json +1 -1
- package/src/annotation.js +45 -32
- package/src/color.js +12 -12
- package/src/events.js +11 -2
- package/src/mapping.js +39 -30
- package/src/metadata.js +53 -19
- package/src/opticalPath.js +15 -16
- package/src/roi.js +24 -17
- package/src/scoord3d.js +99 -52
- package/src/segment.js +35 -31
- package/src/utils.js +4 -4
- package/src/viewer.js +414 -405
package/docs/viewer.js.html
CHANGED
|
@@ -314,7 +314,8 @@ function _getInteractionBindingCondition (bindings) {
|
|
|
314
314
|
* slide coordinate system (X, Y, Z), i.e. it express in which direction one
|
|
315
315
|
* is moving in the slide coordinate system when the ROW index changes.
|
|
316
316
|
*
|
|
317
|
-
* @param {
|
|
317
|
+
* @param {metadata.VLWholeSlideMicroscopyImage} metadata - Metadata of a DICOM
|
|
318
|
+
* VL Whole Slide Microscopy Image instance
|
|
318
319
|
*
|
|
319
320
|
* @returns {number} Rotation in radians
|
|
320
321
|
*
|
|
@@ -367,13 +368,13 @@ function _getWindowSize () {
|
|
|
367
368
|
/**
|
|
368
369
|
* Map style options to OpenLayers style.
|
|
369
370
|
*
|
|
370
|
-
* @param {
|
|
371
|
-
* @param {
|
|
371
|
+
* @param {Object} styleOptions - Style options
|
|
372
|
+
* @param {Object} styleOptions.stroke - Style options for the outline of the geometry
|
|
372
373
|
* @param {number[]} styleOptions.stroke.color - RGBA color of the outline
|
|
373
374
|
* @param {number} styleOptions.stroke.width - Width of the outline
|
|
374
|
-
* @param {
|
|
375
|
+
* @param {Object} styleOptions.fill - Style options for body the geometry
|
|
375
376
|
* @param {number[]} styleOptions.fill.color - RGBA color of the body
|
|
376
|
-
* @param {
|
|
377
|
+
* @param {Object} styleOptions.image - Style options for image
|
|
377
378
|
* @return {Style} OpenLayers style
|
|
378
379
|
*
|
|
379
380
|
* @private
|
|
@@ -423,12 +424,12 @@ function _getOpenLayersStyle (styleOptions) {
|
|
|
423
424
|
/**
|
|
424
425
|
* Add ROI properties to feature in a safe way
|
|
425
426
|
*
|
|
426
|
-
* @param {
|
|
427
|
-
* @param {
|
|
428
|
-
* @param {
|
|
429
|
-
* @param {
|
|
430
|
-
* @param {
|
|
431
|
-
* @param {
|
|
427
|
+
* @param {Object} feature - The feature instance that represents the ROI
|
|
428
|
+
* @param {Object} properties -Valid ROI properties
|
|
429
|
+
* @param {Object} properties.measurements - ROI measurements
|
|
430
|
+
* @param {Object} properties.evaluations - ROI evaluations
|
|
431
|
+
* @param {Object} properties.label - ROI label
|
|
432
|
+
* @param {Object} properties.marker - ROI marker (this is used while we don't have presentation states)
|
|
432
433
|
* @param {boolean} optSilent - Opt silent update
|
|
433
434
|
*
|
|
434
435
|
* @private
|
|
@@ -457,9 +458,9 @@ function _addROIPropertiesToFeature (feature, properties, optSilent) {
|
|
|
457
458
|
* Wire measurements and qualitative evaluations to generate content items
|
|
458
459
|
* based on OpenLayers feature properties and geometry.
|
|
459
460
|
*
|
|
460
|
-
* @param {
|
|
461
|
-
* @param {
|
|
462
|
-
* @param {
|
|
461
|
+
* @param {Object} map - The map instance
|
|
462
|
+
* @param {Object} feature - The feature instance
|
|
463
|
+
* @param {Object} pyramid - The pyramid metadata
|
|
463
464
|
* @returns {void}
|
|
464
465
|
*
|
|
465
466
|
* @private
|
|
@@ -526,9 +527,9 @@ function _updateFeatureEvaluations (feature) {
|
|
|
526
527
|
/**
|
|
527
528
|
* Generate feature measurements from its measurement properties
|
|
528
529
|
*
|
|
529
|
-
* @param {
|
|
530
|
-
* @param {
|
|
531
|
-
* @param {
|
|
530
|
+
* @param {Object} map - The map instance
|
|
531
|
+
* @param {Object} feature - The feature instance
|
|
532
|
+
* @param {Object} pyramid - The pyramid metadata
|
|
532
533
|
* @returns {void}
|
|
533
534
|
*
|
|
534
535
|
* @private
|
|
@@ -620,13 +621,13 @@ function _updateFeatureMeasurements (map, feature, pyramid) {
|
|
|
620
621
|
/**
|
|
621
622
|
* Updates the style of a feature.
|
|
622
623
|
*
|
|
623
|
-
* @param {
|
|
624
|
-
* @param {
|
|
624
|
+
* @param {Object} styleOptions - Style options
|
|
625
|
+
* @param {Object} styleOptions.stroke - Style options for the outline of the geometry
|
|
625
626
|
* @param {number[]} styleOptions.stroke.color - RGBA color of the outline
|
|
626
627
|
* @param {number} styleOptions.stroke.width - Width of the outline
|
|
627
|
-
* @param {
|
|
628
|
+
* @param {Object} styleOptions.fill - Style options for body the geometry
|
|
628
629
|
* @param {number[]} styleOptions.fill.color - RGBA color of the body
|
|
629
|
-
* @param {
|
|
630
|
+
* @param {Object} styleOptions.image - Style options for image
|
|
630
631
|
*
|
|
631
632
|
* @private
|
|
632
633
|
*/
|
|
@@ -647,12 +648,12 @@ function _setFeatureStyle (feature, styleOptions) {
|
|
|
647
648
|
/**
|
|
648
649
|
* Build OpenLayers style expression for coloring a WebGL TileLayer.
|
|
649
650
|
*
|
|
650
|
-
* @param {
|
|
651
|
+
* @param {Object} styleOptions - Style options
|
|
651
652
|
* @param {number} styleOptions.windowCenter - Center of the window used for contrast stretching
|
|
652
653
|
* @param {number} styleOptions.windowWidth - Width of the window used for contrast stretching
|
|
653
654
|
* @param {number[][]} styleOptions.colormap - RGB color triplets
|
|
654
655
|
*
|
|
655
|
-
* @returns {
|
|
656
|
+
* @returns {Object} color style expression and corresponding variables
|
|
656
657
|
*
|
|
657
658
|
* @private
|
|
658
659
|
*/
|
|
@@ -721,16 +722,70 @@ function _getColorPaletteStyleForTileLayer ({
|
|
|
721
722
|
return { color: expression, variables }
|
|
722
723
|
}
|
|
723
724
|
|
|
725
|
+
/**
|
|
726
|
+
* Build OpenLayers style expression for coloring a WebGL TileLayer.
|
|
727
|
+
*
|
|
728
|
+
* @param {Object} styleOptions - Style options
|
|
729
|
+
* @param {number} styleOptions.windowCenter - Center of the window used for contrast stretching
|
|
730
|
+
* @param {number} styleOptions.windowWidth - Width of the window used for contrast stretching
|
|
731
|
+
* @param {number[]} styleOptions.color - RGB color triplet
|
|
732
|
+
*
|
|
733
|
+
* @returns {Object} color style expression and corresponding variables
|
|
734
|
+
*
|
|
735
|
+
* @private
|
|
736
|
+
*/
|
|
737
|
+
function _getColorInterpolationStyleForTileLayer ({
|
|
738
|
+
windowCenter,
|
|
739
|
+
windowWidth,
|
|
740
|
+
color
|
|
741
|
+
}) {
|
|
742
|
+
/*
|
|
743
|
+
* If no Palette Color Lookup Table is available, don't create one
|
|
744
|
+
* but let WebGL interpolate colors for improved performance.
|
|
745
|
+
*/
|
|
746
|
+
const expression = [
|
|
747
|
+
'interpolate',
|
|
748
|
+
['linear'],
|
|
749
|
+
[
|
|
750
|
+
'+',
|
|
751
|
+
[
|
|
752
|
+
'/',
|
|
753
|
+
[
|
|
754
|
+
'-',
|
|
755
|
+
['band', 1],
|
|
756
|
+
['var', 'windowCenter']
|
|
757
|
+
],
|
|
758
|
+
['var', 'windowWidth']
|
|
759
|
+
],
|
|
760
|
+
0.5
|
|
761
|
+
],
|
|
762
|
+
0,
|
|
763
|
+
[0, 0, 0, 1],
|
|
764
|
+
1,
|
|
765
|
+
['color', ['var', 'red'], ['var', 'green'], ['var', 'blue'], 1]
|
|
766
|
+
]
|
|
767
|
+
|
|
768
|
+
const variables = {
|
|
769
|
+
red: color[0],
|
|
770
|
+
green: color[1],
|
|
771
|
+
blue: color[2],
|
|
772
|
+
windowCenter,
|
|
773
|
+
windowWidth
|
|
774
|
+
}
|
|
775
|
+
|
|
776
|
+
return { color: expression, variables }
|
|
777
|
+
}
|
|
778
|
+
|
|
724
779
|
/**
|
|
725
780
|
* Build OpenLayers style expression for coloring a WebGL PointLayer.
|
|
726
781
|
*
|
|
727
|
-
* @param {
|
|
782
|
+
* @param {Object} styleOptions - Style options
|
|
728
783
|
* @param {string} styleOptions.name - Name of a property for which values should be colorized
|
|
729
784
|
* @param {number} styleOptions.minValue - Mininum value of the output range
|
|
730
785
|
* @param {number} styleOptions.maxValue - Maxinum value of the output range
|
|
731
786
|
* @param {number[][]} styleOptions.colormap - RGB color triplets
|
|
732
787
|
*
|
|
733
|
-
* @returns {
|
|
788
|
+
* @returns {Object} color style expression
|
|
734
789
|
*
|
|
735
790
|
* @private
|
|
736
791
|
*/
|
|
@@ -818,28 +873,38 @@ class VolumeImageViewer {
|
|
|
818
873
|
/**
|
|
819
874
|
* Create a viewer instance for displaying VOLUME images.
|
|
820
875
|
*
|
|
821
|
-
* @param {
|
|
822
|
-
* @param {
|
|
823
|
-
*
|
|
824
|
-
*
|
|
825
|
-
*
|
|
826
|
-
*
|
|
827
|
-
* @param {
|
|
828
|
-
*
|
|
876
|
+
* @param {Object} options
|
|
877
|
+
* @param {Object} options.client - A DICOMwebClient instance for interacting
|
|
878
|
+
* with an origin server over HTTP
|
|
879
|
+
* @param {metadata.VLWholeSlideMicroscopyImage[]} options.metadata -
|
|
880
|
+
* Metadata of DICOM VL Whole Slide Microscopy Image instances that should be
|
|
881
|
+
* diplayed.
|
|
882
|
+
* @param {number} [options.preload=0] - Number of resolution levels that should
|
|
883
|
+
* be preloaded
|
|
884
|
+
* @param {string[]} [options.controls=[]] - Names of viewer control elements
|
|
885
|
+
* that should be included in the viewport
|
|
886
|
+
* @param {boolean} [options.debug=false] - Whether debug features should be
|
|
887
|
+
* turned on (e.g., display of tile boundaries)
|
|
888
|
+
* @param {number} [options.tilesCacheSize=1000] - Number of tiles that should
|
|
889
|
+
* be cached to avoid repeated retrieval for the DICOMweb server
|
|
829
890
|
*/
|
|
830
891
|
constructor (options) {
|
|
831
892
|
this[_options] = options
|
|
832
893
|
|
|
833
894
|
if (this[_options].debug == null) {
|
|
834
895
|
this[_options].debug = false
|
|
896
|
+
} else {
|
|
897
|
+
this[_options].debug = true
|
|
835
898
|
}
|
|
836
899
|
|
|
837
|
-
if (this[_options].
|
|
838
|
-
this[_options].
|
|
900
|
+
if (this[_options].preload == null) {
|
|
901
|
+
this[_options].preload = false
|
|
902
|
+
} else {
|
|
903
|
+
this[_options].preload = true
|
|
839
904
|
}
|
|
840
905
|
|
|
841
|
-
if (this[_options].
|
|
842
|
-
this[_options].
|
|
906
|
+
if (this[_options].tilesCacheSize == null) {
|
|
907
|
+
this[_options].tilesCacheSize = 1000
|
|
843
908
|
}
|
|
844
909
|
|
|
845
910
|
if (this[_options].controls == null) {
|
|
@@ -1077,7 +1142,6 @@ class VolumeImageViewer {
|
|
|
1077
1142
|
paletteColorLookupTable: paletteColorLookupTable
|
|
1078
1143
|
},
|
|
1079
1144
|
bitsAllocated: bitsAllocated,
|
|
1080
|
-
isColorable: paletteColorLookupTableUID == null,
|
|
1081
1145
|
minStoredValue,
|
|
1082
1146
|
maxStoredValue,
|
|
1083
1147
|
loaderParams: {
|
|
@@ -1133,46 +1197,17 @@ class VolumeImageViewer {
|
|
|
1133
1197
|
colormap: opticalPath.style.paletteColorLookupTable.data
|
|
1134
1198
|
})
|
|
1135
1199
|
} else {
|
|
1136
|
-
|
|
1137
|
-
|
|
1138
|
-
|
|
1139
|
-
|
|
1140
|
-
|
|
1141
|
-
color: [
|
|
1142
|
-
'interpolate',
|
|
1143
|
-
['linear'],
|
|
1144
|
-
[
|
|
1145
|
-
'+',
|
|
1146
|
-
[
|
|
1147
|
-
'/',
|
|
1148
|
-
[
|
|
1149
|
-
'-',
|
|
1150
|
-
['band', 1],
|
|
1151
|
-
['var', 'windowCenter']
|
|
1152
|
-
],
|
|
1153
|
-
['var', 'windowWidth']
|
|
1154
|
-
],
|
|
1155
|
-
0.5
|
|
1156
|
-
],
|
|
1157
|
-
0,
|
|
1158
|
-
[0, 0, 0, 1],
|
|
1159
|
-
1,
|
|
1160
|
-
['color', ['var', 'red'], ['var', 'green'], ['var', 'blue'], 1]
|
|
1161
|
-
],
|
|
1162
|
-
variables: {
|
|
1163
|
-
red: opticalPath.style.color[0],
|
|
1164
|
-
green: opticalPath.style.color[1],
|
|
1165
|
-
blue: opticalPath.style.color[2],
|
|
1166
|
-
windowCenter,
|
|
1167
|
-
windowWidth
|
|
1168
|
-
}
|
|
1169
|
-
}
|
|
1200
|
+
style = _getColorInterpolationStyleForTileLayer({
|
|
1201
|
+
windowCenter,
|
|
1202
|
+
windowWidth,
|
|
1203
|
+
color: opticalPath.style.color
|
|
1204
|
+
})
|
|
1170
1205
|
}
|
|
1171
1206
|
|
|
1172
1207
|
opticalPath.layer = new TileLayer({
|
|
1173
1208
|
source,
|
|
1174
1209
|
extent: pyramid.extent,
|
|
1175
|
-
preload: 1,
|
|
1210
|
+
preload: this[_options].preload ? 1 : 0,
|
|
1176
1211
|
style: style,
|
|
1177
1212
|
visible: false,
|
|
1178
1213
|
useInterimTilesOnError: false,
|
|
@@ -1254,7 +1289,6 @@ class VolumeImageViewer {
|
|
|
1254
1289
|
projection: this[_projection],
|
|
1255
1290
|
wrapX: false,
|
|
1256
1291
|
transition: 0,
|
|
1257
|
-
preload: 1,
|
|
1258
1292
|
bandCount: 3
|
|
1259
1293
|
})
|
|
1260
1294
|
source.on('tileloaderror', (event) => {
|
|
@@ -1275,7 +1309,7 @@ class VolumeImageViewer {
|
|
|
1275
1309
|
opticalPath.layer = new TileLayer({
|
|
1276
1310
|
source,
|
|
1277
1311
|
extent: this[_tileGrid].extent,
|
|
1278
|
-
preload: 1,
|
|
1312
|
+
preload: this[_options].preload ? 1 : 0,
|
|
1279
1313
|
useInterimTilesOnError: false,
|
|
1280
1314
|
cacheSize: this[_options].tilesCacheSize
|
|
1281
1315
|
})
|
|
@@ -1315,24 +1349,28 @@ class VolumeImageViewer {
|
|
|
1315
1349
|
layers.push(tileDebugLayer)
|
|
1316
1350
|
}
|
|
1317
1351
|
|
|
1318
|
-
|
|
1319
|
-
|
|
1320
|
-
|
|
1321
|
-
|
|
1322
|
-
|
|
1323
|
-
|
|
1324
|
-
|
|
1325
|
-
|
|
1326
|
-
|
|
1327
|
-
|
|
1352
|
+
if (Math.max(...this[_pyramid].gridSizes[0]) <= 10) {
|
|
1353
|
+
const overviewView = new View({
|
|
1354
|
+
projection: this[_projection],
|
|
1355
|
+
rotation: this[_rotation],
|
|
1356
|
+
constrainOnlyCenter: false,
|
|
1357
|
+
smoothExtentConstraint: true,
|
|
1358
|
+
smoothResolutionConstraint: true,
|
|
1359
|
+
minZoom: 0,
|
|
1360
|
+
maxZoom: 0,
|
|
1361
|
+
extent: this[_pyramid].extent
|
|
1362
|
+
})
|
|
1328
1363
|
|
|
1329
|
-
|
|
1330
|
-
|
|
1331
|
-
|
|
1332
|
-
|
|
1333
|
-
|
|
1334
|
-
|
|
1335
|
-
|
|
1364
|
+
this[_overviewMap] = new OverviewMap({
|
|
1365
|
+
view: overviewView,
|
|
1366
|
+
layers: overviewLayers,
|
|
1367
|
+
collapsed: false,
|
|
1368
|
+
collapsible: true,
|
|
1369
|
+
rotateWithView: true
|
|
1370
|
+
})
|
|
1371
|
+
} else {
|
|
1372
|
+
this[_overviewMap] = null
|
|
1373
|
+
}
|
|
1336
1374
|
|
|
1337
1375
|
this[_drawingSource] = new VectorSource({
|
|
1338
1376
|
tileGrid: this[_tileGrid],
|
|
@@ -1373,6 +1411,7 @@ class VolumeImageViewer {
|
|
|
1373
1411
|
* We need to reuse them here to avoid duplications.
|
|
1374
1412
|
* Enabling or disabling interactions could cause side effects on
|
|
1375
1413
|
* OverviewMap since it also uses the same interactions in the map
|
|
1414
|
+
* @private
|
|
1376
1415
|
*/
|
|
1377
1416
|
this[_interactions] = {
|
|
1378
1417
|
draw: undefined,
|
|
@@ -1402,7 +1441,9 @@ class VolumeImageViewer {
|
|
|
1402
1441
|
}
|
|
1403
1442
|
|
|
1404
1443
|
if (this[_options].controls.has('overview')) {
|
|
1405
|
-
|
|
1444
|
+
if (this[_overviewMap]) {
|
|
1445
|
+
this[_controls].overview = this[_overviewMap]
|
|
1446
|
+
}
|
|
1406
1447
|
}
|
|
1407
1448
|
|
|
1408
1449
|
for (const control in this[_controls]) {
|
|
@@ -1434,13 +1475,17 @@ class VolumeImageViewer {
|
|
|
1434
1475
|
* grayscale display values are then used as input to the second
|
|
1435
1476
|
* transformation, which maps them to pseudo-color values ranging from black
|
|
1436
1477
|
* color (R=0, G=0, B=0) to the color defined by parameter "color" using
|
|
1437
|
-
* linear interpolation.
|
|
1478
|
+
* linear interpolation. Alternatively, a palette color lookup table can be
|
|
1479
|
+
* provided to perform more sophisticated pseudo-coloring.
|
|
1438
1480
|
*
|
|
1439
1481
|
* @param {string} opticalPathIdentifier - Optical Path Identifier
|
|
1440
|
-
* @param {
|
|
1441
|
-
* @param {number[]} styleOptions.color - RGB color triplet
|
|
1442
|
-
* @param {number} styleOptions.
|
|
1443
|
-
*
|
|
1482
|
+
* @param {Object} styleOptions
|
|
1483
|
+
* @param {number[]} [styleOptions.color] - RGB color triplet
|
|
1484
|
+
* @param {number[]} [styleOptions.paletteColorLookupTable] - palette color
|
|
1485
|
+
* lookup table
|
|
1486
|
+
* @param {number} [styleOptions.opacity] - Opacity
|
|
1487
|
+
* @param {number[]} [styleOptions.limitValues] - Upper and lower windowing
|
|
1488
|
+
* limits
|
|
1444
1489
|
*/
|
|
1445
1490
|
setOpticalPathStyle (opticalPathIdentifier, styleOptions = {}) {
|
|
1446
1491
|
const opticalPath = this[_opticalPaths][opticalPathIdentifier]
|
|
@@ -1462,36 +1507,60 @@ class VolumeImageViewer {
|
|
|
1462
1507
|
if (styleOptions.opacity != null) {
|
|
1463
1508
|
opticalPath.style.opacity = styleOptions.opacity
|
|
1464
1509
|
opticalPath.layer.setOpacity(styleOptions.opacity)
|
|
1510
|
+
opticalPath.overviewTileLayer.setOpacity(styleOptions.opacity)
|
|
1465
1511
|
}
|
|
1466
1512
|
|
|
1467
|
-
const styleVariables = {}
|
|
1468
1513
|
if (opticalPath.opticalPath.isMonochromatic) {
|
|
1469
|
-
if (styleOptions.color != null) {
|
|
1470
|
-
if (opticalPath.opticalPath.isColorable) {
|
|
1471
|
-
opticalPath.style.color = styleOptions.color
|
|
1472
|
-
styleVariables.red = opticalPath.style.color[0]
|
|
1473
|
-
styleVariables.green = opticalPath.style.color[1]
|
|
1474
|
-
styleVariables.blue = opticalPath.style.color[2]
|
|
1475
|
-
} else {
|
|
1476
|
-
console.warn(
|
|
1477
|
-
`optical path "${opticalPathIdentifier}" is not colorable`
|
|
1478
|
-
)
|
|
1479
|
-
}
|
|
1480
|
-
}
|
|
1481
1514
|
if (styleOptions.limitValues != null) {
|
|
1482
1515
|
opticalPath.style.limitValues = [
|
|
1483
1516
|
Math.max(styleOptions.limitValues[0], opticalPath.minStoredValue),
|
|
1484
1517
|
Math.min(styleOptions.limitValues[1], opticalPath.maxStoredValue)
|
|
1485
1518
|
]
|
|
1486
|
-
const [windowCenter, windowWidth] = createWindow(
|
|
1487
|
-
styleOptions.limitValues[0],
|
|
1488
|
-
styleOptions.limitValues[1]
|
|
1489
|
-
)
|
|
1490
|
-
styleVariables.windowCenter = windowCenter
|
|
1491
|
-
styleVariables.windowWidth = windowWidth
|
|
1492
1519
|
}
|
|
1493
|
-
|
|
1494
|
-
|
|
1520
|
+
const [windowCenter, windowWidth] = createWindow(
|
|
1521
|
+
opticalPath.style.limitValues[0],
|
|
1522
|
+
opticalPath.style.limitValues[1]
|
|
1523
|
+
)
|
|
1524
|
+
|
|
1525
|
+
if (styleOptions.paletteColorLookupTable != null) {
|
|
1526
|
+
const style = _getColorPaletteStyleForTileLayer({
|
|
1527
|
+
windowCenter,
|
|
1528
|
+
windowWidth,
|
|
1529
|
+
colormap: styleOptions.paletteColorLookupTable.data
|
|
1530
|
+
})
|
|
1531
|
+
opticalPath.style.paletteColorLookupTable = styleOptions.paletteColorLookupTable
|
|
1532
|
+
opticalPath.layer.setStyle(style)
|
|
1533
|
+
opticalPath.overviewTileLayer.setStyle(style)
|
|
1534
|
+
} else if (styleOptions.color != null) {
|
|
1535
|
+
opticalPath.style.color = styleOptions.color
|
|
1536
|
+
if (opticalPath.style.paletteColorLookupTable) {
|
|
1537
|
+
const style = _getColorInterpolationStyleForTileLayer({
|
|
1538
|
+
windowCenter,
|
|
1539
|
+
windowWidth,
|
|
1540
|
+
color: opticalPath.style.color
|
|
1541
|
+
})
|
|
1542
|
+
opticalPath.style.paletteColorLookupTable = undefined
|
|
1543
|
+
opticalPath.layer.setStyle(style)
|
|
1544
|
+
opticalPath.overviewTileLayer.setStyle(style)
|
|
1545
|
+
} else {
|
|
1546
|
+
const styleVariables = {
|
|
1547
|
+
windowCenter: windowCenter,
|
|
1548
|
+
windowWidth: windowWidth,
|
|
1549
|
+
red: opticalPath.style.color[0],
|
|
1550
|
+
green: opticalPath.style.color[1],
|
|
1551
|
+
blue: opticalPath.style.color[2]
|
|
1552
|
+
}
|
|
1553
|
+
opticalPath.layer.updateStyleVariables(styleVariables)
|
|
1554
|
+
opticalPath.overviewTileLayer.updateStyleVariables(styleVariables)
|
|
1555
|
+
}
|
|
1556
|
+
} else {
|
|
1557
|
+
const styleVariables = {
|
|
1558
|
+
windowCenter: windowCenter,
|
|
1559
|
+
windowWidth: windowWidth
|
|
1560
|
+
}
|
|
1561
|
+
opticalPath.layer.updateStyleVariables(styleVariables)
|
|
1562
|
+
opticalPath.overviewTileLayer.updateStyleVariables(styleVariables)
|
|
1563
|
+
}
|
|
1495
1564
|
}
|
|
1496
1565
|
}
|
|
1497
1566
|
|
|
@@ -1527,7 +1596,7 @@ class VolumeImageViewer {
|
|
|
1527
1596
|
* Get the style of an optical path.
|
|
1528
1597
|
*
|
|
1529
1598
|
* @param {string} opticalPathIdentifier - Optical Path Identifier
|
|
1530
|
-
* @return {
|
|
1599
|
+
* @return {Object} Style of optical path
|
|
1531
1600
|
*/
|
|
1532
1601
|
getOpticalPathStyle (opticalPathIdentifier) {
|
|
1533
1602
|
const opticalPath = this[_opticalPaths][opticalPathIdentifier]
|
|
@@ -1538,15 +1607,15 @@ class VolumeImageViewer {
|
|
|
1538
1607
|
)
|
|
1539
1608
|
}
|
|
1540
1609
|
if (opticalPath.opticalPath.isMonochromatic) {
|
|
1541
|
-
if (opticalPath.
|
|
1610
|
+
if (opticalPath.style.paletteColorLookupTable) {
|
|
1542
1611
|
return {
|
|
1543
|
-
|
|
1612
|
+
paletteColorLookupTable: opticalPath.style.paletteColorLookupTable,
|
|
1544
1613
|
opacity: opticalPath.style.opacity,
|
|
1545
1614
|
limitValues: opticalPath.style.limitValues
|
|
1546
1615
|
}
|
|
1547
1616
|
}
|
|
1548
1617
|
return {
|
|
1549
|
-
|
|
1618
|
+
color: opticalPath.style.color,
|
|
1550
1619
|
opacity: opticalPath.style.opacity,
|
|
1551
1620
|
limitValues: opticalPath.style.limitValues
|
|
1552
1621
|
}
|
|
@@ -1558,7 +1627,8 @@ class VolumeImageViewer {
|
|
|
1558
1627
|
* Get image metadata for an optical path.
|
|
1559
1628
|
*
|
|
1560
1629
|
* @param {string} opticalPathIdentifier - Optical Path Identifier
|
|
1561
|
-
* @returns {VLWholeSlideMicroscopyImage[]} Slide microscopy image
|
|
1630
|
+
* @returns {metadata.VLWholeSlideMicroscopyImage[]} Slide microscopy image
|
|
1631
|
+
* metadata
|
|
1562
1632
|
*/
|
|
1563
1633
|
getOpticalPathMetadata (opticalPathIdentifier) {
|
|
1564
1634
|
const opticalPath = this[_opticalPaths][opticalPathIdentifier]
|
|
@@ -1574,14 +1644,14 @@ class VolumeImageViewer {
|
|
|
1574
1644
|
/**
|
|
1575
1645
|
* Get all optical paths.
|
|
1576
1646
|
*
|
|
1577
|
-
* @return {OpticalPath[]}
|
|
1647
|
+
* @return {opticalPath.OpticalPath[]}
|
|
1578
1648
|
*/
|
|
1579
1649
|
getAllOpticalPaths () {
|
|
1580
1650
|
const opticalPaths = []
|
|
1581
1651
|
for (const opticalPathIdentifier in this[_opticalPaths]) {
|
|
1582
1652
|
opticalPaths.push(this[_opticalPaths][opticalPathIdentifier].opticalPath)
|
|
1583
1653
|
}
|
|
1584
|
-
return opticalPaths
|
|
1654
|
+
return opticalPaths.sort(item => (item.OpticalPathIdentifier))
|
|
1585
1655
|
}
|
|
1586
1656
|
|
|
1587
1657
|
/**
|
|
@@ -1604,10 +1674,12 @@ class VolumeImageViewer {
|
|
|
1604
1674
|
0,
|
|
1605
1675
|
opticalPath.layer
|
|
1606
1676
|
)
|
|
1607
|
-
this[_overviewMap]
|
|
1608
|
-
|
|
1609
|
-
|
|
1610
|
-
|
|
1677
|
+
if (this[_overviewMap]) {
|
|
1678
|
+
this[_overviewMap].getOverviewMap().getLayers().insertAt(
|
|
1679
|
+
0,
|
|
1680
|
+
opticalPath.overviewTileLayer
|
|
1681
|
+
)
|
|
1682
|
+
}
|
|
1611
1683
|
}
|
|
1612
1684
|
|
|
1613
1685
|
/**
|
|
@@ -1627,9 +1699,11 @@ class VolumeImageViewer {
|
|
|
1627
1699
|
return
|
|
1628
1700
|
}
|
|
1629
1701
|
this[_map].removeLayer(opticalPath.layer)
|
|
1630
|
-
this[_overviewMap]
|
|
1631
|
-
|
|
1632
|
-
|
|
1702
|
+
if (this[_overviewMap]) {
|
|
1703
|
+
this[_overviewMap].getOverviewMap().removeLayer(
|
|
1704
|
+
opticalPath.overviewTileLayer
|
|
1705
|
+
)
|
|
1706
|
+
}
|
|
1633
1707
|
}
|
|
1634
1708
|
|
|
1635
1709
|
/**
|
|
@@ -1652,10 +1726,13 @@ class VolumeImageViewer {
|
|
|
1652
1726
|
* Show an optical path.
|
|
1653
1727
|
*
|
|
1654
1728
|
* @param {string} opticalPathIdentifier - Optical Path Identifier
|
|
1655
|
-
* @param {
|
|
1656
|
-
* @param {number[]} styleOptions.color - RGB color triplet
|
|
1657
|
-
* @param {number} styleOptions.
|
|
1658
|
-
*
|
|
1729
|
+
* @param {Object} [styleOptions]
|
|
1730
|
+
* @param {number[]} [styleOptions.color] - RGB color triplet
|
|
1731
|
+
* @param {number[]} [styleOptions.paletteColorLookupTable] - palette color
|
|
1732
|
+
* lookup table
|
|
1733
|
+
* @param {number} [styleOptions.opacity] - Opacity
|
|
1734
|
+
* @param {number[]} [styleOptions.limitValues] - Upper and lower windowing
|
|
1735
|
+
* limits
|
|
1659
1736
|
*/
|
|
1660
1737
|
showOpticalPath (opticalPathIdentifier, styleOptions = {}) {
|
|
1661
1738
|
const opticalPath = this[_opticalPaths][opticalPathIdentifier]
|
|
@@ -1753,7 +1830,7 @@ class VolumeImageViewer {
|
|
|
1753
1830
|
/**
|
|
1754
1831
|
* Render the images in the specified viewport container.
|
|
1755
1832
|
*
|
|
1756
|
-
* @param {
|
|
1833
|
+
* @param {Object} options - Rendering options.
|
|
1757
1834
|
* @param {(string|HTMLElement)} options.container - HTML Element in which the viewer should be injected.
|
|
1758
1835
|
*/
|
|
1759
1836
|
render (options) {
|
|
@@ -1869,64 +1946,75 @@ class VolumeImageViewer {
|
|
|
1869
1946
|
scaleInnerElement.style.margin = '1px'
|
|
1870
1947
|
scaleInnerElement.style.willChange = 'contents,width'
|
|
1871
1948
|
|
|
1872
|
-
|
|
1873
|
-
|
|
1874
|
-
|
|
1875
|
-
|
|
1876
|
-
|
|
1877
|
-
|
|
1878
|
-
|
|
1879
|
-
|
|
1880
|
-
|
|
1881
|
-
|
|
1882
|
-
|
|
1883
|
-
let resizeFactor
|
|
1884
|
-
let targetWidth
|
|
1885
|
-
if (Math.abs(rotation - 180) < 0.01 || Math.abs(rotation - 0) < 0.01) {
|
|
1886
|
-
if (windowSize[1] > windowSize[0]) {
|
|
1887
|
-
targetHeight = Math.ceil(windowSize[1] * 0.2)
|
|
1888
|
-
resizeFactor = targetHeight / height
|
|
1889
|
-
targetWidth = width * resizeFactor
|
|
1890
|
-
} else {
|
|
1891
|
-
targetWidth = Math.ceil(windowSize[0] * 0.15)
|
|
1892
|
-
resizeFactor = targetWidth / width
|
|
1893
|
-
targetHeight = height * resizeFactor
|
|
1949
|
+
if (this[_overviewMap]) {
|
|
1950
|
+
const overviewElement = this[_overviewMap].element
|
|
1951
|
+
const overviewmapElement = Object.values(overviewElement.children).find(
|
|
1952
|
+
c => c.className === 'ol-overviewmap-map'
|
|
1953
|
+
)
|
|
1954
|
+
const buttonElement = Object.values(overviewElement.children).find(
|
|
1955
|
+
c => c.type === 'button'
|
|
1956
|
+
)
|
|
1957
|
+
if (buttonElement) {
|
|
1958
|
+
buttonElement.style.border = '0.25px solid black'
|
|
1959
|
+
buttonElement.style.backgroundColor = 'white'
|
|
1894
1960
|
}
|
|
1895
|
-
|
|
1896
|
-
|
|
1897
|
-
|
|
1898
|
-
|
|
1899
|
-
|
|
1961
|
+
overviewmapElement.style.border = '1px solid black'
|
|
1962
|
+
overviewmapElement.style.color = 'black'
|
|
1963
|
+
// Try to fit the overview map into the target control overlay container
|
|
1964
|
+
const height = Math.abs(this[_pyramid].extent[1])
|
|
1965
|
+
const width = Math.abs(this[_pyramid].extent[2])
|
|
1966
|
+
const rotation = this[_rotation] / Math.PI * 180
|
|
1967
|
+
const windowSize = _getWindowSize()
|
|
1968
|
+
let targetHeight
|
|
1969
|
+
let resizeFactor
|
|
1970
|
+
let targetWidth
|
|
1971
|
+
if (Math.abs(rotation - 180) < 0.01 || Math.abs(rotation - 0) < 0.01) {
|
|
1972
|
+
if (windowSize[1] > windowSize[0]) {
|
|
1973
|
+
targetHeight = Math.ceil(windowSize[1] * 0.2)
|
|
1974
|
+
resizeFactor = targetHeight / height
|
|
1975
|
+
targetWidth = width * resizeFactor
|
|
1976
|
+
} else {
|
|
1977
|
+
targetWidth = Math.ceil(windowSize[0] * 0.15)
|
|
1978
|
+
resizeFactor = targetWidth / width
|
|
1979
|
+
targetHeight = height * resizeFactor
|
|
1980
|
+
}
|
|
1900
1981
|
} else {
|
|
1901
|
-
|
|
1902
|
-
|
|
1903
|
-
|
|
1982
|
+
if (windowSize[1] > windowSize[0]) {
|
|
1983
|
+
targetHeight = Math.ceil(windowSize[1] * 0.2)
|
|
1984
|
+
resizeFactor = targetHeight / width
|
|
1985
|
+
targetWidth = height * resizeFactor
|
|
1986
|
+
} else {
|
|
1987
|
+
targetWidth = Math.ceil(windowSize[0] * 0.15)
|
|
1988
|
+
resizeFactor = targetWidth / height
|
|
1989
|
+
targetHeight = width * resizeFactor
|
|
1990
|
+
}
|
|
1904
1991
|
}
|
|
1992
|
+
overviewmapElement.style.width = `${targetWidth}px`
|
|
1993
|
+
overviewmapElement.style.height = `${targetHeight}px`
|
|
1994
|
+
this[_overviewMap].getOverviewMap().updateSize()
|
|
1905
1995
|
}
|
|
1906
|
-
overviewmapElement.style.width = `${targetWidth}px`
|
|
1907
|
-
overviewmapElement.style.height = `${targetHeight}px`
|
|
1908
|
-
this[_overviewMap].getOverviewMap().updateSize()
|
|
1909
1996
|
})
|
|
1910
1997
|
}
|
|
1911
1998
|
|
|
1912
1999
|
/**
|
|
1913
2000
|
* Activate the draw interaction for graphic annotation of regions of interest.
|
|
1914
2001
|
*
|
|
1915
|
-
* @param {
|
|
2002
|
+
* @param {Object} options - Drawing options
|
|
1916
2003
|
* @param {string} options.geometryType - Name of the geometry type (point, circle, box, polygon, freehandpolygon, line, freehandline)
|
|
1917
|
-
* @param {
|
|
1918
|
-
*
|
|
1919
|
-
* @param {number} options.
|
|
1920
|
-
*
|
|
1921
|
-
* @param {
|
|
1922
|
-
* @param {
|
|
1923
|
-
*
|
|
1924
|
-
* @param {number}
|
|
1925
|
-
* @param {
|
|
1926
|
-
* @param {
|
|
1927
|
-
*
|
|
2004
|
+
* @param {number} [options.maxPoints] - Maximum number of points for "line"
|
|
2005
|
+
* geometry
|
|
2006
|
+
* @param {number} [options.minPoints] - Mininum number of points for "line"
|
|
2007
|
+
* geometry
|
|
2008
|
+
* @param {Object} [options.styleOptions] - Style options
|
|
2009
|
+
* @param {Object} [styleOptions.stroke] - Style options for the contour of
|
|
2010
|
+
* the geometry
|
|
2011
|
+
* @param {number[]} styleOptions.stroke.color - RGBA color of the contour
|
|
2012
|
+
* @param {number} styleOptions.stroke.width - Width of the contour
|
|
2013
|
+
* @param {Object} [styleOptions.fill] - Style options for the body of the
|
|
2014
|
+
* geometry
|
|
2015
|
+
* @param {number[]} styleOptions.fill.color - RGBA color of the body
|
|
1928
2016
|
*/
|
|
1929
|
-
activateDrawInteraction (options
|
|
2017
|
+
activateDrawInteraction (options) {
|
|
1930
2018
|
this.deactivateDrawInteraction()
|
|
1931
2019
|
console.info('activate "draw" interaction')
|
|
1932
2020
|
|
|
@@ -2057,25 +2145,25 @@ class VolumeImageViewer {
|
|
|
2057
2145
|
/**
|
|
2058
2146
|
* Whether draw interaction is active
|
|
2059
2147
|
*
|
|
2060
|
-
* @
|
|
2148
|
+
* @type boolean
|
|
2061
2149
|
*/
|
|
2062
2150
|
get isDrawInteractionActive () {
|
|
2063
2151
|
return this[_interactions].draw !== undefined
|
|
2064
2152
|
}
|
|
2065
2153
|
|
|
2066
2154
|
/**
|
|
2067
|
-
* Whether
|
|
2155
|
+
* Whether drag pan interaction is active.
|
|
2068
2156
|
*
|
|
2069
|
-
* @type
|
|
2157
|
+
* @type boolean
|
|
2070
2158
|
*/
|
|
2071
2159
|
get isDragPanInteractionActive () {
|
|
2072
2160
|
return this[_interactions].dragPan !== undefined
|
|
2073
2161
|
}
|
|
2074
2162
|
|
|
2075
2163
|
/**
|
|
2076
|
-
* Whether
|
|
2164
|
+
* Whether drag zoom interaction is active.
|
|
2077
2165
|
*
|
|
2078
|
-
* @type
|
|
2166
|
+
* @type boolean
|
|
2079
2167
|
*/
|
|
2080
2168
|
get isDragZoomInteractionActive () {
|
|
2081
2169
|
return this[_interactions].dragZoom !== undefined
|
|
@@ -2084,7 +2172,7 @@ class VolumeImageViewer {
|
|
|
2084
2172
|
/**
|
|
2085
2173
|
* Whether translate interaction is active.
|
|
2086
2174
|
*
|
|
2087
|
-
* @type
|
|
2175
|
+
* @type boolean
|
|
2088
2176
|
*/
|
|
2089
2177
|
get isTranslateInteractionActive () {
|
|
2090
2178
|
return this[_interactions].translate !== undefined
|
|
@@ -2120,10 +2208,10 @@ class VolumeImageViewer {
|
|
|
2120
2208
|
/**
|
|
2121
2209
|
* Extract and transform the region of interest (ROI).
|
|
2122
2210
|
*
|
|
2123
|
-
* @param {
|
|
2211
|
+
* @param {Object} feature - Openlayers Feature
|
|
2124
2212
|
* @param {Object[]} pyramid - Metadata for resolution levels of image pyramid
|
|
2125
2213
|
* @param {Object} context - Context
|
|
2126
|
-
* @returns {ROI} Region of interest
|
|
2214
|
+
* @returns {roi.ROI} Region of interest
|
|
2127
2215
|
* @private
|
|
2128
2216
|
*/
|
|
2129
2217
|
_getROIFromFeature (feature, pyramid) {
|
|
@@ -2154,17 +2242,19 @@ class VolumeImageViewer {
|
|
|
2154
2242
|
* @returns {void}
|
|
2155
2243
|
*/
|
|
2156
2244
|
toggleOverviewMap () {
|
|
2157
|
-
|
|
2158
|
-
|
|
2159
|
-
|
|
2160
|
-
|
|
2161
|
-
|
|
2245
|
+
if (this[_overviewMap]) {
|
|
2246
|
+
const controls = this[_map].getControls()
|
|
2247
|
+
const overview = controls.getArray().find((c) => c === this[_overviewMap])
|
|
2248
|
+
if (overview) {
|
|
2249
|
+
this[_map].removeControl(this[_overviewMap])
|
|
2250
|
+
return
|
|
2251
|
+
}
|
|
2252
|
+
this[_map].addControl(this[_overviewMap])
|
|
2253
|
+
const map = this[_overviewMap].getOverviewMap()
|
|
2254
|
+
const view = map.getView()
|
|
2255
|
+
const projection = view.getProjection()
|
|
2256
|
+
view.fit(projection.getExtent(), { size: map.getSize() })
|
|
2162
2257
|
}
|
|
2163
|
-
this[_map].addControl(this[_overviewMap])
|
|
2164
|
-
const map = this[_overviewMap].getOverviewMap()
|
|
2165
|
-
const view = map.getView()
|
|
2166
|
-
const projection = view.getProjection()
|
|
2167
|
-
view.fit(projection.getExtent(), { size: map.getSize() })
|
|
2168
2258
|
}
|
|
2169
2259
|
|
|
2170
2260
|
/**
|
|
@@ -2181,9 +2271,9 @@ class VolumeImageViewer {
|
|
|
2181
2271
|
}
|
|
2182
2272
|
|
|
2183
2273
|
/**
|
|
2184
|
-
* Activate
|
|
2274
|
+
* Activate drag zoom interaction.
|
|
2185
2275
|
*
|
|
2186
|
-
* @param {
|
|
2276
|
+
* @param {Object} options - Options.
|
|
2187
2277
|
*/
|
|
2188
2278
|
activateDragZoomInteraction (options = {}) {
|
|
2189
2279
|
this.deactivateDragZoomInteraction()
|
|
@@ -2208,7 +2298,7 @@ class VolumeImageViewer {
|
|
|
2208
2298
|
}
|
|
2209
2299
|
|
|
2210
2300
|
/**
|
|
2211
|
-
* Deactivate
|
|
2301
|
+
* Deactivate drag zoom interaction.
|
|
2212
2302
|
*/
|
|
2213
2303
|
deactivateDragZoomInteraction () {
|
|
2214
2304
|
console.info('deactivate "dragZoom" interaction')
|
|
@@ -2221,7 +2311,7 @@ class VolumeImageViewer {
|
|
|
2221
2311
|
/**
|
|
2222
2312
|
* Activate select interaction.
|
|
2223
2313
|
*
|
|
2224
|
-
* @param {
|
|
2314
|
+
* @param {Object} options selection options.
|
|
2225
2315
|
*/
|
|
2226
2316
|
activateSelectInteraction (options = {}) {
|
|
2227
2317
|
this.deactivateSelectInteraction()
|
|
@@ -2267,9 +2357,9 @@ class VolumeImageViewer {
|
|
|
2267
2357
|
}
|
|
2268
2358
|
|
|
2269
2359
|
/**
|
|
2270
|
-
* Activate
|
|
2360
|
+
* Activate drag pan interaction.
|
|
2271
2361
|
*
|
|
2272
|
-
* @param {Object} options -
|
|
2362
|
+
* @param {Object} options - Options.
|
|
2273
2363
|
*/
|
|
2274
2364
|
activateDragPanInteraction (options = {}) {
|
|
2275
2365
|
this.deactivateDragPanInteraction()
|
|
@@ -2296,7 +2386,7 @@ class VolumeImageViewer {
|
|
|
2296
2386
|
}
|
|
2297
2387
|
|
|
2298
2388
|
/**
|
|
2299
|
-
* Deactivate
|
|
2389
|
+
* Deactivate drag pan interaction.
|
|
2300
2390
|
*/
|
|
2301
2391
|
deactivateDragPanInteraction () {
|
|
2302
2392
|
console.info('deactivate "drag pan" interaction')
|
|
@@ -2335,7 +2425,7 @@ class VolumeImageViewer {
|
|
|
2335
2425
|
/**
|
|
2336
2426
|
* Whether select interaction is active.
|
|
2337
2427
|
*
|
|
2338
|
-
* @
|
|
2428
|
+
* @type boolean
|
|
2339
2429
|
*/
|
|
2340
2430
|
get isSelectInteractionActive () {
|
|
2341
2431
|
return this[_interactions].select !== undefined
|
|
@@ -2344,7 +2434,7 @@ class VolumeImageViewer {
|
|
|
2344
2434
|
/**
|
|
2345
2435
|
* Activate modify interaction.
|
|
2346
2436
|
*
|
|
2347
|
-
* @param {
|
|
2437
|
+
* @param {Object} options - Modification options.
|
|
2348
2438
|
*/
|
|
2349
2439
|
activateModifyInteraction (options = {}) {
|
|
2350
2440
|
this.deactivateModifyInteraction()
|
|
@@ -2397,7 +2487,7 @@ class VolumeImageViewer {
|
|
|
2397
2487
|
/**
|
|
2398
2488
|
* Whether modify interaction is active.
|
|
2399
2489
|
*
|
|
2400
|
-
* @
|
|
2490
|
+
* @type boolean
|
|
2401
2491
|
*/
|
|
2402
2492
|
get isModifyInteractionActive () {
|
|
2403
2493
|
return this[_interactions].modify !== undefined
|
|
@@ -2406,7 +2496,7 @@ class VolumeImageViewer {
|
|
|
2406
2496
|
/**
|
|
2407
2497
|
* Get all annotated regions of interest.
|
|
2408
2498
|
*
|
|
2409
|
-
* @returns {ROI[]} Array of regions of interest.
|
|
2499
|
+
* @returns {roi.ROI[]} Array of regions of interest.
|
|
2410
2500
|
*/
|
|
2411
2501
|
getAllROIs () {
|
|
2412
2502
|
console.info('get all ROIs')
|
|
@@ -2418,11 +2508,15 @@ class VolumeImageViewer {
|
|
|
2418
2508
|
}
|
|
2419
2509
|
|
|
2420
2510
|
collapseOverviewMap () {
|
|
2421
|
-
this[_overviewMap]
|
|
2511
|
+
if (this[_overviewMap]) {
|
|
2512
|
+
this[_overviewMap].setCollapsed(true)
|
|
2513
|
+
}
|
|
2422
2514
|
}
|
|
2423
2515
|
|
|
2424
2516
|
expandOverviewMap () {
|
|
2425
|
-
this[_overviewMap]
|
|
2517
|
+
if (this[_overviewMap]) {
|
|
2518
|
+
this[_overviewMap].setCollapsed(true)
|
|
2519
|
+
}
|
|
2426
2520
|
}
|
|
2427
2521
|
|
|
2428
2522
|
/**
|
|
@@ -2438,7 +2532,7 @@ class VolumeImageViewer {
|
|
|
2438
2532
|
* Get an individual annotated region of interest.
|
|
2439
2533
|
*
|
|
2440
2534
|
* @param {string} uid - Unique identifier of the region of interest
|
|
2441
|
-
* @returns {ROI} Region of interest.
|
|
2535
|
+
* @returns {roi.ROI} Region of interest.
|
|
2442
2536
|
*/
|
|
2443
2537
|
getROI (uid) {
|
|
2444
2538
|
console.info(`get ROI ${uid}`)
|
|
@@ -2450,7 +2544,7 @@ class VolumeImageViewer {
|
|
|
2450
2544
|
* Add a measurement to a region of interest.
|
|
2451
2545
|
*
|
|
2452
2546
|
* @param {string} uid - Unique identifier of the region of interest
|
|
2453
|
-
* @param {
|
|
2547
|
+
* @param {Object} item - NUM content item representing a measurement
|
|
2454
2548
|
*/
|
|
2455
2549
|
addROIMeasurement (uid, item) {
|
|
2456
2550
|
const meaning = item.ConceptNameCodeSequence[0].CodeMeaning
|
|
@@ -2473,7 +2567,7 @@ class VolumeImageViewer {
|
|
|
2473
2567
|
* Add a qualitative evaluation to a region of interest.
|
|
2474
2568
|
*
|
|
2475
2569
|
* @param {string} uid - Unique identifier of the region of interest
|
|
2476
|
-
* @param {
|
|
2570
|
+
* @param {Object} item - CODE content item representing a qualitative evaluation
|
|
2477
2571
|
*/
|
|
2478
2572
|
addROIEvaluation (uid, item) {
|
|
2479
2573
|
const meaning = item.ConceptNameCodeSequence[0].CodeMeaning
|
|
@@ -2495,7 +2589,7 @@ class VolumeImageViewer {
|
|
|
2495
2589
|
/**
|
|
2496
2590
|
* Pop the most recently annotated regions of interest.
|
|
2497
2591
|
*
|
|
2498
|
-
* @returns {ROI} Regions of interest.
|
|
2592
|
+
* @returns {roi.ROI} Regions of interest.
|
|
2499
2593
|
*/
|
|
2500
2594
|
popROI () {
|
|
2501
2595
|
console.info('pop ROI')
|
|
@@ -2506,15 +2600,15 @@ class VolumeImageViewer {
|
|
|
2506
2600
|
/**
|
|
2507
2601
|
* Add a regions of interest.
|
|
2508
2602
|
*
|
|
2509
|
-
* @param {ROI} roi - Regions of interest
|
|
2510
|
-
* @param {
|
|
2511
|
-
* @param {
|
|
2512
|
-
*
|
|
2513
|
-
* @param {number} styleOptions.stroke.
|
|
2514
|
-
* @param {
|
|
2603
|
+
* @param {roi.ROI} roi - Regions of interest
|
|
2604
|
+
* @param {Object} [styleOptions] - Style options
|
|
2605
|
+
* @param {Object} [styleOptions.stroke] - Style options for the contour of
|
|
2606
|
+
* the geometry
|
|
2607
|
+
* @param {number[]} styleOptions.stroke.color - RGBA color of the contour
|
|
2608
|
+
* @param {number} styleOptions.stroke.width - Width of the contour
|
|
2609
|
+
* @param {Object} [styleOptions.fill] - Style options for the body of the
|
|
2610
|
+
* geometry
|
|
2515
2611
|
* @param {number[]} styleOptions.fill.color - RGBA color of the body
|
|
2516
|
-
* @param {object} styleOptions.image - Style options for image
|
|
2517
|
-
*
|
|
2518
2612
|
*/
|
|
2519
2613
|
addROI (roi, styleOptions = {}) {
|
|
2520
2614
|
console.info(`add ROI ${roi.uid}`)
|
|
@@ -2550,13 +2644,13 @@ class VolumeImageViewer {
|
|
|
2550
2644
|
/**
|
|
2551
2645
|
* Update properties of a region of interest.
|
|
2552
2646
|
*
|
|
2553
|
-
* @param {
|
|
2647
|
+
* @param {Object} roi - ROI to be updated
|
|
2554
2648
|
* @param {string} roi.uid - Unique identifier of the region of interest
|
|
2555
|
-
* @param {
|
|
2556
|
-
* @param {
|
|
2557
|
-
* @param {
|
|
2558
|
-
* @param {
|
|
2559
|
-
* @param {
|
|
2649
|
+
* @param {Object} roi.properties - ROI properties
|
|
2650
|
+
* @param {Object} [roi.properties.measurements] - ROI measurements
|
|
2651
|
+
* @param {Object} [roi.properties.evaluations] - ROI evaluations
|
|
2652
|
+
* @param {Object} [roi.properties.label] - ROI label
|
|
2653
|
+
* @param {Object} [roi.properties.marker] - ROI marker
|
|
2560
2654
|
*/
|
|
2561
2655
|
updateROI ({ uid, properties = {} }) {
|
|
2562
2656
|
if (!uid) return
|
|
@@ -2574,7 +2668,7 @@ class VolumeImageViewer {
|
|
|
2574
2668
|
*
|
|
2575
2669
|
* @param {string} uid - Unique identifier of the regions of interest
|
|
2576
2670
|
*
|
|
2577
|
-
* @returns {
|
|
2671
|
+
* @returns {Object} - Style settings
|
|
2578
2672
|
*/
|
|
2579
2673
|
getROIStyle (uid) {
|
|
2580
2674
|
const feature = this[_features].getArray().find((feature) => {
|
|
@@ -2601,13 +2695,14 @@ class VolumeImageViewer {
|
|
|
2601
2695
|
* Set the style of a region of interest.
|
|
2602
2696
|
*
|
|
2603
2697
|
* @param {string} uid - Unique identifier of the regions of interest
|
|
2604
|
-
* @param {
|
|
2605
|
-
* @param {
|
|
2606
|
-
*
|
|
2607
|
-
* @param {number} styleOptions.stroke.
|
|
2608
|
-
* @param {
|
|
2698
|
+
* @param {Object} styleOptions - Style options
|
|
2699
|
+
* @param {Object} [styleOptions.stroke] - Style options for the contour of
|
|
2700
|
+
* the geometry
|
|
2701
|
+
* @param {number[]} styleOptions.stroke.color - RGBA color of the contour
|
|
2702
|
+
* @param {number} styleOptions.stroke.width - Width of the contour
|
|
2703
|
+
* @param {Object} [styleOptions.fill] - Style options for the body of the
|
|
2704
|
+
* geometry
|
|
2609
2705
|
* @param {number[]} styleOptions.fill.color - RGBA color of the body
|
|
2610
|
-
*
|
|
2611
2706
|
*/
|
|
2612
2707
|
setROIStyle (uid, styleOptions = {}) {
|
|
2613
2708
|
this[_features].forEach((feature) => {
|
|
@@ -2623,8 +2718,8 @@ class VolumeImageViewer {
|
|
|
2623
2718
|
/**
|
|
2624
2719
|
* Add a new viewport overlay.
|
|
2625
2720
|
*
|
|
2626
|
-
* @param {
|
|
2627
|
-
* @param {
|
|
2721
|
+
* @param {Object} options Overlay options
|
|
2722
|
+
* @param {Object} options.element The custom overlay HTML element
|
|
2628
2723
|
* @param {string} options.className Class to style the overlay container
|
|
2629
2724
|
* @param {number[]} options.offset Horizontal and vertical offset of the overlay container in pixels
|
|
2630
2725
|
*/
|
|
@@ -2697,7 +2792,8 @@ class VolumeImageViewer {
|
|
|
2697
2792
|
/**
|
|
2698
2793
|
* Add annotation groups.
|
|
2699
2794
|
*
|
|
2700
|
-
* @param {MicroscopyBulkSimpleAnnotations} metadata - Metadata of a
|
|
2795
|
+
* @param {metadata.MicroscopyBulkSimpleAnnotations} metadata - Metadata of a
|
|
2796
|
+
* DICOM Microscopy Simple Bulk Annotations instance
|
|
2701
2797
|
*/
|
|
2702
2798
|
addAnnotationGroups (metadata) {
|
|
2703
2799
|
const refImage = this[_pyramid].metadata[0]
|
|
@@ -2772,7 +2868,9 @@ class VolumeImageViewer {
|
|
|
2772
2868
|
|
|
2773
2869
|
const numberOfAnnotations = Number(metadataItem.NumberOfAnnotations)
|
|
2774
2870
|
const graphicType = metadataItem.GraphicType
|
|
2775
|
-
const coordinateDimensionality = _getCoordinateDimensionality(
|
|
2871
|
+
const coordinateDimensionality = _getCoordinateDimensionality(
|
|
2872
|
+
metadataItem
|
|
2873
|
+
)
|
|
2776
2874
|
const commonZCoordinate = _getCommonZCoordinate(metadataItem)
|
|
2777
2875
|
|
|
2778
2876
|
const features = this.getFeatures()
|
|
@@ -2801,10 +2899,12 @@ class VolumeImageViewer {
|
|
|
2801
2899
|
i,
|
|
2802
2900
|
numberOfAnnotations
|
|
2803
2901
|
)
|
|
2902
|
+
const coordinates = _scoord3dCoordinates2geometryCoordinates(
|
|
2903
|
+
point,
|
|
2904
|
+
pyramid
|
|
2905
|
+
)
|
|
2804
2906
|
const feature = new Feature({
|
|
2805
|
-
geometry: new PointGeometry(
|
|
2806
|
-
_scoord3dCoordinates2geometryCoordinates(point, pyramid)
|
|
2807
|
-
)
|
|
2907
|
+
geometry: new PointGeometry(coordinates)
|
|
2808
2908
|
})
|
|
2809
2909
|
const properties = {}
|
|
2810
2910
|
measurements.forEach(item => {
|
|
@@ -2855,7 +2955,7 @@ class VolumeImageViewer {
|
|
|
2855
2955
|
const container = this[_map].getTargetElement()
|
|
2856
2956
|
publish(container, EVENT.LOADING_ENDED)
|
|
2857
2957
|
})
|
|
2858
|
-
source.on('
|
|
2958
|
+
source.on('featuresloaderror', (event) => {
|
|
2859
2959
|
const container = this[_map].getTargetElement()
|
|
2860
2960
|
publish(container, EVENT.LOADING_ENDED)
|
|
2861
2961
|
})
|
|
@@ -2925,7 +3025,7 @@ class VolumeImageViewer {
|
|
|
2925
3025
|
* Show an annotation group.
|
|
2926
3026
|
*
|
|
2927
3027
|
* @param {string} annotationGroupUID - Unique identifier of an annotation group
|
|
2928
|
-
* @param {
|
|
3028
|
+
* @param {Object} styleOptions
|
|
2929
3029
|
* @param {number} styleOptions.measurement - Selected measurement for colorizing annotations
|
|
2930
3030
|
*/
|
|
2931
3031
|
showAnnotationGroup (annotationGroupUID, styleOptions = {}) {
|
|
@@ -2941,112 +3041,6 @@ class VolumeImageViewer {
|
|
|
2941
3041
|
annotationGroup.layer.setVisible(true)
|
|
2942
3042
|
}
|
|
2943
3043
|
|
|
2944
|
-
_retrieveAnnotationGroupBulkdata (annotationGroupUID) {
|
|
2945
|
-
if (!(annotationGroupUID in this[_annotationGroups])) {
|
|
2946
|
-
throw new Error(
|
|
2947
|
-
'Cannot retrieve bulkdata of annotation group. ' +
|
|
2948
|
-
`Could not find annotation group "${annotationGroupUID}".`
|
|
2949
|
-
)
|
|
2950
|
-
}
|
|
2951
|
-
const annotationGroup = this[_annotationGroups][annotationGroupUID]
|
|
2952
|
-
console.log(
|
|
2953
|
-
`retrieve bulkdata for annotation group "${annotationGroupUID}"`
|
|
2954
|
-
)
|
|
2955
|
-
const container = this[_map].getTargetElement()
|
|
2956
|
-
if (container == null) {
|
|
2957
|
-
throw new Error(
|
|
2958
|
-
'Cannot retrieve bulkdata of annotation group. ' +
|
|
2959
|
-
'Viewport has not been rendered. Call render() first.'
|
|
2960
|
-
)
|
|
2961
|
-
}
|
|
2962
|
-
publish(container, EVENT.LOADING_STARTED)
|
|
2963
|
-
|
|
2964
|
-
const index = annotationGroup.annotationGroup.number - 1
|
|
2965
|
-
const metadataItem = annotationGroup.metadata.AnnotationGroupSequence[index]
|
|
2966
|
-
/**
|
|
2967
|
-
* Bulkdata may not be available, since it's possible that all information
|
|
2968
|
-
* has been included into the metadata by value as InlineBinary. It must
|
|
2969
|
-
* only be provided if information has been included by reference as
|
|
2970
|
-
* BulkDataURI.
|
|
2971
|
-
*/
|
|
2972
|
-
const bulkdataReferences = annotationGroup.metadata.bulkdataReferences
|
|
2973
|
-
let bulkdataItem
|
|
2974
|
-
if (bulkdataReferences.AnnotationGroupSequence != null) {
|
|
2975
|
-
bulkdataItem = bulkdataReferences.AnnotationGroupSequence[index]
|
|
2976
|
-
}
|
|
2977
|
-
|
|
2978
|
-
const numberOfAnnotations = Number(metadataItem.NumberOfAnnotations)
|
|
2979
|
-
const graphicType = metadataItem.GraphicType
|
|
2980
|
-
const coordinateDimensionality = _getCoordinateDimensionality(metadataItem)
|
|
2981
|
-
const commonZCoordinate = _getCommonZCoordinate(metadataItem)
|
|
2982
|
-
|
|
2983
|
-
const source = annotationGroup.layer.getSource()
|
|
2984
|
-
const features = source.getFeatures()
|
|
2985
|
-
|
|
2986
|
-
const client = this[_options].client
|
|
2987
|
-
const promises = [
|
|
2988
|
-
_fetchGraphicData({ metadataItem, bulkdataItem, client }),
|
|
2989
|
-
_fetchGraphicIndex({ metadataItem, bulkdataItem, client }),
|
|
2990
|
-
_fetchMeasurements({ metadataItem, bulkdataItem, client })
|
|
2991
|
-
]
|
|
2992
|
-
Promise.all(promises).then(retrievedBulkdata => {
|
|
2993
|
-
const graphicData = retrievedBulkdata[0]
|
|
2994
|
-
const graphicIndex = retrievedBulkdata[1]
|
|
2995
|
-
const measurements = retrievedBulkdata[2]
|
|
2996
|
-
|
|
2997
|
-
for (let i = 0; i < numberOfAnnotations; i++) {
|
|
2998
|
-
const point = _getCentroid(
|
|
2999
|
-
graphicType,
|
|
3000
|
-
graphicData,
|
|
3001
|
-
graphicIndex,
|
|
3002
|
-
coordinateDimensionality,
|
|
3003
|
-
commonZCoordinate,
|
|
3004
|
-
i,
|
|
3005
|
-
numberOfAnnotations
|
|
3006
|
-
)
|
|
3007
|
-
const feature = new Feature({
|
|
3008
|
-
geometry: new PointGeometry(
|
|
3009
|
-
_scoord3dCoordinates2geometryCoordinates(
|
|
3010
|
-
point,
|
|
3011
|
-
this[_pyramid].metadata
|
|
3012
|
-
)
|
|
3013
|
-
)
|
|
3014
|
-
})
|
|
3015
|
-
const properties = {}
|
|
3016
|
-
measurements.forEach(item => {
|
|
3017
|
-
const name = item.name
|
|
3018
|
-
const key = `${name.CodingSchemeDesignator}${name.CodeValue}`
|
|
3019
|
-
const value = item.values[i]
|
|
3020
|
-
properties[key] = value
|
|
3021
|
-
})
|
|
3022
|
-
feature.setProperties(properties)
|
|
3023
|
-
feature.setId(i + 1)
|
|
3024
|
-
features.push(feature)
|
|
3025
|
-
}
|
|
3026
|
-
|
|
3027
|
-
console.log(
|
|
3028
|
-
`add n=${features.length} annotations ` +
|
|
3029
|
-
`for annotation group "${annotationGroupUID}"`
|
|
3030
|
-
)
|
|
3031
|
-
source.addFeatures(features)
|
|
3032
|
-
const properties = {}
|
|
3033
|
-
measurements.forEach(item => {
|
|
3034
|
-
const name = item.name
|
|
3035
|
-
const key = `${name.CodingSchemeDesignator}${name.CodeValue}`
|
|
3036
|
-
const value = quantileSeq(
|
|
3037
|
-
[...item.values],
|
|
3038
|
-
[0, 0.015, 0.25, 0.5, 0.75, 0.95, 1]
|
|
3039
|
-
)
|
|
3040
|
-
properties[key] = value
|
|
3041
|
-
})
|
|
3042
|
-
source.setProperties(properties)
|
|
3043
|
-
publish(container, EVENT.LOADING_ENDED)
|
|
3044
|
-
}).catch(error => {
|
|
3045
|
-
console.error(error)
|
|
3046
|
-
publish(container, EVENT.LOADING_ENDED)
|
|
3047
|
-
})
|
|
3048
|
-
}
|
|
3049
|
-
|
|
3050
3044
|
/**
|
|
3051
3045
|
* Hide an annotation group.
|
|
3052
3046
|
*
|
|
@@ -3084,7 +3078,7 @@ class VolumeImageViewer {
|
|
|
3084
3078
|
* Set style of an annotation group.
|
|
3085
3079
|
*
|
|
3086
3080
|
* @param {string} annotationGroupUID - Unique identifier of an annotation group
|
|
3087
|
-
* @param {
|
|
3081
|
+
* @param {Object} styleOptions - Style options
|
|
3088
3082
|
* @param {number} styleOptions.opacity - Opacity
|
|
3089
3083
|
* @param {number} styleOptions.measurement - Selected measurement for colorizing annotations
|
|
3090
3084
|
*/
|
|
@@ -3179,7 +3173,7 @@ class VolumeImageViewer {
|
|
|
3179
3173
|
*
|
|
3180
3174
|
* @param {string} annotationGroupUID - Unique identifier of an annotation group
|
|
3181
3175
|
*
|
|
3182
|
-
* @returns {
|
|
3176
|
+
* @returns {Object} - Style settings
|
|
3183
3177
|
*/
|
|
3184
3178
|
getAnnotationGroupStyle (annotationGroupUID) {
|
|
3185
3179
|
if (!(annotationGroupUID in this[_annotationGroups])) {
|
|
@@ -3198,7 +3192,7 @@ class VolumeImageViewer {
|
|
|
3198
3192
|
/**
|
|
3199
3193
|
* Get all annotation groups.
|
|
3200
3194
|
*
|
|
3201
|
-
* @returns {AnnotationGroup[]}
|
|
3195
|
+
* @returns {annotation.AnnotationGroup[]}
|
|
3202
3196
|
*/
|
|
3203
3197
|
getAllAnnotationGroups () {
|
|
3204
3198
|
const groups = []
|
|
@@ -3213,7 +3207,8 @@ class VolumeImageViewer {
|
|
|
3213
3207
|
*
|
|
3214
3208
|
* @param {string} annotationGroupUID - Unique identifier of an annotation group
|
|
3215
3209
|
*
|
|
3216
|
-
* @returns {MicroscopyBulkSimpleAnnotations
|
|
3210
|
+
* @returns {metadata.MicroscopyBulkSimpleAnnotations} - Metadata of DICOM
|
|
3211
|
+
* Microscopy Bulk Simple Annotations instance
|
|
3217
3212
|
*/
|
|
3218
3213
|
getAnnotationGroupMetadata (annotationGroupUID) {
|
|
3219
3214
|
if (!(annotationGroupUID in this[_annotationGroups])) {
|
|
@@ -3229,7 +3224,7 @@ class VolumeImageViewer {
|
|
|
3229
3224
|
/**
|
|
3230
3225
|
* Add segments.
|
|
3231
3226
|
*
|
|
3232
|
-
* @param {Segmentation[]} metadata - Metadata of one or more DICOM Segmentation instances
|
|
3227
|
+
* @param {metadata.Segmentation[]} metadata - Metadata of one or more DICOM Segmentation instances
|
|
3233
3228
|
*/
|
|
3234
3229
|
addSegments (metadata) {
|
|
3235
3230
|
if (metadata.length === 0) {
|
|
@@ -3376,7 +3371,7 @@ class VolumeImageViewer {
|
|
|
3376
3371
|
extent: this[_pyramid].extent,
|
|
3377
3372
|
visible: false,
|
|
3378
3373
|
opacity: 0.9,
|
|
3379
|
-
preload: 0,
|
|
3374
|
+
preload: this[_options].preload ? 1 : 0,
|
|
3380
3375
|
transition: 0,
|
|
3381
3376
|
style: _getColorPaletteStyleForTileLayer({
|
|
3382
3377
|
windowCenter,
|
|
@@ -3427,8 +3422,8 @@ class VolumeImageViewer {
|
|
|
3427
3422
|
* Show a segment.
|
|
3428
3423
|
*
|
|
3429
3424
|
* @param {string} segmentUID - Unique tracking identifier of a segment
|
|
3430
|
-
* @param {
|
|
3431
|
-
* @param {number} styleOptions.opacity - Opacity
|
|
3425
|
+
* @param {Object} [styleOptions]
|
|
3426
|
+
* @param {number} [styleOptions.opacity] - Opacity
|
|
3432
3427
|
*/
|
|
3433
3428
|
showSegment (segmentUID, styleOptions = {}) {
|
|
3434
3429
|
if (!(segmentUID in this[_segments])) {
|
|
@@ -3480,8 +3475,8 @@ class VolumeImageViewer {
|
|
|
3480
3475
|
* Set the style of a segment.
|
|
3481
3476
|
*
|
|
3482
3477
|
* @param {string} segmentUID - Unique tracking identifier of segment
|
|
3483
|
-
* @param {
|
|
3484
|
-
* @param {number} styleOptions.opacity - Opacity
|
|
3478
|
+
* @param {Object} styleOptions - Style options
|
|
3479
|
+
* @param {number} [styleOptions.opacity] - Opacity
|
|
3485
3480
|
*/
|
|
3486
3481
|
setSegmentStyle (segmentUID, styleOptions = {}) {
|
|
3487
3482
|
if (!(segmentUID in this[_segments])) {
|
|
@@ -3544,7 +3539,8 @@ class VolumeImageViewer {
|
|
|
3544
3539
|
* Get the style of a segment.
|
|
3545
3540
|
*
|
|
3546
3541
|
* @param {string} segmentUID - Unique tracking identifier of segment
|
|
3547
|
-
*
|
|
3542
|
+
*
|
|
3543
|
+
* @returns {Object} Style settings
|
|
3548
3544
|
*/
|
|
3549
3545
|
getSegmentStyle (segmentUID) {
|
|
3550
3546
|
if (!(segmentUID in this[_segments])) {
|
|
@@ -3565,7 +3561,8 @@ class VolumeImageViewer {
|
|
|
3565
3561
|
* Get image metadata for a segment.
|
|
3566
3562
|
*
|
|
3567
3563
|
* @param {string} segmentUID - Unique tracking identifier of segment
|
|
3568
|
-
*
|
|
3564
|
+
*
|
|
3565
|
+
* @returns {metadata.Segmentation[]} Metadata of DICOM Segmentation instances
|
|
3569
3566
|
*/
|
|
3570
3567
|
getSegmentMetadata (segmentUID) {
|
|
3571
3568
|
if (!(segmentUID in this[_segments])) {
|
|
@@ -3581,7 +3578,7 @@ class VolumeImageViewer {
|
|
|
3581
3578
|
/**
|
|
3582
3579
|
* Get all segments.
|
|
3583
3580
|
*
|
|
3584
|
-
* @return {Segment[]}
|
|
3581
|
+
* @return {segment.Segment[]}
|
|
3585
3582
|
*/
|
|
3586
3583
|
getAllSegments () {
|
|
3587
3584
|
const segments = []
|
|
@@ -3594,7 +3591,7 @@ class VolumeImageViewer {
|
|
|
3594
3591
|
/**
|
|
3595
3592
|
* Add parameter mappings.
|
|
3596
3593
|
*
|
|
3597
|
-
* @param {ParametricMap[]} metadata - Metadata of one or more DICOM Parametric Map instances
|
|
3594
|
+
* @param {metadata.ParametricMap[]} metadata - Metadata of one or more DICOM Parametric Map instances
|
|
3598
3595
|
*/
|
|
3599
3596
|
addParameterMappings (metadata) {
|
|
3600
3597
|
if (metadata.length === 0) {
|
|
@@ -3805,7 +3802,7 @@ class VolumeImageViewer {
|
|
|
3805
3802
|
projection: this[_projection],
|
|
3806
3803
|
visible: false,
|
|
3807
3804
|
opacity: 1,
|
|
3808
|
-
preload: 1,
|
|
3805
|
+
preload: this[_options].preload ? 1 : 0,
|
|
3809
3806
|
transition: 0,
|
|
3810
3807
|
style: _getColorPaletteStyleForTileLayer({
|
|
3811
3808
|
windowCenter,
|
|
@@ -3855,9 +3852,9 @@ class VolumeImageViewer {
|
|
|
3855
3852
|
* Show a parameter mapping.
|
|
3856
3853
|
*
|
|
3857
3854
|
* @param {string} mappingUID - Unique tracking identifier of a mapping
|
|
3858
|
-
* @param {
|
|
3859
|
-
* @param {number} styleOptions.opacity - Opacity
|
|
3860
|
-
* @param {number} styleOptions.limitValues -
|
|
3855
|
+
* @param {Object} [styleOptions]
|
|
3856
|
+
* @param {number} [styleOptions.opacity] - Opacity
|
|
3857
|
+
* @param {number[]} [styleOptions.limitValues] - Upper and lower windowing
|
|
3861
3858
|
*/
|
|
3862
3859
|
showParameterMapping (mappingUID, styleOptions = {}) {
|
|
3863
3860
|
if (!(mappingUID in this[_mappings])) {
|
|
@@ -3909,8 +3906,9 @@ class VolumeImageViewer {
|
|
|
3909
3906
|
* Set the style of a parameter mapping.
|
|
3910
3907
|
*
|
|
3911
3908
|
* @param {string} mappingUID - Unique tracking identifier of mapping
|
|
3912
|
-
* @param {
|
|
3913
|
-
* @param {number} styleOptions.opacity - Opacity
|
|
3909
|
+
* @param {Object} styleOptions
|
|
3910
|
+
* @param {number} [styleOptions.opacity] - Opacity
|
|
3911
|
+
* @param {number[]} [styleOptions.limitValues] - Upper and lower windowing
|
|
3914
3912
|
*/
|
|
3915
3913
|
setParameterMappingStyle (mappingUID, styleOptions = {}) {
|
|
3916
3914
|
if (!(mappingUID in this[_mappings])) {
|
|
@@ -3989,7 +3987,7 @@ class VolumeImageViewer {
|
|
|
3989
3987
|
* Get the style of a parameter mapping.
|
|
3990
3988
|
*
|
|
3991
3989
|
* @param {string} mappingUID - Unique tracking identifier of mapping
|
|
3992
|
-
* @returns {
|
|
3990
|
+
* @returns {Object} Style Options
|
|
3993
3991
|
*/
|
|
3994
3992
|
getParameterMappingStyle (mappingUID) {
|
|
3995
3993
|
if (!(mappingUID in this[_mappings])) {
|
|
@@ -4011,7 +4009,9 @@ class VolumeImageViewer {
|
|
|
4011
4009
|
* Get image metadata for a parameter mapping.
|
|
4012
4010
|
*
|
|
4013
4011
|
* @param {string} mappingUID - Unique tracking identifier of mapping
|
|
4014
|
-
*
|
|
4012
|
+
*
|
|
4013
|
+
* @returns {metadata.ParametricMap[]} Metadata of DICOM Parametric Map
|
|
4014
|
+
* instances
|
|
4015
4015
|
*/
|
|
4016
4016
|
getParameterMappingMetadata (mappingUID) {
|
|
4017
4017
|
if (!(mappingUID in this[_mappings])) {
|
|
@@ -4027,7 +4027,7 @@ class VolumeImageViewer {
|
|
|
4027
4027
|
/**
|
|
4028
4028
|
* Get all parameter mappings.
|
|
4029
4029
|
*
|
|
4030
|
-
* @return {ParameterMapping[]}
|
|
4030
|
+
* @return {mapping.ParameterMapping[]}
|
|
4031
4031
|
*/
|
|
4032
4032
|
getAllParameterMappings () {
|
|
4033
4033
|
const mappings = []
|
|
@@ -4043,18 +4043,22 @@ class VolumeImageViewer {
|
|
|
4043
4043
|
* with Image Type other than VOLUME.
|
|
4044
4044
|
*
|
|
4045
4045
|
* @class
|
|
4046
|
+
* @abstract
|
|
4046
4047
|
* @private
|
|
4047
4048
|
*/
|
|
4048
4049
|
class _NonVolumeImageViewer {
|
|
4049
4050
|
/**
|
|
4050
|
-
*
|
|
4051
|
-
*
|
|
4052
|
-
*
|
|
4053
|
-
* @param {
|
|
4054
|
-
*
|
|
4055
|
-
* @param {string} options.orientation - Orientation of the slide (vertical:
|
|
4056
|
-
*
|
|
4057
|
-
* @param {
|
|
4051
|
+
* @param {Object} options
|
|
4052
|
+
* @param {Object} options.client - A DICOMwebClient instance for interacting
|
|
4053
|
+
* with an origin server over HTTP.
|
|
4054
|
+
* @param {metadata.VLWholeSlideMicroscopyImage[]} options.metadata -
|
|
4055
|
+
* Metadata of DICOM VL Whole Slide Microscopy Image instances
|
|
4056
|
+
* @param {string} options.orientation - Orientation of the slide (vertical:
|
|
4057
|
+
* label on top, or horizontal: label on right side).
|
|
4058
|
+
* @param {number} [options.resizeFactor=1] - To which extent image should be
|
|
4059
|
+
* reduced in size (fraction).
|
|
4060
|
+
* @param {boolean} [options.includeIccProfile=false] - Whether ICC Profile
|
|
4061
|
+
* should be included for correction of image colors.
|
|
4058
4062
|
*/
|
|
4059
4063
|
constructor (options) {
|
|
4060
4064
|
// We also accept metadata in raw JSON format for backwards compatibility
|
|
@@ -4168,7 +4172,7 @@ class _NonVolumeImageViewer {
|
|
|
4168
4172
|
/**
|
|
4169
4173
|
* Render the image in the specified viewport container.
|
|
4170
4174
|
*
|
|
4171
|
-
* @param {
|
|
4175
|
+
* @param {Object} options - Rendering options.
|
|
4172
4176
|
* @param {(string|HTMLElement)} options.container - HTML Element in which the viewer should be injected.
|
|
4173
4177
|
*/
|
|
4174
4178
|
render (options) {
|
|
@@ -4226,15 +4230,18 @@ class _NonVolumeImageViewer {
|
|
|
4226
4230
|
* @memberof viewer
|
|
4227
4231
|
*/
|
|
4228
4232
|
class OverviewImageViewer extends _NonVolumeImageViewer {
|
|
4229
|
-
/**
|
|
4230
|
-
*
|
|
4231
|
-
*
|
|
4232
|
-
*
|
|
4233
|
-
* @param {
|
|
4234
|
-
*
|
|
4235
|
-
* @param {string} [options.orientation='horizontal'] - Orientation of the
|
|
4236
|
-
*
|
|
4237
|
-
* @param {
|
|
4233
|
+
/**
|
|
4234
|
+
* @param {Object} options
|
|
4235
|
+
* @param {Object} options.client - A DICOMwebClient instance for interacting
|
|
4236
|
+
* with an origin server over HTTP.
|
|
4237
|
+
* @param {metadata.VLWholeSlideMicroscopyImage[]} options.metadata -
|
|
4238
|
+
* Metadata of DICOM VL Whole Slide Microscopy Image instances
|
|
4239
|
+
* @param {string} [options.orientation='horizontal'] - Orientation of the
|
|
4240
|
+
* slide (vertical: label on top, or horizontal: label on right side).
|
|
4241
|
+
* @param {number} [options.resizeFactor=1] - To which extent image should be
|
|
4242
|
+
* reduced in size (fraction).
|
|
4243
|
+
* @param {boolean} [options.includeIccProfile=false] - Whether ICC Profile
|
|
4244
|
+
* should be included for correction of image colors.
|
|
4238
4245
|
*/
|
|
4239
4246
|
constructor (options) {
|
|
4240
4247
|
if (options.orientation === undefined) {
|
|
@@ -4252,15 +4259,17 @@ class OverviewImageViewer extends _NonVolumeImageViewer {
|
|
|
4252
4259
|
* @memberof viewer
|
|
4253
4260
|
*/
|
|
4254
4261
|
class LabelImageViewer extends _NonVolumeImageViewer {
|
|
4255
|
-
/**
|
|
4256
|
-
*
|
|
4257
|
-
*
|
|
4258
|
-
* @param {
|
|
4259
|
-
*
|
|
4260
|
-
* @param {
|
|
4261
|
-
*
|
|
4262
|
-
* @param {number} [options.resizeFactor=1] - To which extent image should be
|
|
4263
|
-
*
|
|
4262
|
+
/**
|
|
4263
|
+
* @param {Object} options - Options
|
|
4264
|
+
* @param {Object} options.client - A DICOMwebClient instance for interacting with an origin server over HTTP
|
|
4265
|
+
* @param {metadata.VLWholeSlideMicroscopyImage[]} options.metadata -
|
|
4266
|
+
* Metadata of DICOM VL Whole Slide Microscopy Image instances
|
|
4267
|
+
* @param {string} [options.orientation='vertical'] - Orientation of the
|
|
4268
|
+
* slide (vertical: label on top, or horizontal: label on right side)
|
|
4269
|
+
* @param {number} [options.resizeFactor=1] - To which extent image should be
|
|
4270
|
+
* reduced in size (fraction)
|
|
4271
|
+
* @param {boolean} [options.includeIccProfile=false] - Whether ICC Profile
|
|
4272
|
+
* should be included for correction of image colors
|
|
4264
4273
|
*/
|
|
4265
4274
|
constructor (options) {
|
|
4266
4275
|
if (options.orientation === undefined) {
|
|
@@ -4281,13 +4290,13 @@ export { LabelImageViewer, OverviewImageViewer, VolumeImageViewer }
|
|
|
4281
4290
|
</div>
|
|
4282
4291
|
|
|
4283
4292
|
<nav>
|
|
4284
|
-
<h2><a href="index.html">Home</a></h2><h3>Namespaces</h3><ul><li><a href="annotation.html">annotation</a></li><li><a href="api.html">api</a></li><li><a href="color.html">color</a></li><li><a href="events.html">events</a></li><li><a href="mapping.html">mapping</a></li><li><a href="metadata.html">metadata</a></li><li><a href="opticalPath.html">opticalPath</a></li><li><a href="roi.html">roi</a></li><li><a href="scoord3d.html">scoord3d</a></li><li><a href="segment.html">segment</a></li><li><a href="utils.html">utils</a></li><li><a href="viewer.html">viewer</a></li></ul><h3>Classes</h3><ul><li><a href="annotation.AnnotationGroup.html">AnnotationGroup</a></li><li><a href="color.PaletteColorLookupTable.html">PaletteColorLookupTable</a></li><li><a href="mapping.ParameterMapping.html">ParameterMapping</a></li><li><a href="mapping.Transformation.html">Transformation</a></li><li><a href="metadata.Comprehensive3DSR.html">Comprehensive3DSR</a></li><li><a href="metadata.MicroscopyBulkSimpleAnnotations.html">MicroscopyBulkSimpleAnnotations</a></li><li><a href="metadata.ParametricMap.html">ParametricMap</a></li><li><a href="metadata.Segmentation.html">Segmentation</a></li><li><a href="metadata.VLWholeSlideMicroscopyImage.html">VLWholeSlideMicroscopyImage</a></li><li><a href="opticalPath.OpticalPath.html">OpticalPath</a></li><li><a href="roi.ROI.html">ROI</a></li><li><a href="scoord3d.Ellipse.html">Ellipse</a></li><li><a href="scoord3d.Ellipsoid.html">Ellipsoid</a></li><li><a href="scoord3d.Multipoint.html">Multipoint</a></li><li><a href="scoord3d.Point.html">Point</a></li><li><a href="scoord3d.Polygon.html">Polygon</a></li><li><a href="scoord3d.Polyline.html">Polyline</a></li><li><a href="segment.Segment.html">Segment</a></li><li><a href="viewer.LabelImageViewer.html">LabelImageViewer</a></li><li><a href="viewer.OverviewImageViewer.html">OverviewImageViewer</a></li><li><a href="viewer.VolumeImageViewer.html">VolumeImageViewer</a></li></ul>
|
|
4293
|
+
<h2><a href="index.html">Home</a></h2><h3>Namespaces</h3><ul><li><a href="annotation.html">annotation</a></li><li><a href="api.html">api</a></li><li><a href="color.html">color</a></li><li><a href="events.html">events</a></li><li><a href="mapping.html">mapping</a></li><li><a href="metadata.html">metadata</a></li><li><a href="opticalPath.html">opticalPath</a></li><li><a href="roi.html">roi</a></li><li><a href="scoord3d.html">scoord3d</a></li><li><a href="segment.html">segment</a></li><li><a href="utils.html">utils</a></li><li><a href="viewer.html">viewer</a></li></ul><h3>Classes</h3><ul><li><a href="annotation.AnnotationGroup.html">AnnotationGroup</a></li><li><a href="color.PaletteColorLookupTable.html">PaletteColorLookupTable</a></li><li><a href="mapping.ParameterMapping.html">ParameterMapping</a></li><li><a href="mapping.Transformation.html">Transformation</a></li><li><a href="metadata.Comprehensive3DSR.html">Comprehensive3DSR</a></li><li><a href="metadata.MicroscopyBulkSimpleAnnotations.html">MicroscopyBulkSimpleAnnotations</a></li><li><a href="metadata.ParametricMap.html">ParametricMap</a></li><li><a href="metadata.Segmentation.html">Segmentation</a></li><li><a href="metadata.SOPClass.html">SOPClass</a></li><li><a href="metadata.VLWholeSlideMicroscopyImage.html">VLWholeSlideMicroscopyImage</a></li><li><a href="opticalPath.OpticalPath.html">OpticalPath</a></li><li><a href="roi.ROI.html">ROI</a></li><li><a href="scoord3d.Ellipse.html">Ellipse</a></li><li><a href="scoord3d.Ellipsoid.html">Ellipsoid</a></li><li><a href="scoord3d.Multipoint.html">Multipoint</a></li><li><a href="scoord3d.Point.html">Point</a></li><li><a href="scoord3d.Polygon.html">Polygon</a></li><li><a href="scoord3d.Polyline.html">Polyline</a></li><li><a href="scoord3d.Scoord3D.html">Scoord3D</a></li><li><a href="segment.Segment.html">Segment</a></li><li><a href="viewer.LabelImageViewer.html">LabelImageViewer</a></li><li><a href="viewer.OverviewImageViewer.html">OverviewImageViewer</a></li><li><a href="viewer.VolumeImageViewer.html">VolumeImageViewer</a></li></ul>
|
|
4285
4294
|
</nav>
|
|
4286
4295
|
|
|
4287
4296
|
<br class="clear">
|
|
4288
4297
|
|
|
4289
4298
|
<footer>
|
|
4290
|
-
Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.10</a> on
|
|
4299
|
+
Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.10</a> on Mon May 16 2022 08:28:05 GMT-0400 (Eastern Daylight Time)
|
|
4291
4300
|
</footer>
|
|
4292
4301
|
|
|
4293
4302
|
<script> prettyPrint(); </script>
|