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/src/viewer.js
CHANGED
|
@@ -286,7 +286,8 @@ function _getInteractionBindingCondition (bindings) {
|
|
|
286
286
|
* slide coordinate system (X, Y, Z), i.e. it express in which direction one
|
|
287
287
|
* is moving in the slide coordinate system when the ROW index changes.
|
|
288
288
|
*
|
|
289
|
-
* @param {
|
|
289
|
+
* @param {metadata.VLWholeSlideMicroscopyImage} metadata - Metadata of a DICOM
|
|
290
|
+
* VL Whole Slide Microscopy Image instance
|
|
290
291
|
*
|
|
291
292
|
* @returns {number} Rotation in radians
|
|
292
293
|
*
|
|
@@ -339,13 +340,13 @@ function _getWindowSize () {
|
|
|
339
340
|
/**
|
|
340
341
|
* Map style options to OpenLayers style.
|
|
341
342
|
*
|
|
342
|
-
* @param {
|
|
343
|
-
* @param {
|
|
343
|
+
* @param {Object} styleOptions - Style options
|
|
344
|
+
* @param {Object} styleOptions.stroke - Style options for the outline of the geometry
|
|
344
345
|
* @param {number[]} styleOptions.stroke.color - RGBA color of the outline
|
|
345
346
|
* @param {number} styleOptions.stroke.width - Width of the outline
|
|
346
|
-
* @param {
|
|
347
|
+
* @param {Object} styleOptions.fill - Style options for body the geometry
|
|
347
348
|
* @param {number[]} styleOptions.fill.color - RGBA color of the body
|
|
348
|
-
* @param {
|
|
349
|
+
* @param {Object} styleOptions.image - Style options for image
|
|
349
350
|
* @return {Style} OpenLayers style
|
|
350
351
|
*
|
|
351
352
|
* @private
|
|
@@ -395,12 +396,12 @@ function _getOpenLayersStyle (styleOptions) {
|
|
|
395
396
|
/**
|
|
396
397
|
* Add ROI properties to feature in a safe way
|
|
397
398
|
*
|
|
398
|
-
* @param {
|
|
399
|
-
* @param {
|
|
400
|
-
* @param {
|
|
401
|
-
* @param {
|
|
402
|
-
* @param {
|
|
403
|
-
* @param {
|
|
399
|
+
* @param {Object} feature - The feature instance that represents the ROI
|
|
400
|
+
* @param {Object} properties -Valid ROI properties
|
|
401
|
+
* @param {Object} properties.measurements - ROI measurements
|
|
402
|
+
* @param {Object} properties.evaluations - ROI evaluations
|
|
403
|
+
* @param {Object} properties.label - ROI label
|
|
404
|
+
* @param {Object} properties.marker - ROI marker (this is used while we don't have presentation states)
|
|
404
405
|
* @param {boolean} optSilent - Opt silent update
|
|
405
406
|
*
|
|
406
407
|
* @private
|
|
@@ -429,9 +430,9 @@ function _addROIPropertiesToFeature (feature, properties, optSilent) {
|
|
|
429
430
|
* Wire measurements and qualitative evaluations to generate content items
|
|
430
431
|
* based on OpenLayers feature properties and geometry.
|
|
431
432
|
*
|
|
432
|
-
* @param {
|
|
433
|
-
* @param {
|
|
434
|
-
* @param {
|
|
433
|
+
* @param {Object} map - The map instance
|
|
434
|
+
* @param {Object} feature - The feature instance
|
|
435
|
+
* @param {Object} pyramid - The pyramid metadata
|
|
435
436
|
* @returns {void}
|
|
436
437
|
*
|
|
437
438
|
* @private
|
|
@@ -498,9 +499,9 @@ function _updateFeatureEvaluations (feature) {
|
|
|
498
499
|
/**
|
|
499
500
|
* Generate feature measurements from its measurement properties
|
|
500
501
|
*
|
|
501
|
-
* @param {
|
|
502
|
-
* @param {
|
|
503
|
-
* @param {
|
|
502
|
+
* @param {Object} map - The map instance
|
|
503
|
+
* @param {Object} feature - The feature instance
|
|
504
|
+
* @param {Object} pyramid - The pyramid metadata
|
|
504
505
|
* @returns {void}
|
|
505
506
|
*
|
|
506
507
|
* @private
|
|
@@ -592,13 +593,13 @@ function _updateFeatureMeasurements (map, feature, pyramid) {
|
|
|
592
593
|
/**
|
|
593
594
|
* Updates the style of a feature.
|
|
594
595
|
*
|
|
595
|
-
* @param {
|
|
596
|
-
* @param {
|
|
596
|
+
* @param {Object} styleOptions - Style options
|
|
597
|
+
* @param {Object} styleOptions.stroke - Style options for the outline of the geometry
|
|
597
598
|
* @param {number[]} styleOptions.stroke.color - RGBA color of the outline
|
|
598
599
|
* @param {number} styleOptions.stroke.width - Width of the outline
|
|
599
|
-
* @param {
|
|
600
|
+
* @param {Object} styleOptions.fill - Style options for body the geometry
|
|
600
601
|
* @param {number[]} styleOptions.fill.color - RGBA color of the body
|
|
601
|
-
* @param {
|
|
602
|
+
* @param {Object} styleOptions.image - Style options for image
|
|
602
603
|
*
|
|
603
604
|
* @private
|
|
604
605
|
*/
|
|
@@ -619,12 +620,12 @@ function _setFeatureStyle (feature, styleOptions) {
|
|
|
619
620
|
/**
|
|
620
621
|
* Build OpenLayers style expression for coloring a WebGL TileLayer.
|
|
621
622
|
*
|
|
622
|
-
* @param {
|
|
623
|
+
* @param {Object} styleOptions - Style options
|
|
623
624
|
* @param {number} styleOptions.windowCenter - Center of the window used for contrast stretching
|
|
624
625
|
* @param {number} styleOptions.windowWidth - Width of the window used for contrast stretching
|
|
625
626
|
* @param {number[][]} styleOptions.colormap - RGB color triplets
|
|
626
627
|
*
|
|
627
|
-
* @returns {
|
|
628
|
+
* @returns {Object} color style expression and corresponding variables
|
|
628
629
|
*
|
|
629
630
|
* @private
|
|
630
631
|
*/
|
|
@@ -693,16 +694,70 @@ function _getColorPaletteStyleForTileLayer ({
|
|
|
693
694
|
return { color: expression, variables }
|
|
694
695
|
}
|
|
695
696
|
|
|
697
|
+
/**
|
|
698
|
+
* Build OpenLayers style expression for coloring a WebGL TileLayer.
|
|
699
|
+
*
|
|
700
|
+
* @param {Object} styleOptions - Style options
|
|
701
|
+
* @param {number} styleOptions.windowCenter - Center of the window used for contrast stretching
|
|
702
|
+
* @param {number} styleOptions.windowWidth - Width of the window used for contrast stretching
|
|
703
|
+
* @param {number[]} styleOptions.color - RGB color triplet
|
|
704
|
+
*
|
|
705
|
+
* @returns {Object} color style expression and corresponding variables
|
|
706
|
+
*
|
|
707
|
+
* @private
|
|
708
|
+
*/
|
|
709
|
+
function _getColorInterpolationStyleForTileLayer ({
|
|
710
|
+
windowCenter,
|
|
711
|
+
windowWidth,
|
|
712
|
+
color
|
|
713
|
+
}) {
|
|
714
|
+
/*
|
|
715
|
+
* If no Palette Color Lookup Table is available, don't create one
|
|
716
|
+
* but let WebGL interpolate colors for improved performance.
|
|
717
|
+
*/
|
|
718
|
+
const expression = [
|
|
719
|
+
'interpolate',
|
|
720
|
+
['linear'],
|
|
721
|
+
[
|
|
722
|
+
'+',
|
|
723
|
+
[
|
|
724
|
+
'/',
|
|
725
|
+
[
|
|
726
|
+
'-',
|
|
727
|
+
['band', 1],
|
|
728
|
+
['var', 'windowCenter']
|
|
729
|
+
],
|
|
730
|
+
['var', 'windowWidth']
|
|
731
|
+
],
|
|
732
|
+
0.5
|
|
733
|
+
],
|
|
734
|
+
0,
|
|
735
|
+
[0, 0, 0, 1],
|
|
736
|
+
1,
|
|
737
|
+
['color', ['var', 'red'], ['var', 'green'], ['var', 'blue'], 1]
|
|
738
|
+
]
|
|
739
|
+
|
|
740
|
+
const variables = {
|
|
741
|
+
red: color[0],
|
|
742
|
+
green: color[1],
|
|
743
|
+
blue: color[2],
|
|
744
|
+
windowCenter,
|
|
745
|
+
windowWidth
|
|
746
|
+
}
|
|
747
|
+
|
|
748
|
+
return { color: expression, variables }
|
|
749
|
+
}
|
|
750
|
+
|
|
696
751
|
/**
|
|
697
752
|
* Build OpenLayers style expression for coloring a WebGL PointLayer.
|
|
698
753
|
*
|
|
699
|
-
* @param {
|
|
754
|
+
* @param {Object} styleOptions - Style options
|
|
700
755
|
* @param {string} styleOptions.name - Name of a property for which values should be colorized
|
|
701
756
|
* @param {number} styleOptions.minValue - Mininum value of the output range
|
|
702
757
|
* @param {number} styleOptions.maxValue - Maxinum value of the output range
|
|
703
758
|
* @param {number[][]} styleOptions.colormap - RGB color triplets
|
|
704
759
|
*
|
|
705
|
-
* @returns {
|
|
760
|
+
* @returns {Object} color style expression
|
|
706
761
|
*
|
|
707
762
|
* @private
|
|
708
763
|
*/
|
|
@@ -790,28 +845,38 @@ class VolumeImageViewer {
|
|
|
790
845
|
/**
|
|
791
846
|
* Create a viewer instance for displaying VOLUME images.
|
|
792
847
|
*
|
|
793
|
-
* @param {
|
|
794
|
-
* @param {
|
|
795
|
-
*
|
|
796
|
-
*
|
|
797
|
-
*
|
|
798
|
-
*
|
|
799
|
-
* @param {
|
|
800
|
-
*
|
|
848
|
+
* @param {Object} options
|
|
849
|
+
* @param {Object} options.client - A DICOMwebClient instance for interacting
|
|
850
|
+
* with an origin server over HTTP
|
|
851
|
+
* @param {metadata.VLWholeSlideMicroscopyImage[]} options.metadata -
|
|
852
|
+
* Metadata of DICOM VL Whole Slide Microscopy Image instances that should be
|
|
853
|
+
* diplayed.
|
|
854
|
+
* @param {number} [options.preload=0] - Number of resolution levels that should
|
|
855
|
+
* be preloaded
|
|
856
|
+
* @param {string[]} [options.controls=[]] - Names of viewer control elements
|
|
857
|
+
* that should be included in the viewport
|
|
858
|
+
* @param {boolean} [options.debug=false] - Whether debug features should be
|
|
859
|
+
* turned on (e.g., display of tile boundaries)
|
|
860
|
+
* @param {number} [options.tilesCacheSize=1000] - Number of tiles that should
|
|
861
|
+
* be cached to avoid repeated retrieval for the DICOMweb server
|
|
801
862
|
*/
|
|
802
863
|
constructor (options) {
|
|
803
864
|
this[_options] = options
|
|
804
865
|
|
|
805
866
|
if (this[_options].debug == null) {
|
|
806
867
|
this[_options].debug = false
|
|
868
|
+
} else {
|
|
869
|
+
this[_options].debug = true
|
|
807
870
|
}
|
|
808
871
|
|
|
809
|
-
if (this[_options].
|
|
810
|
-
this[_options].
|
|
872
|
+
if (this[_options].preload == null) {
|
|
873
|
+
this[_options].preload = false
|
|
874
|
+
} else {
|
|
875
|
+
this[_options].preload = true
|
|
811
876
|
}
|
|
812
877
|
|
|
813
|
-
if (this[_options].
|
|
814
|
-
this[_options].
|
|
878
|
+
if (this[_options].tilesCacheSize == null) {
|
|
879
|
+
this[_options].tilesCacheSize = 1000
|
|
815
880
|
}
|
|
816
881
|
|
|
817
882
|
if (this[_options].controls == null) {
|
|
@@ -1049,7 +1114,6 @@ class VolumeImageViewer {
|
|
|
1049
1114
|
paletteColorLookupTable: paletteColorLookupTable
|
|
1050
1115
|
},
|
|
1051
1116
|
bitsAllocated: bitsAllocated,
|
|
1052
|
-
isColorable: paletteColorLookupTableUID == null,
|
|
1053
1117
|
minStoredValue,
|
|
1054
1118
|
maxStoredValue,
|
|
1055
1119
|
loaderParams: {
|
|
@@ -1105,46 +1169,17 @@ class VolumeImageViewer {
|
|
|
1105
1169
|
colormap: opticalPath.style.paletteColorLookupTable.data
|
|
1106
1170
|
})
|
|
1107
1171
|
} else {
|
|
1108
|
-
|
|
1109
|
-
|
|
1110
|
-
|
|
1111
|
-
|
|
1112
|
-
|
|
1113
|
-
color: [
|
|
1114
|
-
'interpolate',
|
|
1115
|
-
['linear'],
|
|
1116
|
-
[
|
|
1117
|
-
'+',
|
|
1118
|
-
[
|
|
1119
|
-
'/',
|
|
1120
|
-
[
|
|
1121
|
-
'-',
|
|
1122
|
-
['band', 1],
|
|
1123
|
-
['var', 'windowCenter']
|
|
1124
|
-
],
|
|
1125
|
-
['var', 'windowWidth']
|
|
1126
|
-
],
|
|
1127
|
-
0.5
|
|
1128
|
-
],
|
|
1129
|
-
0,
|
|
1130
|
-
[0, 0, 0, 1],
|
|
1131
|
-
1,
|
|
1132
|
-
['color', ['var', 'red'], ['var', 'green'], ['var', 'blue'], 1]
|
|
1133
|
-
],
|
|
1134
|
-
variables: {
|
|
1135
|
-
red: opticalPath.style.color[0],
|
|
1136
|
-
green: opticalPath.style.color[1],
|
|
1137
|
-
blue: opticalPath.style.color[2],
|
|
1138
|
-
windowCenter,
|
|
1139
|
-
windowWidth
|
|
1140
|
-
}
|
|
1141
|
-
}
|
|
1172
|
+
style = _getColorInterpolationStyleForTileLayer({
|
|
1173
|
+
windowCenter,
|
|
1174
|
+
windowWidth,
|
|
1175
|
+
color: opticalPath.style.color
|
|
1176
|
+
})
|
|
1142
1177
|
}
|
|
1143
1178
|
|
|
1144
1179
|
opticalPath.layer = new TileLayer({
|
|
1145
1180
|
source,
|
|
1146
1181
|
extent: pyramid.extent,
|
|
1147
|
-
preload: 1,
|
|
1182
|
+
preload: this[_options].preload ? 1 : 0,
|
|
1148
1183
|
style: style,
|
|
1149
1184
|
visible: false,
|
|
1150
1185
|
useInterimTilesOnError: false,
|
|
@@ -1226,7 +1261,6 @@ class VolumeImageViewer {
|
|
|
1226
1261
|
projection: this[_projection],
|
|
1227
1262
|
wrapX: false,
|
|
1228
1263
|
transition: 0,
|
|
1229
|
-
preload: 1,
|
|
1230
1264
|
bandCount: 3
|
|
1231
1265
|
})
|
|
1232
1266
|
source.on('tileloaderror', (event) => {
|
|
@@ -1247,7 +1281,7 @@ class VolumeImageViewer {
|
|
|
1247
1281
|
opticalPath.layer = new TileLayer({
|
|
1248
1282
|
source,
|
|
1249
1283
|
extent: this[_tileGrid].extent,
|
|
1250
|
-
preload: 1,
|
|
1284
|
+
preload: this[_options].preload ? 1 : 0,
|
|
1251
1285
|
useInterimTilesOnError: false,
|
|
1252
1286
|
cacheSize: this[_options].tilesCacheSize
|
|
1253
1287
|
})
|
|
@@ -1287,24 +1321,28 @@ class VolumeImageViewer {
|
|
|
1287
1321
|
layers.push(tileDebugLayer)
|
|
1288
1322
|
}
|
|
1289
1323
|
|
|
1290
|
-
|
|
1291
|
-
|
|
1292
|
-
|
|
1293
|
-
|
|
1294
|
-
|
|
1295
|
-
|
|
1296
|
-
|
|
1297
|
-
|
|
1298
|
-
|
|
1299
|
-
|
|
1324
|
+
if (Math.max(...this[_pyramid].gridSizes[0]) <= 10) {
|
|
1325
|
+
const overviewView = new View({
|
|
1326
|
+
projection: this[_projection],
|
|
1327
|
+
rotation: this[_rotation],
|
|
1328
|
+
constrainOnlyCenter: false,
|
|
1329
|
+
smoothExtentConstraint: true,
|
|
1330
|
+
smoothResolutionConstraint: true,
|
|
1331
|
+
minZoom: 0,
|
|
1332
|
+
maxZoom: 0,
|
|
1333
|
+
extent: this[_pyramid].extent
|
|
1334
|
+
})
|
|
1300
1335
|
|
|
1301
|
-
|
|
1302
|
-
|
|
1303
|
-
|
|
1304
|
-
|
|
1305
|
-
|
|
1306
|
-
|
|
1307
|
-
|
|
1336
|
+
this[_overviewMap] = new OverviewMap({
|
|
1337
|
+
view: overviewView,
|
|
1338
|
+
layers: overviewLayers,
|
|
1339
|
+
collapsed: false,
|
|
1340
|
+
collapsible: true,
|
|
1341
|
+
rotateWithView: true
|
|
1342
|
+
})
|
|
1343
|
+
} else {
|
|
1344
|
+
this[_overviewMap] = null
|
|
1345
|
+
}
|
|
1308
1346
|
|
|
1309
1347
|
this[_drawingSource] = new VectorSource({
|
|
1310
1348
|
tileGrid: this[_tileGrid],
|
|
@@ -1345,6 +1383,7 @@ class VolumeImageViewer {
|
|
|
1345
1383
|
* We need to reuse them here to avoid duplications.
|
|
1346
1384
|
* Enabling or disabling interactions could cause side effects on
|
|
1347
1385
|
* OverviewMap since it also uses the same interactions in the map
|
|
1386
|
+
* @private
|
|
1348
1387
|
*/
|
|
1349
1388
|
this[_interactions] = {
|
|
1350
1389
|
draw: undefined,
|
|
@@ -1374,7 +1413,9 @@ class VolumeImageViewer {
|
|
|
1374
1413
|
}
|
|
1375
1414
|
|
|
1376
1415
|
if (this[_options].controls.has('overview')) {
|
|
1377
|
-
|
|
1416
|
+
if (this[_overviewMap]) {
|
|
1417
|
+
this[_controls].overview = this[_overviewMap]
|
|
1418
|
+
}
|
|
1378
1419
|
}
|
|
1379
1420
|
|
|
1380
1421
|
for (const control in this[_controls]) {
|
|
@@ -1406,13 +1447,17 @@ class VolumeImageViewer {
|
|
|
1406
1447
|
* grayscale display values are then used as input to the second
|
|
1407
1448
|
* transformation, which maps them to pseudo-color values ranging from black
|
|
1408
1449
|
* color (R=0, G=0, B=0) to the color defined by parameter "color" using
|
|
1409
|
-
* linear interpolation.
|
|
1450
|
+
* linear interpolation. Alternatively, a palette color lookup table can be
|
|
1451
|
+
* provided to perform more sophisticated pseudo-coloring.
|
|
1410
1452
|
*
|
|
1411
1453
|
* @param {string} opticalPathIdentifier - Optical Path Identifier
|
|
1412
|
-
* @param {
|
|
1413
|
-
* @param {number[]} styleOptions.color - RGB color triplet
|
|
1414
|
-
* @param {number} styleOptions.
|
|
1415
|
-
*
|
|
1454
|
+
* @param {Object} styleOptions
|
|
1455
|
+
* @param {number[]} [styleOptions.color] - RGB color triplet
|
|
1456
|
+
* @param {number[]} [styleOptions.paletteColorLookupTable] - palette color
|
|
1457
|
+
* lookup table
|
|
1458
|
+
* @param {number} [styleOptions.opacity] - Opacity
|
|
1459
|
+
* @param {number[]} [styleOptions.limitValues] - Upper and lower windowing
|
|
1460
|
+
* limits
|
|
1416
1461
|
*/
|
|
1417
1462
|
setOpticalPathStyle (opticalPathIdentifier, styleOptions = {}) {
|
|
1418
1463
|
const opticalPath = this[_opticalPaths][opticalPathIdentifier]
|
|
@@ -1434,36 +1479,60 @@ class VolumeImageViewer {
|
|
|
1434
1479
|
if (styleOptions.opacity != null) {
|
|
1435
1480
|
opticalPath.style.opacity = styleOptions.opacity
|
|
1436
1481
|
opticalPath.layer.setOpacity(styleOptions.opacity)
|
|
1482
|
+
opticalPath.overviewTileLayer.setOpacity(styleOptions.opacity)
|
|
1437
1483
|
}
|
|
1438
1484
|
|
|
1439
|
-
const styleVariables = {}
|
|
1440
1485
|
if (opticalPath.opticalPath.isMonochromatic) {
|
|
1441
|
-
if (styleOptions.color != null) {
|
|
1442
|
-
if (opticalPath.opticalPath.isColorable) {
|
|
1443
|
-
opticalPath.style.color = styleOptions.color
|
|
1444
|
-
styleVariables.red = opticalPath.style.color[0]
|
|
1445
|
-
styleVariables.green = opticalPath.style.color[1]
|
|
1446
|
-
styleVariables.blue = opticalPath.style.color[2]
|
|
1447
|
-
} else {
|
|
1448
|
-
console.warn(
|
|
1449
|
-
`optical path "${opticalPathIdentifier}" is not colorable`
|
|
1450
|
-
)
|
|
1451
|
-
}
|
|
1452
|
-
}
|
|
1453
1486
|
if (styleOptions.limitValues != null) {
|
|
1454
1487
|
opticalPath.style.limitValues = [
|
|
1455
1488
|
Math.max(styleOptions.limitValues[0], opticalPath.minStoredValue),
|
|
1456
1489
|
Math.min(styleOptions.limitValues[1], opticalPath.maxStoredValue)
|
|
1457
1490
|
]
|
|
1458
|
-
const [windowCenter, windowWidth] = createWindow(
|
|
1459
|
-
styleOptions.limitValues[0],
|
|
1460
|
-
styleOptions.limitValues[1]
|
|
1461
|
-
)
|
|
1462
|
-
styleVariables.windowCenter = windowCenter
|
|
1463
|
-
styleVariables.windowWidth = windowWidth
|
|
1464
1491
|
}
|
|
1465
|
-
|
|
1466
|
-
|
|
1492
|
+
const [windowCenter, windowWidth] = createWindow(
|
|
1493
|
+
opticalPath.style.limitValues[0],
|
|
1494
|
+
opticalPath.style.limitValues[1]
|
|
1495
|
+
)
|
|
1496
|
+
|
|
1497
|
+
if (styleOptions.paletteColorLookupTable != null) {
|
|
1498
|
+
const style = _getColorPaletteStyleForTileLayer({
|
|
1499
|
+
windowCenter,
|
|
1500
|
+
windowWidth,
|
|
1501
|
+
colormap: styleOptions.paletteColorLookupTable.data
|
|
1502
|
+
})
|
|
1503
|
+
opticalPath.style.paletteColorLookupTable = styleOptions.paletteColorLookupTable
|
|
1504
|
+
opticalPath.layer.setStyle(style)
|
|
1505
|
+
opticalPath.overviewTileLayer.setStyle(style)
|
|
1506
|
+
} else if (styleOptions.color != null) {
|
|
1507
|
+
opticalPath.style.color = styleOptions.color
|
|
1508
|
+
if (opticalPath.style.paletteColorLookupTable) {
|
|
1509
|
+
const style = _getColorInterpolationStyleForTileLayer({
|
|
1510
|
+
windowCenter,
|
|
1511
|
+
windowWidth,
|
|
1512
|
+
color: opticalPath.style.color
|
|
1513
|
+
})
|
|
1514
|
+
opticalPath.style.paletteColorLookupTable = undefined
|
|
1515
|
+
opticalPath.layer.setStyle(style)
|
|
1516
|
+
opticalPath.overviewTileLayer.setStyle(style)
|
|
1517
|
+
} else {
|
|
1518
|
+
const styleVariables = {
|
|
1519
|
+
windowCenter: windowCenter,
|
|
1520
|
+
windowWidth: windowWidth,
|
|
1521
|
+
red: opticalPath.style.color[0],
|
|
1522
|
+
green: opticalPath.style.color[1],
|
|
1523
|
+
blue: opticalPath.style.color[2]
|
|
1524
|
+
}
|
|
1525
|
+
opticalPath.layer.updateStyleVariables(styleVariables)
|
|
1526
|
+
opticalPath.overviewTileLayer.updateStyleVariables(styleVariables)
|
|
1527
|
+
}
|
|
1528
|
+
} else {
|
|
1529
|
+
const styleVariables = {
|
|
1530
|
+
windowCenter: windowCenter,
|
|
1531
|
+
windowWidth: windowWidth
|
|
1532
|
+
}
|
|
1533
|
+
opticalPath.layer.updateStyleVariables(styleVariables)
|
|
1534
|
+
opticalPath.overviewTileLayer.updateStyleVariables(styleVariables)
|
|
1535
|
+
}
|
|
1467
1536
|
}
|
|
1468
1537
|
}
|
|
1469
1538
|
|
|
@@ -1499,7 +1568,7 @@ class VolumeImageViewer {
|
|
|
1499
1568
|
* Get the style of an optical path.
|
|
1500
1569
|
*
|
|
1501
1570
|
* @param {string} opticalPathIdentifier - Optical Path Identifier
|
|
1502
|
-
* @return {
|
|
1571
|
+
* @return {Object} Style of optical path
|
|
1503
1572
|
*/
|
|
1504
1573
|
getOpticalPathStyle (opticalPathIdentifier) {
|
|
1505
1574
|
const opticalPath = this[_opticalPaths][opticalPathIdentifier]
|
|
@@ -1510,15 +1579,15 @@ class VolumeImageViewer {
|
|
|
1510
1579
|
)
|
|
1511
1580
|
}
|
|
1512
1581
|
if (opticalPath.opticalPath.isMonochromatic) {
|
|
1513
|
-
if (opticalPath.
|
|
1582
|
+
if (opticalPath.style.paletteColorLookupTable) {
|
|
1514
1583
|
return {
|
|
1515
|
-
|
|
1584
|
+
paletteColorLookupTable: opticalPath.style.paletteColorLookupTable,
|
|
1516
1585
|
opacity: opticalPath.style.opacity,
|
|
1517
1586
|
limitValues: opticalPath.style.limitValues
|
|
1518
1587
|
}
|
|
1519
1588
|
}
|
|
1520
1589
|
return {
|
|
1521
|
-
|
|
1590
|
+
color: opticalPath.style.color,
|
|
1522
1591
|
opacity: opticalPath.style.opacity,
|
|
1523
1592
|
limitValues: opticalPath.style.limitValues
|
|
1524
1593
|
}
|
|
@@ -1530,7 +1599,8 @@ class VolumeImageViewer {
|
|
|
1530
1599
|
* Get image metadata for an optical path.
|
|
1531
1600
|
*
|
|
1532
1601
|
* @param {string} opticalPathIdentifier - Optical Path Identifier
|
|
1533
|
-
* @returns {VLWholeSlideMicroscopyImage[]} Slide microscopy image
|
|
1602
|
+
* @returns {metadata.VLWholeSlideMicroscopyImage[]} Slide microscopy image
|
|
1603
|
+
* metadata
|
|
1534
1604
|
*/
|
|
1535
1605
|
getOpticalPathMetadata (opticalPathIdentifier) {
|
|
1536
1606
|
const opticalPath = this[_opticalPaths][opticalPathIdentifier]
|
|
@@ -1546,14 +1616,14 @@ class VolumeImageViewer {
|
|
|
1546
1616
|
/**
|
|
1547
1617
|
* Get all optical paths.
|
|
1548
1618
|
*
|
|
1549
|
-
* @return {OpticalPath[]}
|
|
1619
|
+
* @return {opticalPath.OpticalPath[]}
|
|
1550
1620
|
*/
|
|
1551
1621
|
getAllOpticalPaths () {
|
|
1552
1622
|
const opticalPaths = []
|
|
1553
1623
|
for (const opticalPathIdentifier in this[_opticalPaths]) {
|
|
1554
1624
|
opticalPaths.push(this[_opticalPaths][opticalPathIdentifier].opticalPath)
|
|
1555
1625
|
}
|
|
1556
|
-
return opticalPaths
|
|
1626
|
+
return opticalPaths.sort(item => (item.OpticalPathIdentifier))
|
|
1557
1627
|
}
|
|
1558
1628
|
|
|
1559
1629
|
/**
|
|
@@ -1576,10 +1646,12 @@ class VolumeImageViewer {
|
|
|
1576
1646
|
0,
|
|
1577
1647
|
opticalPath.layer
|
|
1578
1648
|
)
|
|
1579
|
-
this[_overviewMap]
|
|
1580
|
-
|
|
1581
|
-
|
|
1582
|
-
|
|
1649
|
+
if (this[_overviewMap]) {
|
|
1650
|
+
this[_overviewMap].getOverviewMap().getLayers().insertAt(
|
|
1651
|
+
0,
|
|
1652
|
+
opticalPath.overviewTileLayer
|
|
1653
|
+
)
|
|
1654
|
+
}
|
|
1583
1655
|
}
|
|
1584
1656
|
|
|
1585
1657
|
/**
|
|
@@ -1599,9 +1671,11 @@ class VolumeImageViewer {
|
|
|
1599
1671
|
return
|
|
1600
1672
|
}
|
|
1601
1673
|
this[_map].removeLayer(opticalPath.layer)
|
|
1602
|
-
this[_overviewMap]
|
|
1603
|
-
|
|
1604
|
-
|
|
1674
|
+
if (this[_overviewMap]) {
|
|
1675
|
+
this[_overviewMap].getOverviewMap().removeLayer(
|
|
1676
|
+
opticalPath.overviewTileLayer
|
|
1677
|
+
)
|
|
1678
|
+
}
|
|
1605
1679
|
}
|
|
1606
1680
|
|
|
1607
1681
|
/**
|
|
@@ -1624,10 +1698,13 @@ class VolumeImageViewer {
|
|
|
1624
1698
|
* Show an optical path.
|
|
1625
1699
|
*
|
|
1626
1700
|
* @param {string} opticalPathIdentifier - Optical Path Identifier
|
|
1627
|
-
* @param {
|
|
1628
|
-
* @param {number[]} styleOptions.color - RGB color triplet
|
|
1629
|
-
* @param {number} styleOptions.
|
|
1630
|
-
*
|
|
1701
|
+
* @param {Object} [styleOptions]
|
|
1702
|
+
* @param {number[]} [styleOptions.color] - RGB color triplet
|
|
1703
|
+
* @param {number[]} [styleOptions.paletteColorLookupTable] - palette color
|
|
1704
|
+
* lookup table
|
|
1705
|
+
* @param {number} [styleOptions.opacity] - Opacity
|
|
1706
|
+
* @param {number[]} [styleOptions.limitValues] - Upper and lower windowing
|
|
1707
|
+
* limits
|
|
1631
1708
|
*/
|
|
1632
1709
|
showOpticalPath (opticalPathIdentifier, styleOptions = {}) {
|
|
1633
1710
|
const opticalPath = this[_opticalPaths][opticalPathIdentifier]
|
|
@@ -1725,7 +1802,7 @@ class VolumeImageViewer {
|
|
|
1725
1802
|
/**
|
|
1726
1803
|
* Render the images in the specified viewport container.
|
|
1727
1804
|
*
|
|
1728
|
-
* @param {
|
|
1805
|
+
* @param {Object} options - Rendering options.
|
|
1729
1806
|
* @param {(string|HTMLElement)} options.container - HTML Element in which the viewer should be injected.
|
|
1730
1807
|
*/
|
|
1731
1808
|
render (options) {
|
|
@@ -1841,64 +1918,75 @@ class VolumeImageViewer {
|
|
|
1841
1918
|
scaleInnerElement.style.margin = '1px'
|
|
1842
1919
|
scaleInnerElement.style.willChange = 'contents,width'
|
|
1843
1920
|
|
|
1844
|
-
|
|
1845
|
-
|
|
1846
|
-
|
|
1847
|
-
|
|
1848
|
-
|
|
1849
|
-
|
|
1850
|
-
|
|
1851
|
-
|
|
1852
|
-
|
|
1853
|
-
|
|
1854
|
-
|
|
1855
|
-
let resizeFactor
|
|
1856
|
-
let targetWidth
|
|
1857
|
-
if (Math.abs(rotation - 180) < 0.01 || Math.abs(rotation - 0) < 0.01) {
|
|
1858
|
-
if (windowSize[1] > windowSize[0]) {
|
|
1859
|
-
targetHeight = Math.ceil(windowSize[1] * 0.2)
|
|
1860
|
-
resizeFactor = targetHeight / height
|
|
1861
|
-
targetWidth = width * resizeFactor
|
|
1862
|
-
} else {
|
|
1863
|
-
targetWidth = Math.ceil(windowSize[0] * 0.15)
|
|
1864
|
-
resizeFactor = targetWidth / width
|
|
1865
|
-
targetHeight = height * resizeFactor
|
|
1921
|
+
if (this[_overviewMap]) {
|
|
1922
|
+
const overviewElement = this[_overviewMap].element
|
|
1923
|
+
const overviewmapElement = Object.values(overviewElement.children).find(
|
|
1924
|
+
c => c.className === 'ol-overviewmap-map'
|
|
1925
|
+
)
|
|
1926
|
+
const buttonElement = Object.values(overviewElement.children).find(
|
|
1927
|
+
c => c.type === 'button'
|
|
1928
|
+
)
|
|
1929
|
+
if (buttonElement) {
|
|
1930
|
+
buttonElement.style.border = '0.25px solid black'
|
|
1931
|
+
buttonElement.style.backgroundColor = 'white'
|
|
1866
1932
|
}
|
|
1867
|
-
|
|
1868
|
-
|
|
1869
|
-
|
|
1870
|
-
|
|
1871
|
-
|
|
1933
|
+
overviewmapElement.style.border = '1px solid black'
|
|
1934
|
+
overviewmapElement.style.color = 'black'
|
|
1935
|
+
// Try to fit the overview map into the target control overlay container
|
|
1936
|
+
const height = Math.abs(this[_pyramid].extent[1])
|
|
1937
|
+
const width = Math.abs(this[_pyramid].extent[2])
|
|
1938
|
+
const rotation = this[_rotation] / Math.PI * 180
|
|
1939
|
+
const windowSize = _getWindowSize()
|
|
1940
|
+
let targetHeight
|
|
1941
|
+
let resizeFactor
|
|
1942
|
+
let targetWidth
|
|
1943
|
+
if (Math.abs(rotation - 180) < 0.01 || Math.abs(rotation - 0) < 0.01) {
|
|
1944
|
+
if (windowSize[1] > windowSize[0]) {
|
|
1945
|
+
targetHeight = Math.ceil(windowSize[1] * 0.2)
|
|
1946
|
+
resizeFactor = targetHeight / height
|
|
1947
|
+
targetWidth = width * resizeFactor
|
|
1948
|
+
} else {
|
|
1949
|
+
targetWidth = Math.ceil(windowSize[0] * 0.15)
|
|
1950
|
+
resizeFactor = targetWidth / width
|
|
1951
|
+
targetHeight = height * resizeFactor
|
|
1952
|
+
}
|
|
1872
1953
|
} else {
|
|
1873
|
-
|
|
1874
|
-
|
|
1875
|
-
|
|
1954
|
+
if (windowSize[1] > windowSize[0]) {
|
|
1955
|
+
targetHeight = Math.ceil(windowSize[1] * 0.2)
|
|
1956
|
+
resizeFactor = targetHeight / width
|
|
1957
|
+
targetWidth = height * resizeFactor
|
|
1958
|
+
} else {
|
|
1959
|
+
targetWidth = Math.ceil(windowSize[0] * 0.15)
|
|
1960
|
+
resizeFactor = targetWidth / height
|
|
1961
|
+
targetHeight = width * resizeFactor
|
|
1962
|
+
}
|
|
1876
1963
|
}
|
|
1964
|
+
overviewmapElement.style.width = `${targetWidth}px`
|
|
1965
|
+
overviewmapElement.style.height = `${targetHeight}px`
|
|
1966
|
+
this[_overviewMap].getOverviewMap().updateSize()
|
|
1877
1967
|
}
|
|
1878
|
-
overviewmapElement.style.width = `${targetWidth}px`
|
|
1879
|
-
overviewmapElement.style.height = `${targetHeight}px`
|
|
1880
|
-
this[_overviewMap].getOverviewMap().updateSize()
|
|
1881
1968
|
})
|
|
1882
1969
|
}
|
|
1883
1970
|
|
|
1884
1971
|
/**
|
|
1885
1972
|
* Activate the draw interaction for graphic annotation of regions of interest.
|
|
1886
1973
|
*
|
|
1887
|
-
* @param {
|
|
1974
|
+
* @param {Object} options - Drawing options
|
|
1888
1975
|
* @param {string} options.geometryType - Name of the geometry type (point, circle, box, polygon, freehandpolygon, line, freehandline)
|
|
1889
|
-
* @param {
|
|
1890
|
-
*
|
|
1891
|
-
* @param {number} options.
|
|
1892
|
-
*
|
|
1893
|
-
* @param {
|
|
1894
|
-
* @param {
|
|
1895
|
-
*
|
|
1896
|
-
* @param {number}
|
|
1897
|
-
* @param {
|
|
1898
|
-
* @param {
|
|
1899
|
-
*
|
|
1976
|
+
* @param {number} [options.maxPoints] - Maximum number of points for "line"
|
|
1977
|
+
* geometry
|
|
1978
|
+
* @param {number} [options.minPoints] - Mininum number of points for "line"
|
|
1979
|
+
* geometry
|
|
1980
|
+
* @param {Object} [options.styleOptions] - Style options
|
|
1981
|
+
* @param {Object} [styleOptions.stroke] - Style options for the contour of
|
|
1982
|
+
* the geometry
|
|
1983
|
+
* @param {number[]} styleOptions.stroke.color - RGBA color of the contour
|
|
1984
|
+
* @param {number} styleOptions.stroke.width - Width of the contour
|
|
1985
|
+
* @param {Object} [styleOptions.fill] - Style options for the body of the
|
|
1986
|
+
* geometry
|
|
1987
|
+
* @param {number[]} styleOptions.fill.color - RGBA color of the body
|
|
1900
1988
|
*/
|
|
1901
|
-
activateDrawInteraction (options
|
|
1989
|
+
activateDrawInteraction (options) {
|
|
1902
1990
|
this.deactivateDrawInteraction()
|
|
1903
1991
|
console.info('activate "draw" interaction')
|
|
1904
1992
|
|
|
@@ -2029,25 +2117,25 @@ class VolumeImageViewer {
|
|
|
2029
2117
|
/**
|
|
2030
2118
|
* Whether draw interaction is active
|
|
2031
2119
|
*
|
|
2032
|
-
* @
|
|
2120
|
+
* @type boolean
|
|
2033
2121
|
*/
|
|
2034
2122
|
get isDrawInteractionActive () {
|
|
2035
2123
|
return this[_interactions].draw !== undefined
|
|
2036
2124
|
}
|
|
2037
2125
|
|
|
2038
2126
|
/**
|
|
2039
|
-
* Whether
|
|
2127
|
+
* Whether drag pan interaction is active.
|
|
2040
2128
|
*
|
|
2041
|
-
* @type
|
|
2129
|
+
* @type boolean
|
|
2042
2130
|
*/
|
|
2043
2131
|
get isDragPanInteractionActive () {
|
|
2044
2132
|
return this[_interactions].dragPan !== undefined
|
|
2045
2133
|
}
|
|
2046
2134
|
|
|
2047
2135
|
/**
|
|
2048
|
-
* Whether
|
|
2136
|
+
* Whether drag zoom interaction is active.
|
|
2049
2137
|
*
|
|
2050
|
-
* @type
|
|
2138
|
+
* @type boolean
|
|
2051
2139
|
*/
|
|
2052
2140
|
get isDragZoomInteractionActive () {
|
|
2053
2141
|
return this[_interactions].dragZoom !== undefined
|
|
@@ -2056,7 +2144,7 @@ class VolumeImageViewer {
|
|
|
2056
2144
|
/**
|
|
2057
2145
|
* Whether translate interaction is active.
|
|
2058
2146
|
*
|
|
2059
|
-
* @type
|
|
2147
|
+
* @type boolean
|
|
2060
2148
|
*/
|
|
2061
2149
|
get isTranslateInteractionActive () {
|
|
2062
2150
|
return this[_interactions].translate !== undefined
|
|
@@ -2092,10 +2180,10 @@ class VolumeImageViewer {
|
|
|
2092
2180
|
/**
|
|
2093
2181
|
* Extract and transform the region of interest (ROI).
|
|
2094
2182
|
*
|
|
2095
|
-
* @param {
|
|
2183
|
+
* @param {Object} feature - Openlayers Feature
|
|
2096
2184
|
* @param {Object[]} pyramid - Metadata for resolution levels of image pyramid
|
|
2097
2185
|
* @param {Object} context - Context
|
|
2098
|
-
* @returns {ROI} Region of interest
|
|
2186
|
+
* @returns {roi.ROI} Region of interest
|
|
2099
2187
|
* @private
|
|
2100
2188
|
*/
|
|
2101
2189
|
_getROIFromFeature (feature, pyramid) {
|
|
@@ -2126,17 +2214,19 @@ class VolumeImageViewer {
|
|
|
2126
2214
|
* @returns {void}
|
|
2127
2215
|
*/
|
|
2128
2216
|
toggleOverviewMap () {
|
|
2129
|
-
|
|
2130
|
-
|
|
2131
|
-
|
|
2132
|
-
|
|
2133
|
-
|
|
2217
|
+
if (this[_overviewMap]) {
|
|
2218
|
+
const controls = this[_map].getControls()
|
|
2219
|
+
const overview = controls.getArray().find((c) => c === this[_overviewMap])
|
|
2220
|
+
if (overview) {
|
|
2221
|
+
this[_map].removeControl(this[_overviewMap])
|
|
2222
|
+
return
|
|
2223
|
+
}
|
|
2224
|
+
this[_map].addControl(this[_overviewMap])
|
|
2225
|
+
const map = this[_overviewMap].getOverviewMap()
|
|
2226
|
+
const view = map.getView()
|
|
2227
|
+
const projection = view.getProjection()
|
|
2228
|
+
view.fit(projection.getExtent(), { size: map.getSize() })
|
|
2134
2229
|
}
|
|
2135
|
-
this[_map].addControl(this[_overviewMap])
|
|
2136
|
-
const map = this[_overviewMap].getOverviewMap()
|
|
2137
|
-
const view = map.getView()
|
|
2138
|
-
const projection = view.getProjection()
|
|
2139
|
-
view.fit(projection.getExtent(), { size: map.getSize() })
|
|
2140
2230
|
}
|
|
2141
2231
|
|
|
2142
2232
|
/**
|
|
@@ -2153,9 +2243,9 @@ class VolumeImageViewer {
|
|
|
2153
2243
|
}
|
|
2154
2244
|
|
|
2155
2245
|
/**
|
|
2156
|
-
* Activate
|
|
2246
|
+
* Activate drag zoom interaction.
|
|
2157
2247
|
*
|
|
2158
|
-
* @param {
|
|
2248
|
+
* @param {Object} options - Options.
|
|
2159
2249
|
*/
|
|
2160
2250
|
activateDragZoomInteraction (options = {}) {
|
|
2161
2251
|
this.deactivateDragZoomInteraction()
|
|
@@ -2180,7 +2270,7 @@ class VolumeImageViewer {
|
|
|
2180
2270
|
}
|
|
2181
2271
|
|
|
2182
2272
|
/**
|
|
2183
|
-
* Deactivate
|
|
2273
|
+
* Deactivate drag zoom interaction.
|
|
2184
2274
|
*/
|
|
2185
2275
|
deactivateDragZoomInteraction () {
|
|
2186
2276
|
console.info('deactivate "dragZoom" interaction')
|
|
@@ -2193,7 +2283,7 @@ class VolumeImageViewer {
|
|
|
2193
2283
|
/**
|
|
2194
2284
|
* Activate select interaction.
|
|
2195
2285
|
*
|
|
2196
|
-
* @param {
|
|
2286
|
+
* @param {Object} options selection options.
|
|
2197
2287
|
*/
|
|
2198
2288
|
activateSelectInteraction (options = {}) {
|
|
2199
2289
|
this.deactivateSelectInteraction()
|
|
@@ -2239,9 +2329,9 @@ class VolumeImageViewer {
|
|
|
2239
2329
|
}
|
|
2240
2330
|
|
|
2241
2331
|
/**
|
|
2242
|
-
* Activate
|
|
2332
|
+
* Activate drag pan interaction.
|
|
2243
2333
|
*
|
|
2244
|
-
* @param {Object} options -
|
|
2334
|
+
* @param {Object} options - Options.
|
|
2245
2335
|
*/
|
|
2246
2336
|
activateDragPanInteraction (options = {}) {
|
|
2247
2337
|
this.deactivateDragPanInteraction()
|
|
@@ -2268,7 +2358,7 @@ class VolumeImageViewer {
|
|
|
2268
2358
|
}
|
|
2269
2359
|
|
|
2270
2360
|
/**
|
|
2271
|
-
* Deactivate
|
|
2361
|
+
* Deactivate drag pan interaction.
|
|
2272
2362
|
*/
|
|
2273
2363
|
deactivateDragPanInteraction () {
|
|
2274
2364
|
console.info('deactivate "drag pan" interaction')
|
|
@@ -2307,7 +2397,7 @@ class VolumeImageViewer {
|
|
|
2307
2397
|
/**
|
|
2308
2398
|
* Whether select interaction is active.
|
|
2309
2399
|
*
|
|
2310
|
-
* @
|
|
2400
|
+
* @type boolean
|
|
2311
2401
|
*/
|
|
2312
2402
|
get isSelectInteractionActive () {
|
|
2313
2403
|
return this[_interactions].select !== undefined
|
|
@@ -2316,7 +2406,7 @@ class VolumeImageViewer {
|
|
|
2316
2406
|
/**
|
|
2317
2407
|
* Activate modify interaction.
|
|
2318
2408
|
*
|
|
2319
|
-
* @param {
|
|
2409
|
+
* @param {Object} options - Modification options.
|
|
2320
2410
|
*/
|
|
2321
2411
|
activateModifyInteraction (options = {}) {
|
|
2322
2412
|
this.deactivateModifyInteraction()
|
|
@@ -2369,7 +2459,7 @@ class VolumeImageViewer {
|
|
|
2369
2459
|
/**
|
|
2370
2460
|
* Whether modify interaction is active.
|
|
2371
2461
|
*
|
|
2372
|
-
* @
|
|
2462
|
+
* @type boolean
|
|
2373
2463
|
*/
|
|
2374
2464
|
get isModifyInteractionActive () {
|
|
2375
2465
|
return this[_interactions].modify !== undefined
|
|
@@ -2378,7 +2468,7 @@ class VolumeImageViewer {
|
|
|
2378
2468
|
/**
|
|
2379
2469
|
* Get all annotated regions of interest.
|
|
2380
2470
|
*
|
|
2381
|
-
* @returns {ROI[]} Array of regions of interest.
|
|
2471
|
+
* @returns {roi.ROI[]} Array of regions of interest.
|
|
2382
2472
|
*/
|
|
2383
2473
|
getAllROIs () {
|
|
2384
2474
|
console.info('get all ROIs')
|
|
@@ -2390,11 +2480,15 @@ class VolumeImageViewer {
|
|
|
2390
2480
|
}
|
|
2391
2481
|
|
|
2392
2482
|
collapseOverviewMap () {
|
|
2393
|
-
this[_overviewMap]
|
|
2483
|
+
if (this[_overviewMap]) {
|
|
2484
|
+
this[_overviewMap].setCollapsed(true)
|
|
2485
|
+
}
|
|
2394
2486
|
}
|
|
2395
2487
|
|
|
2396
2488
|
expandOverviewMap () {
|
|
2397
|
-
this[_overviewMap]
|
|
2489
|
+
if (this[_overviewMap]) {
|
|
2490
|
+
this[_overviewMap].setCollapsed(true)
|
|
2491
|
+
}
|
|
2398
2492
|
}
|
|
2399
2493
|
|
|
2400
2494
|
/**
|
|
@@ -2410,7 +2504,7 @@ class VolumeImageViewer {
|
|
|
2410
2504
|
* Get an individual annotated region of interest.
|
|
2411
2505
|
*
|
|
2412
2506
|
* @param {string} uid - Unique identifier of the region of interest
|
|
2413
|
-
* @returns {ROI} Region of interest.
|
|
2507
|
+
* @returns {roi.ROI} Region of interest.
|
|
2414
2508
|
*/
|
|
2415
2509
|
getROI (uid) {
|
|
2416
2510
|
console.info(`get ROI ${uid}`)
|
|
@@ -2422,7 +2516,7 @@ class VolumeImageViewer {
|
|
|
2422
2516
|
* Add a measurement to a region of interest.
|
|
2423
2517
|
*
|
|
2424
2518
|
* @param {string} uid - Unique identifier of the region of interest
|
|
2425
|
-
* @param {
|
|
2519
|
+
* @param {Object} item - NUM content item representing a measurement
|
|
2426
2520
|
*/
|
|
2427
2521
|
addROIMeasurement (uid, item) {
|
|
2428
2522
|
const meaning = item.ConceptNameCodeSequence[0].CodeMeaning
|
|
@@ -2445,7 +2539,7 @@ class VolumeImageViewer {
|
|
|
2445
2539
|
* Add a qualitative evaluation to a region of interest.
|
|
2446
2540
|
*
|
|
2447
2541
|
* @param {string} uid - Unique identifier of the region of interest
|
|
2448
|
-
* @param {
|
|
2542
|
+
* @param {Object} item - CODE content item representing a qualitative evaluation
|
|
2449
2543
|
*/
|
|
2450
2544
|
addROIEvaluation (uid, item) {
|
|
2451
2545
|
const meaning = item.ConceptNameCodeSequence[0].CodeMeaning
|
|
@@ -2467,7 +2561,7 @@ class VolumeImageViewer {
|
|
|
2467
2561
|
/**
|
|
2468
2562
|
* Pop the most recently annotated regions of interest.
|
|
2469
2563
|
*
|
|
2470
|
-
* @returns {ROI} Regions of interest.
|
|
2564
|
+
* @returns {roi.ROI} Regions of interest.
|
|
2471
2565
|
*/
|
|
2472
2566
|
popROI () {
|
|
2473
2567
|
console.info('pop ROI')
|
|
@@ -2478,15 +2572,15 @@ class VolumeImageViewer {
|
|
|
2478
2572
|
/**
|
|
2479
2573
|
* Add a regions of interest.
|
|
2480
2574
|
*
|
|
2481
|
-
* @param {ROI} roi - Regions of interest
|
|
2482
|
-
* @param {
|
|
2483
|
-
* @param {
|
|
2484
|
-
*
|
|
2485
|
-
* @param {number} styleOptions.stroke.
|
|
2486
|
-
* @param {
|
|
2575
|
+
* @param {roi.ROI} roi - Regions of interest
|
|
2576
|
+
* @param {Object} [styleOptions] - Style options
|
|
2577
|
+
* @param {Object} [styleOptions.stroke] - Style options for the contour of
|
|
2578
|
+
* the geometry
|
|
2579
|
+
* @param {number[]} styleOptions.stroke.color - RGBA color of the contour
|
|
2580
|
+
* @param {number} styleOptions.stroke.width - Width of the contour
|
|
2581
|
+
* @param {Object} [styleOptions.fill] - Style options for the body of the
|
|
2582
|
+
* geometry
|
|
2487
2583
|
* @param {number[]} styleOptions.fill.color - RGBA color of the body
|
|
2488
|
-
* @param {object} styleOptions.image - Style options for image
|
|
2489
|
-
*
|
|
2490
2584
|
*/
|
|
2491
2585
|
addROI (roi, styleOptions = {}) {
|
|
2492
2586
|
console.info(`add ROI ${roi.uid}`)
|
|
@@ -2522,13 +2616,13 @@ class VolumeImageViewer {
|
|
|
2522
2616
|
/**
|
|
2523
2617
|
* Update properties of a region of interest.
|
|
2524
2618
|
*
|
|
2525
|
-
* @param {
|
|
2619
|
+
* @param {Object} roi - ROI to be updated
|
|
2526
2620
|
* @param {string} roi.uid - Unique identifier of the region of interest
|
|
2527
|
-
* @param {
|
|
2528
|
-
* @param {
|
|
2529
|
-
* @param {
|
|
2530
|
-
* @param {
|
|
2531
|
-
* @param {
|
|
2621
|
+
* @param {Object} roi.properties - ROI properties
|
|
2622
|
+
* @param {Object} [roi.properties.measurements] - ROI measurements
|
|
2623
|
+
* @param {Object} [roi.properties.evaluations] - ROI evaluations
|
|
2624
|
+
* @param {Object} [roi.properties.label] - ROI label
|
|
2625
|
+
* @param {Object} [roi.properties.marker] - ROI marker
|
|
2532
2626
|
*/
|
|
2533
2627
|
updateROI ({ uid, properties = {} }) {
|
|
2534
2628
|
if (!uid) return
|
|
@@ -2546,7 +2640,7 @@ class VolumeImageViewer {
|
|
|
2546
2640
|
*
|
|
2547
2641
|
* @param {string} uid - Unique identifier of the regions of interest
|
|
2548
2642
|
*
|
|
2549
|
-
* @returns {
|
|
2643
|
+
* @returns {Object} - Style settings
|
|
2550
2644
|
*/
|
|
2551
2645
|
getROIStyle (uid) {
|
|
2552
2646
|
const feature = this[_features].getArray().find((feature) => {
|
|
@@ -2573,13 +2667,14 @@ class VolumeImageViewer {
|
|
|
2573
2667
|
* Set the style of a region of interest.
|
|
2574
2668
|
*
|
|
2575
2669
|
* @param {string} uid - Unique identifier of the regions of interest
|
|
2576
|
-
* @param {
|
|
2577
|
-
* @param {
|
|
2578
|
-
*
|
|
2579
|
-
* @param {number} styleOptions.stroke.
|
|
2580
|
-
* @param {
|
|
2670
|
+
* @param {Object} styleOptions - Style options
|
|
2671
|
+
* @param {Object} [styleOptions.stroke] - Style options for the contour of
|
|
2672
|
+
* the geometry
|
|
2673
|
+
* @param {number[]} styleOptions.stroke.color - RGBA color of the contour
|
|
2674
|
+
* @param {number} styleOptions.stroke.width - Width of the contour
|
|
2675
|
+
* @param {Object} [styleOptions.fill] - Style options for the body of the
|
|
2676
|
+
* geometry
|
|
2581
2677
|
* @param {number[]} styleOptions.fill.color - RGBA color of the body
|
|
2582
|
-
*
|
|
2583
2678
|
*/
|
|
2584
2679
|
setROIStyle (uid, styleOptions = {}) {
|
|
2585
2680
|
this[_features].forEach((feature) => {
|
|
@@ -2595,8 +2690,8 @@ class VolumeImageViewer {
|
|
|
2595
2690
|
/**
|
|
2596
2691
|
* Add a new viewport overlay.
|
|
2597
2692
|
*
|
|
2598
|
-
* @param {
|
|
2599
|
-
* @param {
|
|
2693
|
+
* @param {Object} options Overlay options
|
|
2694
|
+
* @param {Object} options.element The custom overlay HTML element
|
|
2600
2695
|
* @param {string} options.className Class to style the overlay container
|
|
2601
2696
|
* @param {number[]} options.offset Horizontal and vertical offset of the overlay container in pixels
|
|
2602
2697
|
*/
|
|
@@ -2669,7 +2764,8 @@ class VolumeImageViewer {
|
|
|
2669
2764
|
/**
|
|
2670
2765
|
* Add annotation groups.
|
|
2671
2766
|
*
|
|
2672
|
-
* @param {MicroscopyBulkSimpleAnnotations} metadata - Metadata of a
|
|
2767
|
+
* @param {metadata.MicroscopyBulkSimpleAnnotations} metadata - Metadata of a
|
|
2768
|
+
* DICOM Microscopy Simple Bulk Annotations instance
|
|
2673
2769
|
*/
|
|
2674
2770
|
addAnnotationGroups (metadata) {
|
|
2675
2771
|
const refImage = this[_pyramid].metadata[0]
|
|
@@ -2744,7 +2840,9 @@ class VolumeImageViewer {
|
|
|
2744
2840
|
|
|
2745
2841
|
const numberOfAnnotations = Number(metadataItem.NumberOfAnnotations)
|
|
2746
2842
|
const graphicType = metadataItem.GraphicType
|
|
2747
|
-
const coordinateDimensionality = _getCoordinateDimensionality(
|
|
2843
|
+
const coordinateDimensionality = _getCoordinateDimensionality(
|
|
2844
|
+
metadataItem
|
|
2845
|
+
)
|
|
2748
2846
|
const commonZCoordinate = _getCommonZCoordinate(metadataItem)
|
|
2749
2847
|
|
|
2750
2848
|
const features = this.getFeatures()
|
|
@@ -2773,10 +2871,12 @@ class VolumeImageViewer {
|
|
|
2773
2871
|
i,
|
|
2774
2872
|
numberOfAnnotations
|
|
2775
2873
|
)
|
|
2874
|
+
const coordinates = _scoord3dCoordinates2geometryCoordinates(
|
|
2875
|
+
point,
|
|
2876
|
+
pyramid
|
|
2877
|
+
)
|
|
2776
2878
|
const feature = new Feature({
|
|
2777
|
-
geometry: new PointGeometry(
|
|
2778
|
-
_scoord3dCoordinates2geometryCoordinates(point, pyramid)
|
|
2779
|
-
)
|
|
2879
|
+
geometry: new PointGeometry(coordinates)
|
|
2780
2880
|
})
|
|
2781
2881
|
const properties = {}
|
|
2782
2882
|
measurements.forEach(item => {
|
|
@@ -2827,7 +2927,7 @@ class VolumeImageViewer {
|
|
|
2827
2927
|
const container = this[_map].getTargetElement()
|
|
2828
2928
|
publish(container, EVENT.LOADING_ENDED)
|
|
2829
2929
|
})
|
|
2830
|
-
source.on('
|
|
2930
|
+
source.on('featuresloaderror', (event) => {
|
|
2831
2931
|
const container = this[_map].getTargetElement()
|
|
2832
2932
|
publish(container, EVENT.LOADING_ENDED)
|
|
2833
2933
|
})
|
|
@@ -2897,7 +2997,7 @@ class VolumeImageViewer {
|
|
|
2897
2997
|
* Show an annotation group.
|
|
2898
2998
|
*
|
|
2899
2999
|
* @param {string} annotationGroupUID - Unique identifier of an annotation group
|
|
2900
|
-
* @param {
|
|
3000
|
+
* @param {Object} styleOptions
|
|
2901
3001
|
* @param {number} styleOptions.measurement - Selected measurement for colorizing annotations
|
|
2902
3002
|
*/
|
|
2903
3003
|
showAnnotationGroup (annotationGroupUID, styleOptions = {}) {
|
|
@@ -2913,112 +3013,6 @@ class VolumeImageViewer {
|
|
|
2913
3013
|
annotationGroup.layer.setVisible(true)
|
|
2914
3014
|
}
|
|
2915
3015
|
|
|
2916
|
-
_retrieveAnnotationGroupBulkdata (annotationGroupUID) {
|
|
2917
|
-
if (!(annotationGroupUID in this[_annotationGroups])) {
|
|
2918
|
-
throw new Error(
|
|
2919
|
-
'Cannot retrieve bulkdata of annotation group. ' +
|
|
2920
|
-
`Could not find annotation group "${annotationGroupUID}".`
|
|
2921
|
-
)
|
|
2922
|
-
}
|
|
2923
|
-
const annotationGroup = this[_annotationGroups][annotationGroupUID]
|
|
2924
|
-
console.log(
|
|
2925
|
-
`retrieve bulkdata for annotation group "${annotationGroupUID}"`
|
|
2926
|
-
)
|
|
2927
|
-
const container = this[_map].getTargetElement()
|
|
2928
|
-
if (container == null) {
|
|
2929
|
-
throw new Error(
|
|
2930
|
-
'Cannot retrieve bulkdata of annotation group. ' +
|
|
2931
|
-
'Viewport has not been rendered. Call render() first.'
|
|
2932
|
-
)
|
|
2933
|
-
}
|
|
2934
|
-
publish(container, EVENT.LOADING_STARTED)
|
|
2935
|
-
|
|
2936
|
-
const index = annotationGroup.annotationGroup.number - 1
|
|
2937
|
-
const metadataItem = annotationGroup.metadata.AnnotationGroupSequence[index]
|
|
2938
|
-
/**
|
|
2939
|
-
* Bulkdata may not be available, since it's possible that all information
|
|
2940
|
-
* has been included into the metadata by value as InlineBinary. It must
|
|
2941
|
-
* only be provided if information has been included by reference as
|
|
2942
|
-
* BulkDataURI.
|
|
2943
|
-
*/
|
|
2944
|
-
const bulkdataReferences = annotationGroup.metadata.bulkdataReferences
|
|
2945
|
-
let bulkdataItem
|
|
2946
|
-
if (bulkdataReferences.AnnotationGroupSequence != null) {
|
|
2947
|
-
bulkdataItem = bulkdataReferences.AnnotationGroupSequence[index]
|
|
2948
|
-
}
|
|
2949
|
-
|
|
2950
|
-
const numberOfAnnotations = Number(metadataItem.NumberOfAnnotations)
|
|
2951
|
-
const graphicType = metadataItem.GraphicType
|
|
2952
|
-
const coordinateDimensionality = _getCoordinateDimensionality(metadataItem)
|
|
2953
|
-
const commonZCoordinate = _getCommonZCoordinate(metadataItem)
|
|
2954
|
-
|
|
2955
|
-
const source = annotationGroup.layer.getSource()
|
|
2956
|
-
const features = source.getFeatures()
|
|
2957
|
-
|
|
2958
|
-
const client = this[_options].client
|
|
2959
|
-
const promises = [
|
|
2960
|
-
_fetchGraphicData({ metadataItem, bulkdataItem, client }),
|
|
2961
|
-
_fetchGraphicIndex({ metadataItem, bulkdataItem, client }),
|
|
2962
|
-
_fetchMeasurements({ metadataItem, bulkdataItem, client })
|
|
2963
|
-
]
|
|
2964
|
-
Promise.all(promises).then(retrievedBulkdata => {
|
|
2965
|
-
const graphicData = retrievedBulkdata[0]
|
|
2966
|
-
const graphicIndex = retrievedBulkdata[1]
|
|
2967
|
-
const measurements = retrievedBulkdata[2]
|
|
2968
|
-
|
|
2969
|
-
for (let i = 0; i < numberOfAnnotations; i++) {
|
|
2970
|
-
const point = _getCentroid(
|
|
2971
|
-
graphicType,
|
|
2972
|
-
graphicData,
|
|
2973
|
-
graphicIndex,
|
|
2974
|
-
coordinateDimensionality,
|
|
2975
|
-
commonZCoordinate,
|
|
2976
|
-
i,
|
|
2977
|
-
numberOfAnnotations
|
|
2978
|
-
)
|
|
2979
|
-
const feature = new Feature({
|
|
2980
|
-
geometry: new PointGeometry(
|
|
2981
|
-
_scoord3dCoordinates2geometryCoordinates(
|
|
2982
|
-
point,
|
|
2983
|
-
this[_pyramid].metadata
|
|
2984
|
-
)
|
|
2985
|
-
)
|
|
2986
|
-
})
|
|
2987
|
-
const properties = {}
|
|
2988
|
-
measurements.forEach(item => {
|
|
2989
|
-
const name = item.name
|
|
2990
|
-
const key = `${name.CodingSchemeDesignator}${name.CodeValue}`
|
|
2991
|
-
const value = item.values[i]
|
|
2992
|
-
properties[key] = value
|
|
2993
|
-
})
|
|
2994
|
-
feature.setProperties(properties)
|
|
2995
|
-
feature.setId(i + 1)
|
|
2996
|
-
features.push(feature)
|
|
2997
|
-
}
|
|
2998
|
-
|
|
2999
|
-
console.log(
|
|
3000
|
-
`add n=${features.length} annotations ` +
|
|
3001
|
-
`for annotation group "${annotationGroupUID}"`
|
|
3002
|
-
)
|
|
3003
|
-
source.addFeatures(features)
|
|
3004
|
-
const properties = {}
|
|
3005
|
-
measurements.forEach(item => {
|
|
3006
|
-
const name = item.name
|
|
3007
|
-
const key = `${name.CodingSchemeDesignator}${name.CodeValue}`
|
|
3008
|
-
const value = quantileSeq(
|
|
3009
|
-
[...item.values],
|
|
3010
|
-
[0, 0.015, 0.25, 0.5, 0.75, 0.95, 1]
|
|
3011
|
-
)
|
|
3012
|
-
properties[key] = value
|
|
3013
|
-
})
|
|
3014
|
-
source.setProperties(properties)
|
|
3015
|
-
publish(container, EVENT.LOADING_ENDED)
|
|
3016
|
-
}).catch(error => {
|
|
3017
|
-
console.error(error)
|
|
3018
|
-
publish(container, EVENT.LOADING_ENDED)
|
|
3019
|
-
})
|
|
3020
|
-
}
|
|
3021
|
-
|
|
3022
3016
|
/**
|
|
3023
3017
|
* Hide an annotation group.
|
|
3024
3018
|
*
|
|
@@ -3056,7 +3050,7 @@ class VolumeImageViewer {
|
|
|
3056
3050
|
* Set style of an annotation group.
|
|
3057
3051
|
*
|
|
3058
3052
|
* @param {string} annotationGroupUID - Unique identifier of an annotation group
|
|
3059
|
-
* @param {
|
|
3053
|
+
* @param {Object} styleOptions - Style options
|
|
3060
3054
|
* @param {number} styleOptions.opacity - Opacity
|
|
3061
3055
|
* @param {number} styleOptions.measurement - Selected measurement for colorizing annotations
|
|
3062
3056
|
*/
|
|
@@ -3151,7 +3145,7 @@ class VolumeImageViewer {
|
|
|
3151
3145
|
*
|
|
3152
3146
|
* @param {string} annotationGroupUID - Unique identifier of an annotation group
|
|
3153
3147
|
*
|
|
3154
|
-
* @returns {
|
|
3148
|
+
* @returns {Object} - Style settings
|
|
3155
3149
|
*/
|
|
3156
3150
|
getAnnotationGroupStyle (annotationGroupUID) {
|
|
3157
3151
|
if (!(annotationGroupUID in this[_annotationGroups])) {
|
|
@@ -3170,7 +3164,7 @@ class VolumeImageViewer {
|
|
|
3170
3164
|
/**
|
|
3171
3165
|
* Get all annotation groups.
|
|
3172
3166
|
*
|
|
3173
|
-
* @returns {AnnotationGroup[]}
|
|
3167
|
+
* @returns {annotation.AnnotationGroup[]}
|
|
3174
3168
|
*/
|
|
3175
3169
|
getAllAnnotationGroups () {
|
|
3176
3170
|
const groups = []
|
|
@@ -3185,7 +3179,8 @@ class VolumeImageViewer {
|
|
|
3185
3179
|
*
|
|
3186
3180
|
* @param {string} annotationGroupUID - Unique identifier of an annotation group
|
|
3187
3181
|
*
|
|
3188
|
-
* @returns {MicroscopyBulkSimpleAnnotations
|
|
3182
|
+
* @returns {metadata.MicroscopyBulkSimpleAnnotations} - Metadata of DICOM
|
|
3183
|
+
* Microscopy Bulk Simple Annotations instance
|
|
3189
3184
|
*/
|
|
3190
3185
|
getAnnotationGroupMetadata (annotationGroupUID) {
|
|
3191
3186
|
if (!(annotationGroupUID in this[_annotationGroups])) {
|
|
@@ -3201,7 +3196,7 @@ class VolumeImageViewer {
|
|
|
3201
3196
|
/**
|
|
3202
3197
|
* Add segments.
|
|
3203
3198
|
*
|
|
3204
|
-
* @param {Segmentation[]} metadata - Metadata of one or more DICOM Segmentation instances
|
|
3199
|
+
* @param {metadata.Segmentation[]} metadata - Metadata of one or more DICOM Segmentation instances
|
|
3205
3200
|
*/
|
|
3206
3201
|
addSegments (metadata) {
|
|
3207
3202
|
if (metadata.length === 0) {
|
|
@@ -3348,7 +3343,7 @@ class VolumeImageViewer {
|
|
|
3348
3343
|
extent: this[_pyramid].extent,
|
|
3349
3344
|
visible: false,
|
|
3350
3345
|
opacity: 0.9,
|
|
3351
|
-
preload: 0,
|
|
3346
|
+
preload: this[_options].preload ? 1 : 0,
|
|
3352
3347
|
transition: 0,
|
|
3353
3348
|
style: _getColorPaletteStyleForTileLayer({
|
|
3354
3349
|
windowCenter,
|
|
@@ -3399,8 +3394,8 @@ class VolumeImageViewer {
|
|
|
3399
3394
|
* Show a segment.
|
|
3400
3395
|
*
|
|
3401
3396
|
* @param {string} segmentUID - Unique tracking identifier of a segment
|
|
3402
|
-
* @param {
|
|
3403
|
-
* @param {number} styleOptions.opacity - Opacity
|
|
3397
|
+
* @param {Object} [styleOptions]
|
|
3398
|
+
* @param {number} [styleOptions.opacity] - Opacity
|
|
3404
3399
|
*/
|
|
3405
3400
|
showSegment (segmentUID, styleOptions = {}) {
|
|
3406
3401
|
if (!(segmentUID in this[_segments])) {
|
|
@@ -3452,8 +3447,8 @@ class VolumeImageViewer {
|
|
|
3452
3447
|
* Set the style of a segment.
|
|
3453
3448
|
*
|
|
3454
3449
|
* @param {string} segmentUID - Unique tracking identifier of segment
|
|
3455
|
-
* @param {
|
|
3456
|
-
* @param {number} styleOptions.opacity - Opacity
|
|
3450
|
+
* @param {Object} styleOptions - Style options
|
|
3451
|
+
* @param {number} [styleOptions.opacity] - Opacity
|
|
3457
3452
|
*/
|
|
3458
3453
|
setSegmentStyle (segmentUID, styleOptions = {}) {
|
|
3459
3454
|
if (!(segmentUID in this[_segments])) {
|
|
@@ -3516,7 +3511,8 @@ class VolumeImageViewer {
|
|
|
3516
3511
|
* Get the style of a segment.
|
|
3517
3512
|
*
|
|
3518
3513
|
* @param {string} segmentUID - Unique tracking identifier of segment
|
|
3519
|
-
*
|
|
3514
|
+
*
|
|
3515
|
+
* @returns {Object} Style settings
|
|
3520
3516
|
*/
|
|
3521
3517
|
getSegmentStyle (segmentUID) {
|
|
3522
3518
|
if (!(segmentUID in this[_segments])) {
|
|
@@ -3537,7 +3533,8 @@ class VolumeImageViewer {
|
|
|
3537
3533
|
* Get image metadata for a segment.
|
|
3538
3534
|
*
|
|
3539
3535
|
* @param {string} segmentUID - Unique tracking identifier of segment
|
|
3540
|
-
*
|
|
3536
|
+
*
|
|
3537
|
+
* @returns {metadata.Segmentation[]} Metadata of DICOM Segmentation instances
|
|
3541
3538
|
*/
|
|
3542
3539
|
getSegmentMetadata (segmentUID) {
|
|
3543
3540
|
if (!(segmentUID in this[_segments])) {
|
|
@@ -3553,7 +3550,7 @@ class VolumeImageViewer {
|
|
|
3553
3550
|
/**
|
|
3554
3551
|
* Get all segments.
|
|
3555
3552
|
*
|
|
3556
|
-
* @return {Segment[]}
|
|
3553
|
+
* @return {segment.Segment[]}
|
|
3557
3554
|
*/
|
|
3558
3555
|
getAllSegments () {
|
|
3559
3556
|
const segments = []
|
|
@@ -3566,7 +3563,7 @@ class VolumeImageViewer {
|
|
|
3566
3563
|
/**
|
|
3567
3564
|
* Add parameter mappings.
|
|
3568
3565
|
*
|
|
3569
|
-
* @param {ParametricMap[]} metadata - Metadata of one or more DICOM Parametric Map instances
|
|
3566
|
+
* @param {metadata.ParametricMap[]} metadata - Metadata of one or more DICOM Parametric Map instances
|
|
3570
3567
|
*/
|
|
3571
3568
|
addParameterMappings (metadata) {
|
|
3572
3569
|
if (metadata.length === 0) {
|
|
@@ -3777,7 +3774,7 @@ class VolumeImageViewer {
|
|
|
3777
3774
|
projection: this[_projection],
|
|
3778
3775
|
visible: false,
|
|
3779
3776
|
opacity: 1,
|
|
3780
|
-
preload: 1,
|
|
3777
|
+
preload: this[_options].preload ? 1 : 0,
|
|
3781
3778
|
transition: 0,
|
|
3782
3779
|
style: _getColorPaletteStyleForTileLayer({
|
|
3783
3780
|
windowCenter,
|
|
@@ -3827,9 +3824,9 @@ class VolumeImageViewer {
|
|
|
3827
3824
|
* Show a parameter mapping.
|
|
3828
3825
|
*
|
|
3829
3826
|
* @param {string} mappingUID - Unique tracking identifier of a mapping
|
|
3830
|
-
* @param {
|
|
3831
|
-
* @param {number} styleOptions.opacity - Opacity
|
|
3832
|
-
* @param {number} styleOptions.limitValues -
|
|
3827
|
+
* @param {Object} [styleOptions]
|
|
3828
|
+
* @param {number} [styleOptions.opacity] - Opacity
|
|
3829
|
+
* @param {number[]} [styleOptions.limitValues] - Upper and lower windowing
|
|
3833
3830
|
*/
|
|
3834
3831
|
showParameterMapping (mappingUID, styleOptions = {}) {
|
|
3835
3832
|
if (!(mappingUID in this[_mappings])) {
|
|
@@ -3881,8 +3878,9 @@ class VolumeImageViewer {
|
|
|
3881
3878
|
* Set the style of a parameter mapping.
|
|
3882
3879
|
*
|
|
3883
3880
|
* @param {string} mappingUID - Unique tracking identifier of mapping
|
|
3884
|
-
* @param {
|
|
3885
|
-
* @param {number} styleOptions.opacity - Opacity
|
|
3881
|
+
* @param {Object} styleOptions
|
|
3882
|
+
* @param {number} [styleOptions.opacity] - Opacity
|
|
3883
|
+
* @param {number[]} [styleOptions.limitValues] - Upper and lower windowing
|
|
3886
3884
|
*/
|
|
3887
3885
|
setParameterMappingStyle (mappingUID, styleOptions = {}) {
|
|
3888
3886
|
if (!(mappingUID in this[_mappings])) {
|
|
@@ -3961,7 +3959,7 @@ class VolumeImageViewer {
|
|
|
3961
3959
|
* Get the style of a parameter mapping.
|
|
3962
3960
|
*
|
|
3963
3961
|
* @param {string} mappingUID - Unique tracking identifier of mapping
|
|
3964
|
-
* @returns {
|
|
3962
|
+
* @returns {Object} Style Options
|
|
3965
3963
|
*/
|
|
3966
3964
|
getParameterMappingStyle (mappingUID) {
|
|
3967
3965
|
if (!(mappingUID in this[_mappings])) {
|
|
@@ -3983,7 +3981,9 @@ class VolumeImageViewer {
|
|
|
3983
3981
|
* Get image metadata for a parameter mapping.
|
|
3984
3982
|
*
|
|
3985
3983
|
* @param {string} mappingUID - Unique tracking identifier of mapping
|
|
3986
|
-
*
|
|
3984
|
+
*
|
|
3985
|
+
* @returns {metadata.ParametricMap[]} Metadata of DICOM Parametric Map
|
|
3986
|
+
* instances
|
|
3987
3987
|
*/
|
|
3988
3988
|
getParameterMappingMetadata (mappingUID) {
|
|
3989
3989
|
if (!(mappingUID in this[_mappings])) {
|
|
@@ -3999,7 +3999,7 @@ class VolumeImageViewer {
|
|
|
3999
3999
|
/**
|
|
4000
4000
|
* Get all parameter mappings.
|
|
4001
4001
|
*
|
|
4002
|
-
* @return {ParameterMapping[]}
|
|
4002
|
+
* @return {mapping.ParameterMapping[]}
|
|
4003
4003
|
*/
|
|
4004
4004
|
getAllParameterMappings () {
|
|
4005
4005
|
const mappings = []
|
|
@@ -4015,18 +4015,22 @@ class VolumeImageViewer {
|
|
|
4015
4015
|
* with Image Type other than VOLUME.
|
|
4016
4016
|
*
|
|
4017
4017
|
* @class
|
|
4018
|
+
* @abstract
|
|
4018
4019
|
* @private
|
|
4019
4020
|
*/
|
|
4020
4021
|
class _NonVolumeImageViewer {
|
|
4021
4022
|
/**
|
|
4022
|
-
*
|
|
4023
|
-
*
|
|
4024
|
-
*
|
|
4025
|
-
* @param {
|
|
4026
|
-
*
|
|
4027
|
-
* @param {string} options.orientation - Orientation of the slide (vertical:
|
|
4028
|
-
*
|
|
4029
|
-
* @param {
|
|
4023
|
+
* @param {Object} options
|
|
4024
|
+
* @param {Object} options.client - A DICOMwebClient instance for interacting
|
|
4025
|
+
* with an origin server over HTTP.
|
|
4026
|
+
* @param {metadata.VLWholeSlideMicroscopyImage[]} options.metadata -
|
|
4027
|
+
* Metadata of DICOM VL Whole Slide Microscopy Image instances
|
|
4028
|
+
* @param {string} options.orientation - Orientation of the slide (vertical:
|
|
4029
|
+
* label on top, or horizontal: label on right side).
|
|
4030
|
+
* @param {number} [options.resizeFactor=1] - To which extent image should be
|
|
4031
|
+
* reduced in size (fraction).
|
|
4032
|
+
* @param {boolean} [options.includeIccProfile=false] - Whether ICC Profile
|
|
4033
|
+
* should be included for correction of image colors.
|
|
4030
4034
|
*/
|
|
4031
4035
|
constructor (options) {
|
|
4032
4036
|
// We also accept metadata in raw JSON format for backwards compatibility
|
|
@@ -4140,7 +4144,7 @@ class _NonVolumeImageViewer {
|
|
|
4140
4144
|
/**
|
|
4141
4145
|
* Render the image in the specified viewport container.
|
|
4142
4146
|
*
|
|
4143
|
-
* @param {
|
|
4147
|
+
* @param {Object} options - Rendering options.
|
|
4144
4148
|
* @param {(string|HTMLElement)} options.container - HTML Element in which the viewer should be injected.
|
|
4145
4149
|
*/
|
|
4146
4150
|
render (options) {
|
|
@@ -4198,15 +4202,18 @@ class _NonVolumeImageViewer {
|
|
|
4198
4202
|
* @memberof viewer
|
|
4199
4203
|
*/
|
|
4200
4204
|
class OverviewImageViewer extends _NonVolumeImageViewer {
|
|
4201
|
-
/**
|
|
4202
|
-
*
|
|
4203
|
-
*
|
|
4204
|
-
*
|
|
4205
|
-
* @param {
|
|
4206
|
-
*
|
|
4207
|
-
* @param {string} [options.orientation='horizontal'] - Orientation of the
|
|
4208
|
-
*
|
|
4209
|
-
* @param {
|
|
4205
|
+
/**
|
|
4206
|
+
* @param {Object} options
|
|
4207
|
+
* @param {Object} options.client - A DICOMwebClient instance for interacting
|
|
4208
|
+
* with an origin server over HTTP.
|
|
4209
|
+
* @param {metadata.VLWholeSlideMicroscopyImage[]} options.metadata -
|
|
4210
|
+
* Metadata of DICOM VL Whole Slide Microscopy Image instances
|
|
4211
|
+
* @param {string} [options.orientation='horizontal'] - Orientation of the
|
|
4212
|
+
* slide (vertical: label on top, or horizontal: label on right side).
|
|
4213
|
+
* @param {number} [options.resizeFactor=1] - To which extent image should be
|
|
4214
|
+
* reduced in size (fraction).
|
|
4215
|
+
* @param {boolean} [options.includeIccProfile=false] - Whether ICC Profile
|
|
4216
|
+
* should be included for correction of image colors.
|
|
4210
4217
|
*/
|
|
4211
4218
|
constructor (options) {
|
|
4212
4219
|
if (options.orientation === undefined) {
|
|
@@ -4224,15 +4231,17 @@ class OverviewImageViewer extends _NonVolumeImageViewer {
|
|
|
4224
4231
|
* @memberof viewer
|
|
4225
4232
|
*/
|
|
4226
4233
|
class LabelImageViewer extends _NonVolumeImageViewer {
|
|
4227
|
-
/**
|
|
4228
|
-
*
|
|
4229
|
-
*
|
|
4230
|
-
* @param {
|
|
4231
|
-
*
|
|
4232
|
-
* @param {
|
|
4233
|
-
*
|
|
4234
|
-
* @param {number} [options.resizeFactor=1] - To which extent image should be
|
|
4235
|
-
*
|
|
4234
|
+
/**
|
|
4235
|
+
* @param {Object} options - Options
|
|
4236
|
+
* @param {Object} options.client - A DICOMwebClient instance for interacting 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='vertical'] - 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
|
|
4236
4245
|
*/
|
|
4237
4246
|
constructor (options) {
|
|
4238
4247
|
if (options.orientation === undefined) {
|