dicom-microscopy-viewer 0.36.5 → 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.
Files changed (56) hide show
  1. package/dist/dicom-microscopy-viewer.js +1 -1
  2. package/dist/dicom-microscopy-viewer.js.map +1 -1
  3. package/docs/annotation.AnnotationGroup.html +1 -1
  4. package/docs/annotation.html +1 -1
  5. package/docs/annotation.js.html +1 -1
  6. package/docs/annotations__AnnotationManager.js.html +1 -1
  7. package/docs/annotations_markups__MarkupManager.js.html +1 -1
  8. package/docs/api.html +1 -1
  9. package/docs/color.PaletteColorLookupTable.html +1 -1
  10. package/docs/color.html +1 -1
  11. package/docs/color.js.html +1 -1
  12. package/docs/dicom-microscopy-viewer.js.html +1 -1
  13. package/docs/events.html +1 -1
  14. package/docs/events.js.html +1 -1
  15. package/docs/index.html +1 -1
  16. package/docs/mapping.ParameterMapping.html +1 -1
  17. package/docs/mapping.Transformation.html +1 -1
  18. package/docs/mapping.html +1 -1
  19. package/docs/mapping.js.html +1 -1
  20. package/docs/metadata.Comprehensive3DSR.html +1 -1
  21. package/docs/metadata.MicroscopyBulkSimpleAnnotations.html +1 -1
  22. package/docs/metadata.ParametricMap.html +1 -1
  23. package/docs/metadata.SOPClass.html +1 -1
  24. package/docs/metadata.Segmentation.html +1 -1
  25. package/docs/metadata.VLWholeSlideMicroscopyImage.html +1 -1
  26. package/docs/metadata.html +1 -1
  27. package/docs/metadata.js.html +1 -1
  28. package/docs/opticalPath.OpticalPath.html +1 -1
  29. package/docs/opticalPath.html +1 -1
  30. package/docs/opticalPath.js.html +2 -2
  31. package/docs/pyramid.js.html +1 -1
  32. package/docs/roi.ROI.html +1 -1
  33. package/docs/roi.html +1 -1
  34. package/docs/roi.js.html +1 -1
  35. package/docs/scoord3d.Ellipse.html +1 -1
  36. package/docs/scoord3d.Ellipsoid.html +1 -1
  37. package/docs/scoord3d.Multipoint.html +1 -1
  38. package/docs/scoord3d.Point.html +1 -1
  39. package/docs/scoord3d.Polygon.html +1 -1
  40. package/docs/scoord3d.Polyline.html +1 -1
  41. package/docs/scoord3d.Scoord3D.html +1 -1
  42. package/docs/scoord3d.html +1 -1
  43. package/docs/scoord3d.js.html +1 -1
  44. package/docs/segment.Segment.html +1 -1
  45. package/docs/segment.html +1 -1
  46. package/docs/segment.js.html +1 -1
  47. package/docs/utils.html +1 -1
  48. package/docs/utils.js.html +1 -1
  49. package/docs/viewer.LabelImageViewer.html +2 -2
  50. package/docs/viewer.OverviewImageViewer.html +2 -2
  51. package/docs/viewer.VolumeImageViewer.html +629 -236
  52. package/docs/viewer.html +1 -1
  53. package/docs/viewer.js.html +284 -292
  54. package/package.json +1 -1
  55. package/src/opticalPath.js +1 -1
  56. package/src/viewer.js +174 -216
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dicom-microscopy-viewer",
3
- "version": "0.36.5",
3
+ "version": "0.37.0",
4
4
  "description": "Interactive web-based viewer for DICOM Microscopy Images",
5
5
  "main": "./src/dicom-microscopy-viewer.js",
6
6
  "standard": {
@@ -193,7 +193,7 @@ class OpticalPath {
193
193
  * @type boolean
194
194
  */
195
195
  get isColorable () {
196
- return this[_attrs].paletteColorLookupTableUID == null
196
+ return this[_attrs].isMonochromatic
197
197
  }
198
198
  }
199
199
 
package/src/viewer.js CHANGED
@@ -694,6 +694,60 @@ function _getColorPaletteStyleForTileLayer ({
694
694
  return { color: expression, variables }
695
695
  }
696
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
+
697
751
  /**
698
752
  * Build OpenLayers style expression for coloring a WebGL PointLayer.
699
753
  *
@@ -797,7 +851,8 @@ class VolumeImageViewer {
797
851
  * @param {metadata.VLWholeSlideMicroscopyImage[]} options.metadata -
798
852
  * Metadata of DICOM VL Whole Slide Microscopy Image instances that should be
799
853
  * diplayed.
800
- * @param {Object} options.preload - Whether data should be preloaded
854
+ * @param {number} [options.preload=0] - Number of resolution levels that should
855
+ * be preloaded
801
856
  * @param {string[]} [options.controls=[]] - Names of viewer control elements
802
857
  * that should be included in the viewport
803
858
  * @param {boolean} [options.debug=false] - Whether debug features should be
@@ -1059,7 +1114,6 @@ class VolumeImageViewer {
1059
1114
  paletteColorLookupTable: paletteColorLookupTable
1060
1115
  },
1061
1116
  bitsAllocated: bitsAllocated,
1062
- isColorable: paletteColorLookupTableUID == null,
1063
1117
  minStoredValue,
1064
1118
  maxStoredValue,
1065
1119
  loaderParams: {
@@ -1115,40 +1169,11 @@ class VolumeImageViewer {
1115
1169
  colormap: opticalPath.style.paletteColorLookupTable.data
1116
1170
  })
1117
1171
  } else {
1118
- /*
1119
- * If no Palette Color Lookup Table is available, don't create one
1120
- * but let WebGL interpolate colors for improved performance.
1121
- */
1122
- style = {
1123
- color: [
1124
- 'interpolate',
1125
- ['linear'],
1126
- [
1127
- '+',
1128
- [
1129
- '/',
1130
- [
1131
- '-',
1132
- ['band', 1],
1133
- ['var', 'windowCenter']
1134
- ],
1135
- ['var', 'windowWidth']
1136
- ],
1137
- 0.5
1138
- ],
1139
- 0,
1140
- [0, 0, 0, 1],
1141
- 1,
1142
- ['color', ['var', 'red'], ['var', 'green'], ['var', 'blue'], 1]
1143
- ],
1144
- variables: {
1145
- red: opticalPath.style.color[0],
1146
- green: opticalPath.style.color[1],
1147
- blue: opticalPath.style.color[2],
1148
- windowCenter,
1149
- windowWidth
1150
- }
1151
- }
1172
+ style = _getColorInterpolationStyleForTileLayer({
1173
+ windowCenter,
1174
+ windowWidth,
1175
+ color: opticalPath.style.color
1176
+ })
1152
1177
  }
1153
1178
 
1154
1179
  opticalPath.layer = new TileLayer({
@@ -1422,13 +1447,17 @@ class VolumeImageViewer {
1422
1447
  * grayscale display values are then used as input to the second
1423
1448
  * transformation, which maps them to pseudo-color values ranging from black
1424
1449
  * color (R=0, G=0, B=0) to the color defined by parameter "color" using
1425
- * linear interpolation.
1450
+ * linear interpolation. Alternatively, a palette color lookup table can be
1451
+ * provided to perform more sophisticated pseudo-coloring.
1426
1452
  *
1427
1453
  * @param {string} opticalPathIdentifier - Optical Path Identifier
1428
1454
  * @param {Object} styleOptions
1429
- * @param {number[]} styleOptions.color - RGB color triplet
1430
- * @param {number} styleOptions.opacity - Opacity
1431
- * @param {number[]} styleOptions.limitValues - Upper and lower windowing limits
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
1432
1461
  */
1433
1462
  setOpticalPathStyle (opticalPathIdentifier, styleOptions = {}) {
1434
1463
  const opticalPath = this[_opticalPaths][opticalPathIdentifier]
@@ -1450,36 +1479,60 @@ class VolumeImageViewer {
1450
1479
  if (styleOptions.opacity != null) {
1451
1480
  opticalPath.style.opacity = styleOptions.opacity
1452
1481
  opticalPath.layer.setOpacity(styleOptions.opacity)
1482
+ opticalPath.overviewTileLayer.setOpacity(styleOptions.opacity)
1453
1483
  }
1454
1484
 
1455
- const styleVariables = {}
1456
1485
  if (opticalPath.opticalPath.isMonochromatic) {
1457
- if (styleOptions.color != null) {
1458
- if (opticalPath.opticalPath.isColorable) {
1459
- opticalPath.style.color = styleOptions.color
1460
- styleVariables.red = opticalPath.style.color[0]
1461
- styleVariables.green = opticalPath.style.color[1]
1462
- styleVariables.blue = opticalPath.style.color[2]
1463
- } else {
1464
- console.warn(
1465
- `optical path "${opticalPathIdentifier}" is not colorable`
1466
- )
1467
- }
1468
- }
1469
1486
  if (styleOptions.limitValues != null) {
1470
1487
  opticalPath.style.limitValues = [
1471
1488
  Math.max(styleOptions.limitValues[0], opticalPath.minStoredValue),
1472
1489
  Math.min(styleOptions.limitValues[1], opticalPath.maxStoredValue)
1473
1490
  ]
1474
- const [windowCenter, windowWidth] = createWindow(
1475
- styleOptions.limitValues[0],
1476
- styleOptions.limitValues[1]
1477
- )
1478
- styleVariables.windowCenter = windowCenter
1479
- styleVariables.windowWidth = windowWidth
1480
1491
  }
1481
- opticalPath.layer.updateStyleVariables(styleVariables)
1482
- opticalPath.overviewTileLayer.updateStyleVariables(styleVariables)
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
+ }
1483
1536
  }
1484
1537
  }
1485
1538
 
@@ -1526,15 +1579,15 @@ class VolumeImageViewer {
1526
1579
  )
1527
1580
  }
1528
1581
  if (opticalPath.opticalPath.isMonochromatic) {
1529
- if (opticalPath.opticalPath.isColorable) {
1582
+ if (opticalPath.style.paletteColorLookupTable) {
1530
1583
  return {
1531
- color: opticalPath.style.color,
1584
+ paletteColorLookupTable: opticalPath.style.paletteColorLookupTable,
1532
1585
  opacity: opticalPath.style.opacity,
1533
1586
  limitValues: opticalPath.style.limitValues
1534
1587
  }
1535
1588
  }
1536
1589
  return {
1537
- paletteColorLookupTable: opticalPath.style.paletteColorLookupTable,
1590
+ color: opticalPath.style.color,
1538
1591
  opacity: opticalPath.style.opacity,
1539
1592
  limitValues: opticalPath.style.limitValues
1540
1593
  }
@@ -1546,7 +1599,8 @@ class VolumeImageViewer {
1546
1599
  * Get image metadata for an optical path.
1547
1600
  *
1548
1601
  * @param {string} opticalPathIdentifier - Optical Path Identifier
1549
- * @returns {VLWholeSlideMicroscopyImage[]} Slide microscopy image metadata
1602
+ * @returns {metadata.VLWholeSlideMicroscopyImage[]} Slide microscopy image
1603
+ * metadata
1550
1604
  */
1551
1605
  getOpticalPathMetadata (opticalPathIdentifier) {
1552
1606
  const opticalPath = this[_opticalPaths][opticalPathIdentifier]
@@ -1569,7 +1623,7 @@ class VolumeImageViewer {
1569
1623
  for (const opticalPathIdentifier in this[_opticalPaths]) {
1570
1624
  opticalPaths.push(this[_opticalPaths][opticalPathIdentifier].opticalPath)
1571
1625
  }
1572
- return opticalPaths
1626
+ return opticalPaths.sort(item => (item.OpticalPathIdentifier))
1573
1627
  }
1574
1628
 
1575
1629
  /**
@@ -1644,10 +1698,13 @@ class VolumeImageViewer {
1644
1698
  * Show an optical path.
1645
1699
  *
1646
1700
  * @param {string} opticalPathIdentifier - Optical Path Identifier
1647
- * @param {Object} styleOptions
1648
- * @param {number[]} styleOptions.color - RGB color triplet
1649
- * @param {number} styleOptions.opacity - Opacity
1650
- * @param {number[]} styleOptions.limitValues - Upper and lower clipping values
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
1651
1708
  */
1652
1709
  showOpticalPath (opticalPathIdentifier, styleOptions = {}) {
1653
1710
  const opticalPath = this[_opticalPaths][opticalPathIdentifier]
@@ -1916,19 +1973,20 @@ class VolumeImageViewer {
1916
1973
  *
1917
1974
  * @param {Object} options - Drawing options
1918
1975
  * @param {string} options.geometryType - Name of the geometry type (point, circle, box, polygon, freehandpolygon, line, freehandline)
1919
- * @param {string} options.marker - Marker
1920
- * @param {string} options.markup - Markup
1921
- * @param {number} options.maxPoints - Geometry max points
1922
- * @param {number} options.minPoints - Geometry min points
1923
- * @param {Object} options.styleOptions - Style options
1924
- * @param {Object} options.styleOptions.stroke - Style options for the outline of the geometry
1925
- * @param {number[]} options.styleOptions.stroke.color - RGBA color of the outline
1926
- * @param {number} options.styleOptions.stroke.width - Width of the outline
1927
- * @param {Object} options.styleOptions.fill - Style options for body the geometry
1928
- * @param {number[]} options.styleOptions.fill.color - RGBA color of the body
1929
- * @param {Object} options.styleOptions.image - Style options for image
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
1930
1988
  */
1931
- activateDrawInteraction (options = {}) {
1989
+ activateDrawInteraction (options) {
1932
1990
  this.deactivateDrawInteraction()
1933
1991
  console.info('activate "draw" interaction')
1934
1992
 
@@ -2515,14 +2573,14 @@ class VolumeImageViewer {
2515
2573
  * Add a regions of interest.
2516
2574
  *
2517
2575
  * @param {roi.ROI} roi - Regions of interest
2518
- * @param {Object} styleOptions - Style options
2519
- * @param {Object} styleOptions.stroke - Style options for the outline of the geometry
2520
- * @param {number[]} styleOptions.stroke.color - RGBA color of the outline
2521
- * @param {number} styleOptions.stroke.width - Width of the outline
2522
- * @param {Object} styleOptions.fill - Style options for body the geometry
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
2523
2583
  * @param {number[]} styleOptions.fill.color - RGBA color of the body
2524
- * @param {Object} styleOptions.image - Style options for image
2525
- *
2526
2584
  */
2527
2585
  addROI (roi, styleOptions = {}) {
2528
2586
  console.info(`add ROI ${roi.uid}`)
@@ -2561,10 +2619,10 @@ class VolumeImageViewer {
2561
2619
  * @param {Object} roi - ROI to be updated
2562
2620
  * @param {string} roi.uid - Unique identifier of the region of interest
2563
2621
  * @param {Object} roi.properties - ROI properties
2564
- * @param {Object} roi.properties.measurements - ROI measurements
2565
- * @param {Object} roi.properties.evaluations - ROI evaluations
2566
- * @param {Object} roi.properties.label - ROI label
2567
- * @param {Object} roi.properties.marker - ROI marker
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
2568
2626
  */
2569
2627
  updateROI ({ uid, properties = {} }) {
2570
2628
  if (!uid) return
@@ -2610,12 +2668,13 @@ class VolumeImageViewer {
2610
2668
  *
2611
2669
  * @param {string} uid - Unique identifier of the regions of interest
2612
2670
  * @param {Object} styleOptions - Style options
2613
- * @param {Object} styleOptions.stroke - Style options for the outline of the geometry
2614
- * @param {number[]} styleOptions.stroke.color - RGBA color of the outline
2615
- * @param {number} styleOptions.stroke.width - Width of the outline
2616
- * @param {Object} styleOptions.fill - Style options for body the geometry
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
2617
2677
  * @param {number[]} styleOptions.fill.color - RGBA color of the body
2618
- *
2619
2678
  */
2620
2679
  setROIStyle (uid, styleOptions = {}) {
2621
2680
  this[_features].forEach((feature) => {
@@ -2781,7 +2840,9 @@ class VolumeImageViewer {
2781
2840
 
2782
2841
  const numberOfAnnotations = Number(metadataItem.NumberOfAnnotations)
2783
2842
  const graphicType = metadataItem.GraphicType
2784
- const coordinateDimensionality = _getCoordinateDimensionality(metadataItem)
2843
+ const coordinateDimensionality = _getCoordinateDimensionality(
2844
+ metadataItem
2845
+ )
2785
2846
  const commonZCoordinate = _getCommonZCoordinate(metadataItem)
2786
2847
 
2787
2848
  const features = this.getFeatures()
@@ -2810,10 +2871,12 @@ class VolumeImageViewer {
2810
2871
  i,
2811
2872
  numberOfAnnotations
2812
2873
  )
2874
+ const coordinates = _scoord3dCoordinates2geometryCoordinates(
2875
+ point,
2876
+ pyramid
2877
+ )
2813
2878
  const feature = new Feature({
2814
- geometry: new PointGeometry(
2815
- _scoord3dCoordinates2geometryCoordinates(point, pyramid)
2816
- )
2879
+ geometry: new PointGeometry(coordinates)
2817
2880
  })
2818
2881
  const properties = {}
2819
2882
  measurements.forEach(item => {
@@ -2950,112 +3013,6 @@ class VolumeImageViewer {
2950
3013
  annotationGroup.layer.setVisible(true)
2951
3014
  }
2952
3015
 
2953
- _retrieveAnnotationGroupBulkdata (annotationGroupUID) {
2954
- if (!(annotationGroupUID in this[_annotationGroups])) {
2955
- throw new Error(
2956
- 'Cannot retrieve bulkdata of annotation group. ' +
2957
- `Could not find annotation group "${annotationGroupUID}".`
2958
- )
2959
- }
2960
- const annotationGroup = this[_annotationGroups][annotationGroupUID]
2961
- console.log(
2962
- `retrieve bulkdata for annotation group "${annotationGroupUID}"`
2963
- )
2964
- const container = this[_map].getTargetElement()
2965
- if (container == null) {
2966
- throw new Error(
2967
- 'Cannot retrieve bulkdata of annotation group. ' +
2968
- 'Viewport has not been rendered. Call render() first.'
2969
- )
2970
- }
2971
- publish(container, EVENT.LOADING_STARTED)
2972
-
2973
- const index = annotationGroup.annotationGroup.number - 1
2974
- const metadataItem = annotationGroup.metadata.AnnotationGroupSequence[index]
2975
- /**
2976
- * Bulkdata may not be available, since it's possible that all information
2977
- * has been included into the metadata by value as InlineBinary. It must
2978
- * only be provided if information has been included by reference as
2979
- * BulkDataURI.
2980
- */
2981
- const bulkdataReferences = annotationGroup.metadata.bulkdataReferences
2982
- let bulkdataItem
2983
- if (bulkdataReferences.AnnotationGroupSequence != null) {
2984
- bulkdataItem = bulkdataReferences.AnnotationGroupSequence[index]
2985
- }
2986
-
2987
- const numberOfAnnotations = Number(metadataItem.NumberOfAnnotations)
2988
- const graphicType = metadataItem.GraphicType
2989
- const coordinateDimensionality = _getCoordinateDimensionality(metadataItem)
2990
- const commonZCoordinate = _getCommonZCoordinate(metadataItem)
2991
-
2992
- const source = annotationGroup.layer.getSource()
2993
- const features = source.getFeatures()
2994
-
2995
- const client = this[_options].client
2996
- const promises = [
2997
- _fetchGraphicData({ metadataItem, bulkdataItem, client }),
2998
- _fetchGraphicIndex({ metadataItem, bulkdataItem, client }),
2999
- _fetchMeasurements({ metadataItem, bulkdataItem, client })
3000
- ]
3001
- Promise.all(promises).then(retrievedBulkdata => {
3002
- const graphicData = retrievedBulkdata[0]
3003
- const graphicIndex = retrievedBulkdata[1]
3004
- const measurements = retrievedBulkdata[2]
3005
-
3006
- for (let i = 0; i < numberOfAnnotations; i++) {
3007
- const point = _getCentroid(
3008
- graphicType,
3009
- graphicData,
3010
- graphicIndex,
3011
- coordinateDimensionality,
3012
- commonZCoordinate,
3013
- i,
3014
- numberOfAnnotations
3015
- )
3016
- const feature = new Feature({
3017
- geometry: new PointGeometry(
3018
- _scoord3dCoordinates2geometryCoordinates(
3019
- point,
3020
- this[_pyramid].metadata
3021
- )
3022
- )
3023
- })
3024
- const properties = {}
3025
- measurements.forEach(item => {
3026
- const name = item.name
3027
- const key = `${name.CodingSchemeDesignator}${name.CodeValue}`
3028
- const value = item.values[i]
3029
- properties[key] = value
3030
- })
3031
- feature.setProperties(properties)
3032
- feature.setId(i + 1)
3033
- features.push(feature)
3034
- }
3035
-
3036
- console.log(
3037
- `add n=${features.length} annotations ` +
3038
- `for annotation group "${annotationGroupUID}"`
3039
- )
3040
- source.addFeatures(features)
3041
- const properties = {}
3042
- measurements.forEach(item => {
3043
- const name = item.name
3044
- const key = `${name.CodingSchemeDesignator}${name.CodeValue}`
3045
- const value = quantileSeq(
3046
- [...item.values],
3047
- [0, 0.015, 0.25, 0.5, 0.75, 0.95, 1]
3048
- )
3049
- properties[key] = value
3050
- })
3051
- source.setProperties(properties)
3052
- publish(container, EVENT.LOADING_ENDED)
3053
- }).catch(error => {
3054
- console.error(error)
3055
- publish(container, EVENT.LOADING_ENDED)
3056
- })
3057
- }
3058
-
3059
3016
  /**
3060
3017
  * Hide an annotation group.
3061
3018
  *
@@ -3437,8 +3394,8 @@ class VolumeImageViewer {
3437
3394
  * Show a segment.
3438
3395
  *
3439
3396
  * @param {string} segmentUID - Unique tracking identifier of a segment
3440
- * @param {Object} styleOptions
3441
- * @param {number} styleOptions.opacity - Opacity
3397
+ * @param {Object} [styleOptions]
3398
+ * @param {number} [styleOptions.opacity] - Opacity
3442
3399
  */
3443
3400
  showSegment (segmentUID, styleOptions = {}) {
3444
3401
  if (!(segmentUID in this[_segments])) {
@@ -3491,7 +3448,7 @@ class VolumeImageViewer {
3491
3448
  *
3492
3449
  * @param {string} segmentUID - Unique tracking identifier of segment
3493
3450
  * @param {Object} styleOptions - Style options
3494
- * @param {number} styleOptions.opacity - Opacity
3451
+ * @param {number} [styleOptions.opacity] - Opacity
3495
3452
  */
3496
3453
  setSegmentStyle (segmentUID, styleOptions = {}) {
3497
3454
  if (!(segmentUID in this[_segments])) {
@@ -3606,7 +3563,7 @@ class VolumeImageViewer {
3606
3563
  /**
3607
3564
  * Add parameter mappings.
3608
3565
  *
3609
- * @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
3610
3567
  */
3611
3568
  addParameterMappings (metadata) {
3612
3569
  if (metadata.length === 0) {
@@ -3867,9 +3824,9 @@ class VolumeImageViewer {
3867
3824
  * Show a parameter mapping.
3868
3825
  *
3869
3826
  * @param {string} mappingUID - Unique tracking identifier of a mapping
3870
- * @param {Object} styleOptions
3871
- * @param {number} styleOptions.opacity - Opacity
3872
- * @param {number} styleOptions.limitValues - Opacity
3827
+ * @param {Object} [styleOptions]
3828
+ * @param {number} [styleOptions.opacity] - Opacity
3829
+ * @param {number[]} [styleOptions.limitValues] - Upper and lower windowing
3873
3830
  */
3874
3831
  showParameterMapping (mappingUID, styleOptions = {}) {
3875
3832
  if (!(mappingUID in this[_mappings])) {
@@ -3922,7 +3879,8 @@ class VolumeImageViewer {
3922
3879
  *
3923
3880
  * @param {string} mappingUID - Unique tracking identifier of mapping
3924
3881
  * @param {Object} styleOptions
3925
- * @param {number} styleOptions.opacity - Opacity
3882
+ * @param {number} [styleOptions.opacity] - Opacity
3883
+ * @param {number[]} [styleOptions.limitValues] - Upper and lower windowing
3926
3884
  */
3927
3885
  setParameterMappingStyle (mappingUID, styleOptions = {}) {
3928
3886
  if (!(mappingUID in this[_mappings])) {