dicom-microscopy-viewer 0.36.0 → 0.36.1

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 (90) hide show
  1. package/README.md +5 -0
  2. package/build/6b62efd6c7f30afd4c78.module.wasm +0 -0
  3. package/build/dicom-microscopy-viewer.js +1 -1
  4. package/build/dicom-microscopy-viewer.js.map +1 -1
  5. package/docs/annotation.AnnotationGroup.html +2 -2
  6. package/docs/annotation.html +4 -3
  7. package/docs/annotation.js.html +8 -8
  8. package/docs/annotations__AnnotationManager.js.html +5 -5
  9. package/docs/annotations_markups__MarkupManager.js.html +52 -7
  10. package/docs/api.html +3 -3
  11. package/docs/color.PaletteColorLookupTable.html +688 -0
  12. package/docs/color.html +671 -0
  13. package/docs/color.js.html +30 -5
  14. package/docs/dicom-microscopy-viewer.js.html +30 -13
  15. package/docs/events.html +3 -3
  16. package/docs/events.js.html +2 -2
  17. package/docs/index.html +23 -24
  18. package/docs/mapping.ParameterMapping.html +10 -10
  19. package/docs/mapping.Transformation.html +180 -0
  20. package/docs/mapping.html +7 -4
  21. package/docs/mapping.js.html +7 -3
  22. package/docs/metadata.Comprehensive3DSR.html +2 -2
  23. package/docs/metadata.MicroscopyBulkSimpleAnnotations.html +2 -2
  24. package/docs/metadata.ParametricMap.html +2 -2
  25. package/docs/metadata.Segmentation.html +2 -2
  26. package/docs/metadata.VLWholeSlideMicroscopyImage.html +2 -2
  27. package/docs/metadata.html +3 -3
  28. package/docs/metadata.js.html +2 -2
  29. package/docs/opticalPath.OpticalPath.html +2 -2
  30. package/docs/opticalPath.html +3 -3
  31. package/docs/opticalPath.js.html +2 -2
  32. package/docs/pyramid.js.html +6 -4
  33. package/docs/roi.ROI.html +2 -2
  34. package/docs/roi.html +4 -4
  35. package/docs/roi.js.html +4 -4
  36. package/docs/scoord3d.Ellipse.html +2 -2
  37. package/docs/scoord3d.Ellipsoid.html +2 -2
  38. package/docs/scoord3d.Multipoint.html +2 -2
  39. package/docs/scoord3d.Point.html +2 -2
  40. package/docs/scoord3d.Polygon.html +2 -2
  41. package/docs/scoord3d.Polyline.html +2 -2
  42. package/docs/scoord3d.html +3 -3
  43. package/docs/scoord3d.js.html +4 -4
  44. package/docs/segment.Segment.html +2 -2
  45. package/docs/segment.html +4 -4
  46. package/docs/segment.js.html +2 -2
  47. package/docs/utils.html +2812 -5
  48. package/docs/utils.js.html +77 -14
  49. package/docs/viewer.LabelImageViewer.html +3 -3
  50. package/docs/viewer.OverviewImageViewer.html +3 -3
  51. package/docs/viewer.VolumeImageViewer.html +87 -87
  52. package/docs/viewer.html +3 -3
  53. package/docs/viewer.js.html +45 -14
  54. package/package.json +3 -3
  55. package/src/annotation.js +6 -6
  56. package/src/annotations/_AnnotationManager.js +3 -3
  57. package/src/annotations/markers/arrow.js +11 -2
  58. package/src/annotations/markups/_MarkupManager.js +49 -4
  59. package/src/annotations/markups/measurement.js +14 -6
  60. package/src/annotations/markups/textEvaluation.js +23 -8
  61. package/src/color.js +28 -3
  62. package/src/dicom-microscopy-viewer.js +28 -11
  63. package/src/mapping.js +5 -1
  64. package/src/pyramid.js +4 -2
  65. package/src/roi.js +2 -2
  66. package/src/scoord3d.js +2 -2
  67. package/src/utils.js +75 -12
  68. package/src/viewer.js +37 -10
  69. package/docs/PaletteColorLookupTable.html +0 -364
  70. package/docs/Transformation.html +0 -179
  71. package/docs/annotations_markers_arrow.js.html +0 -224
  72. package/docs/annotations_markups_measurement.js.html +0 -136
  73. package/docs/annotations_markups_textEvaluation.js.html +0 -184
  74. package/docs/annotations_markups_utils_getShortestLineBetweenOverlayAndFeature.js.html +0 -96
  75. package/docs/global.html +0 -6062
  76. package/examples/basic/index.html +0 -77
  77. package/examples/blend/index.html +0 -209
  78. package/examples/events/index.html +0 -436
  79. package/examples/index.html +0 -32
  80. package/examples/js/FileSaver.min.js +0 -3
  81. package/examples/js/jquery.min.js +0 -4
  82. package/examples/js/jquery.min.map +0 -1
  83. package/examples/simple_viewer/index.html +0 -520
  84. package/examples/simple_viewer/scripts/dicomdict.js +0 -34030
  85. package/examples/simple_viewer/scripts/metadata.js +0 -79
  86. package/examples/simple_viewer/styles/main.css +0 -238
  87. package/examples/structured_report/index.html +0 -278
  88. package/examples/styles.js +0 -46
  89. package/src/annotations/markups/utils/getShortestLineBetweenOverlayAndFeature.js +0 -45
  90. package/src/annotations/markups/utils/index.js +0 -1
package/docs/viewer.html CHANGED
@@ -72,7 +72,7 @@
72
72
 
73
73
  <dt class="tag-source">Source:</dt>
74
74
  <dd class="tag-source"><ul class="dummy"><li>
75
- <a href="dicom-microscopy-viewer.js.html">dicom-microscopy-viewer.js</a>, <a href="dicom-microscopy-viewer.js.html#line67">line 67</a>
75
+ <a href="dicom-microscopy-viewer.js.html">dicom-microscopy-viewer.js</a>, <a href="dicom-microscopy-viewer.js.html#line70">line 70</a>
76
76
  </li></ul></dd>
77
77
 
78
78
 
@@ -130,13 +130,13 @@
130
130
  </div>
131
131
 
132
132
  <nav>
133
- <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="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="mapping.ParameterMapping.html">ParameterMapping</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="PaletteColorLookupTable.html">PaletteColorLookupTable</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="Transformation.html">Transformation</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><h3>Global</h3><ul><li><a href="global.html#_applyStyle">_applyStyle</a></li><li><a href="global.html#_applyStyles">_applyStyles</a></li><li><a href="global.html#_computeImagePyramid">_computeImagePyramid</a></li><li><a href="global.html#_hasMarker">_hasMarker</a></li><li><a href="global.html#_hasMarkup">_hasMarkup</a></li><li><a href="global.html#_isMeasurement">_isMeasurement</a></li><li><a href="global.html#_onInteractionEventHandler">_onInteractionEventHandler</a></li><li><a href="global.html#_setFeatureStyle">_setFeatureStyle</a></li><li><a href="global.html#applyInverseTransform">applyInverseTransform</a></li><li><a href="global.html#applyTransform">applyTransform</a></li><li><a href="global.html#are1DArraysAlmostEqual">are1DArraysAlmostEqual</a></li><li><a href="global.html#are2DArraysAlmostEqual">are2DArraysAlmostEqual</a></li><li><a href="global.html#areCodedConceptsEqual">areCodedConceptsEqual</a></li><li><a href="global.html#areNumbersAlmostEqual">areNumbersAlmostEqual</a></li><li><a href="global.html#ArrowMarker">ArrowMarker</a></li><li><a href="global.html#buildInverseTransform">buildInverseTransform</a></li><li><a href="global.html#buildPaletteColorLookupTable">buildPaletteColorLookupTable</a></li><li><a href="global.html#buildTransform">buildTransform</a></li><li><a href="global.html#computeRotation">computeRotation</a></li><li><a href="global.html#createColormap">createColormap</a></li><li><a href="global.html#createRotationMatrix">createRotationMatrix</a></li><li><a href="global.html#createWindow">createWindow</a></li><li><a href="global.html#doContentItemsMatch">doContentItemsMatch</a></li><li><a href="global.html#format">format</a></li><li><a href="global.html#getContentItemNameCodedConcept">getContentItemNameCodedConcept</a></li><li><a href="global.html#getShortestLineBetweenOverlayAndFeature">getShortestLineBetweenOverlayAndFeature</a></li><li><a href="global.html#getUnitSuffix">getUnitSuffix</a></li><li><a href="global.html#MeasurementMarkup">MeasurementMarkup</a></li><li><a href="global.html#rescale">rescale</a></li><li><a href="global.html#TextEvaluationMarkup">TextEvaluationMarkup</a></li></ul>
133
+ <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>
134
134
  </nav>
135
135
 
136
136
  <br class="clear">
137
137
 
138
138
  <footer>
139
- Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.10</a> on Thu Mar 10 2022 12:00:32 GMT-0500 (Eastern Standard Time)
139
+ Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.10</a> on Fri Mar 11 2022 10:01:02 GMT-0500 (Eastern Standard Time)
140
140
  </footer>
141
141
 
142
142
  <script> prettyPrint(); </script>
@@ -93,11 +93,11 @@ import { ROI } from './roi.js'
93
93
  import { Segment } from './segment.js'
94
94
  import {
95
95
  computeRotation,
96
- generateUID,
97
- getUnitSuffix,
96
+ _generateUID,
97
+ _getUnitSuffix,
98
98
  doContentItemsMatch,
99
99
  createWindow,
100
- fetchBulkdata
100
+ _fetchBulkdata
101
101
  } from './utils.js'
102
102
  import {
103
103
  _scoord3dCoordinates2geometryCoordinates,
@@ -124,8 +124,8 @@ import openjpegFactory from '@cornerstonejs/codec-openjpeg/dist/openjpegwasm_dec
124
124
  import openjpegWASM from '@cornerstonejs/codec-openjpeg/dist/openjpegwasm_decode.wasm'
125
125
  import charlsFactory from '@cornerstonejs/codec-charls/dist/charlswasm_decode.js'
126
126
  import charlsWASM from '@cornerstonejs/codec-charls/dist/charlswasm_decode.wasm'
127
- import dicomiccFactory from 'dicomicc/dicomiccwasm.js'
128
- import dicomiccWASM from 'dicomicc/dicomiccwasm.wasm'
127
+ import dicomiccFactory from 'dicomicc/dist/dicomiccwasm.js'
128
+ import dicomiccWASM from 'dicomicc/dist/dicomiccwasm.wasm'
129
129
 
130
130
  const libjpeg = libjpegFactory({
131
131
  locateFile: (f) => {
@@ -184,7 +184,11 @@ async function _initializeDecodersAndTransformers ({
184
184
  for (let i = 0; i &lt; metadata.length; i++) {
185
185
  const image = metadata[i]
186
186
  if (image.SamplesPerPixel === 3) {
187
- const iccProfile = await fetchBulkdata({
187
+ if (image.bulkdataReferences.OpticalPathSequence == null) {
188
+ console.warn('ICC Profile was not found')
189
+ continue
190
+ }
191
+ const iccProfile = await _fetchBulkdata({
188
192
  client,
189
193
  reference: (
190
194
  image
@@ -556,7 +560,7 @@ function _updateFeatureMeasurements (map, feature, pyramid) {
556
560
 
557
561
  let measurement
558
562
  const view = map.getView()
559
- const unitSuffix = getUnitSuffix(view)
563
+ const unitSuffix = _getUnitSuffix(view)
560
564
 
561
565
  if (area != null) {
562
566
  const unitCodedConceptValue = `${unitSuffix}2`
@@ -623,6 +627,8 @@ function _updateFeatureMeasurements (map, feature, pyramid) {
623
627
  * @param {object} styleOptions.fill - Style options for body the geometry
624
628
  * @param {number[]} styleOptions.fill.color - RGBA color of the body
625
629
  * @param {object} styleOptions.image - Style options for image
630
+ *
631
+ * @private
626
632
  */
627
633
  function _setFeatureStyle (feature, styleOptions) {
628
634
  if (styleOptions !== undefined) {
@@ -638,6 +644,18 @@ function _setFeatureStyle (feature, styleOptions) {
638
644
  }
639
645
  }
640
646
 
647
+ /**
648
+ * Build OpenLayers style expression for coloring a WebGL TileLayer.
649
+ *
650
+ * @param {object} styleOptions - Style options
651
+ * @param {number} styleOptions.windowCenter - Center of the window used for contrast stretching
652
+ * @param {number} styleOptions.windowWidth - Width of the window used for contrast stretching
653
+ * @param {number[][]} styleOptions.colormap - RGB color triplets
654
+ *
655
+ * @returns {object} color style expression and corresponding variables
656
+ *
657
+ * @private
658
+ */
641
659
  function _getColorPaletteStyleForTileLayer ({
642
660
  windowCenter,
643
661
  windowWidth,
@@ -703,6 +721,19 @@ function _getColorPaletteStyleForTileLayer ({
703
721
  return { color: expression, variables }
704
722
  }
705
723
 
724
+ /**
725
+ * Build OpenLayers style expression for coloring a WebGL PointLayer.
726
+ *
727
+ * @param {object} styleOptions - Style options
728
+ * @param {string} styleOptions.name - Name of a property for which values should be colorized
729
+ * @param {number} styleOptions.minValue - Mininum value of the output range
730
+ * @param {number} styleOptions.maxValue - Maxinum value of the output range
731
+ * @param {number[][]} styleOptions.colormap - RGB color triplets
732
+ *
733
+ * @returns {object} color style expression
734
+ *
735
+ * @private
736
+ */
706
737
  function _getColorPaletteStyleForPointLayer ({
707
738
  name,
708
739
  minValue,
@@ -829,7 +860,7 @@ class VolumeImageViewer {
829
860
  // The ID may have already been set when drawn. However, features could
830
861
  // have also been added without a draw event.
831
862
  if (e.element.getId() === undefined) {
832
- e.element.setId(generateUID())
863
+ e.element.setId(_generateUID())
833
864
  }
834
865
 
835
866
  this[_annotationManager].onAdd(e.element)
@@ -997,7 +1028,7 @@ class VolumeImageViewer {
997
1028
  paletteColorLookupTableUID = (
998
1029
  item.PaletteColorLookupTableUID
999
1030
  ? item.PaletteColorLookupTableUID
1000
- : generateUID()
1031
+ : _generateUID()
1001
1032
  )
1002
1033
  /*
1003
1034
  * TODO: If the LUT Data are large, the elements may be bulkdata and
@@ -1979,7 +2010,7 @@ class VolumeImageViewer {
1979
2010
 
1980
2011
  this[_interactions].draw.on(Enums.InteractionEvents.DRAW_START, (event) => {
1981
2012
  event.feature.setProperties(builtInDrawOptions, true)
1982
- event.feature.setId(generateUID())
2013
+ event.feature.setId(_generateUID())
1983
2014
 
1984
2015
  /** Set external styles before calling internal annotation hooks */
1985
2016
  _setFeatureStyle(
@@ -3271,7 +3302,7 @@ class VolumeImageViewer {
3271
3302
  refSegmentation.SegmentSequence.forEach((item, index) => {
3272
3303
  const segmentNumber = Number(item.SegmentNumber)
3273
3304
  console.info(`add segment # ${segmentNumber}`)
3274
- let segmentUID = generateUID()
3305
+ let segmentUID = _generateUID()
3275
3306
  if (item.TrackingUID) {
3276
3307
  segmentUID = item.TrackingUID
3277
3308
  }
@@ -3646,7 +3677,7 @@ class VolumeImageViewer {
3646
3677
  const mappingLabel = `${mappingNumber}`
3647
3678
  const mappingDescriptions = mappingNumberToDescriptions[mappingNumber]
3648
3679
  const refItem = mappingDescriptions[0]
3649
- let mappingUID = generateUID()
3680
+ let mappingUID = _generateUID()
3650
3681
  if (refItem.TrackingUID != null) {
3651
3682
  mappingUID = refItem.TrackingUID
3652
3683
  }
@@ -4250,13 +4281,13 @@ export { LabelImageViewer, OverviewImageViewer, VolumeImageViewer }
4250
4281
  </div>
4251
4282
 
4252
4283
  <nav>
4253
- <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="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="mapping.ParameterMapping.html">ParameterMapping</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="PaletteColorLookupTable.html">PaletteColorLookupTable</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="Transformation.html">Transformation</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><h3>Global</h3><ul><li><a href="global.html#_applyStyle">_applyStyle</a></li><li><a href="global.html#_applyStyles">_applyStyles</a></li><li><a href="global.html#_computeImagePyramid">_computeImagePyramid</a></li><li><a href="global.html#_hasMarker">_hasMarker</a></li><li><a href="global.html#_hasMarkup">_hasMarkup</a></li><li><a href="global.html#_isMeasurement">_isMeasurement</a></li><li><a href="global.html#_onInteractionEventHandler">_onInteractionEventHandler</a></li><li><a href="global.html#_setFeatureStyle">_setFeatureStyle</a></li><li><a href="global.html#applyInverseTransform">applyInverseTransform</a></li><li><a href="global.html#applyTransform">applyTransform</a></li><li><a href="global.html#are1DArraysAlmostEqual">are1DArraysAlmostEqual</a></li><li><a href="global.html#are2DArraysAlmostEqual">are2DArraysAlmostEqual</a></li><li><a href="global.html#areCodedConceptsEqual">areCodedConceptsEqual</a></li><li><a href="global.html#areNumbersAlmostEqual">areNumbersAlmostEqual</a></li><li><a href="global.html#ArrowMarker">ArrowMarker</a></li><li><a href="global.html#buildInverseTransform">buildInverseTransform</a></li><li><a href="global.html#buildPaletteColorLookupTable">buildPaletteColorLookupTable</a></li><li><a href="global.html#buildTransform">buildTransform</a></li><li><a href="global.html#computeRotation">computeRotation</a></li><li><a href="global.html#createColormap">createColormap</a></li><li><a href="global.html#createRotationMatrix">createRotationMatrix</a></li><li><a href="global.html#createWindow">createWindow</a></li><li><a href="global.html#doContentItemsMatch">doContentItemsMatch</a></li><li><a href="global.html#format">format</a></li><li><a href="global.html#getContentItemNameCodedConcept">getContentItemNameCodedConcept</a></li><li><a href="global.html#getShortestLineBetweenOverlayAndFeature">getShortestLineBetweenOverlayAndFeature</a></li><li><a href="global.html#getUnitSuffix">getUnitSuffix</a></li><li><a href="global.html#MeasurementMarkup">MeasurementMarkup</a></li><li><a href="global.html#rescale">rescale</a></li><li><a href="global.html#TextEvaluationMarkup">TextEvaluationMarkup</a></li></ul>
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>
4254
4285
  </nav>
4255
4286
 
4256
4287
  <br class="clear">
4257
4288
 
4258
4289
  <footer>
4259
- Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.10</a> on Thu Mar 10 2022 12:00:32 GMT-0500 (Eastern Standard Time)
4290
+ Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.10</a> on Fri Mar 11 2022 10:01:02 GMT-0500 (Eastern Standard Time)
4260
4291
  </footer>
4261
4292
 
4262
4293
  <script> prettyPrint(); </script>
package/package.json CHANGED
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "name": "dicom-microscopy-viewer",
3
- "version": "0.36.0",
3
+ "version": "0.36.1",
4
4
  "description": "Interactive web-based viewer for DICOM Microscopy Images",
5
- "main": "./src/dicom-microscopy-viewer.js",
5
+ "main": "./build/dicom-microscopy-viewer.js",
6
6
  "standard": {
7
7
  "env": [
8
8
  "jest"
@@ -64,7 +64,7 @@
64
64
  "@cornerstonejs/codec-openjpeg": "^0.1.1",
65
65
  "colormap": "^2.3.2",
66
66
  "dcmjs": "^0.19",
67
- "dicomicc": "^0.1.0-1",
67
+ "dicomicc": "^0.1.0",
68
68
  "dicomweb-client": "^0.8",
69
69
  "image-type": "^4.1",
70
70
  "mathjs": "^10.1",
package/src/annotation.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import {
2
- fetchBulkdata,
2
+ _fetchBulkdata,
3
3
  getContentItemNameCodedConcept
4
4
  } from './utils.js'
5
5
 
@@ -201,12 +201,12 @@ async function _fetchGraphicData ({
201
201
  )
202
202
  } else {
203
203
  if ('PointCoordinatesData' in bulkdataItem) {
204
- return await fetchBulkdata({
204
+ return await _fetchBulkdata({
205
205
  client,
206
206
  reference: bulkdataItem.PointCoordinatesData
207
207
  })
208
208
  } else if ('DoublePointCoordinatesData' in bulkdataItem) {
209
- return await fetchBulkdata({
209
+ return await _fetchBulkdata({
210
210
  client,
211
211
  reference: bulkdataItem.DoublePointCoordinatesData
212
212
  })
@@ -253,7 +253,7 @@ async function _fetchGraphicIndex ({
253
253
  }
254
254
  } else {
255
255
  if ('LongPrimitivePointIndexList' in bulkdataItem) {
256
- return await fetchBulkdata({
256
+ return await _fetchBulkdata({
257
257
  client,
258
258
  reference: bulkdataItem.LongPrimitivePointIndexList
259
259
  })
@@ -311,7 +311,7 @@ async function _fetchMeasurementValues ({
311
311
  measurementBulkdataItem.MeasurementValuesSequence[0]
312
312
  )
313
313
  if ('FloatingPointValues' in valuesBulkdataItem) {
314
- return await fetchBulkdata({
314
+ return await _fetchBulkdata({
315
315
  client,
316
316
  reference: valuesBulkdataItem.FloatingPointValues
317
317
  })
@@ -367,7 +367,7 @@ async function _fetchMeasurementIndices ({
367
367
  .MeasurementValuesSequence[0]
368
368
  )
369
369
  if ('AnnotationIndexList' in valuesBulkdataItem) {
370
- return await fetchBulkdata({
370
+ return await _fetchBulkdata({
371
371
  client,
372
372
  reference: valuesBulkdataItem.AnnotationIndexList
373
373
  })
@@ -6,14 +6,14 @@ import _MarkupManager from './markups/_MarkupManager'
6
6
  import Enums from '../enums'
7
7
 
8
8
  /** Markers */
9
- import ArrowMarker, { format as arrowFormat } from './markers/arrow'
9
+ import ArrowMarker, { _format as arrowFormat } from './markers/arrow'
10
10
 
11
11
  /** Markups */
12
12
  import MeasurementMarkup, {
13
- format as measurementFormat
13
+ _format as measurementFormat
14
14
  } from './markups/measurement'
15
15
  import TextEvaluationMarkup, {
16
- format as textFormat
16
+ _format as textFormat
17
17
  } from './markups/textEvaluation'
18
18
 
19
19
  /** Utils */
@@ -11,9 +11,12 @@ import defaultStyles from '../styles'
11
11
  * Format arrow output.
12
12
  *
13
13
  * @param {LineString} arrow geometry
14
+ *
14
15
  * @return {string} The formatted output
16
+ *
17
+ * @private
15
18
  */
16
- export const format = (feature) =>
19
+ export const _format = (feature) =>
17
20
  feature.get(Enums.InternalProperties.Label) || ''
18
21
 
19
22
  /**
@@ -21,7 +24,10 @@ export const format = (feature) =>
21
24
  *
22
25
  * @param {object} feature The feature instance
23
26
  * @param {object} map The viewer map instance
27
+ *
24
28
  * @returns {object} Style instance
29
+ *
30
+ * @private
25
31
  */
26
32
  const _applyStyles = (feature, map) => {
27
33
  const geometry = feature.getGeometry()
@@ -116,11 +122,14 @@ const _isArrow = (feature) =>
116
122
  Enums.Marker.Arrow === feature.get(Enums.InternalProperties.Marker)
117
123
 
118
124
  /**
119
- * Arrow marker definition.
125
+ * Arrow marker.
120
126
  *
121
127
  * @param {object} dependencies Shared dependencies
122
128
  * @param {object} dependencies.map Map shared instance
123
129
  * @param {object} dependencies.markupManager Markup manager shared instance
130
+ *
131
+ * @class
132
+ * @private
124
133
  */
125
134
  const ArrowMarker = ({ map, markupManager }) => {
126
135
  return {
@@ -1,4 +1,6 @@
1
+ import Circle from 'ol/geom/Circle'
1
2
  import DragPan from 'ol/interaction/DragPan'
3
+ import LineString from 'ol/geom/LineString'
2
4
  import Overlay from 'ol/Overlay'
3
5
  import VectorLayer from 'ol/layer/Vector'
4
6
  import 'ol/ol.css'
@@ -7,13 +9,56 @@ import Style from 'ol/style/Style'
7
9
  import Stroke from 'ol/style/Stroke'
8
10
  import Collection from 'ol/Collection'
9
11
  import Feature from 'ol/Feature'
12
+ import { fromCircle } from 'ol/geom/Polygon'
10
13
 
11
14
  import Enums from '../../enums'
12
- import { getShortestLineBetweenOverlayAndFeature } from './utils'
13
- import { getUnitSuffix } from '../../utils'
15
+ import { _getUnitSuffix } from '../../utils'
14
16
  import { coordinateWithOffset } from '../../scoord3dUtils'
15
17
  import defaultStyles from '../styles'
16
18
 
19
+ /**
20
+ * Build a new LineString instance with the shortest
21
+ * distance between a given overlay and a feature.
22
+ *
23
+ * @param {object} feature The feature
24
+ * @param {object} overlay The overlay instance
25
+ *
26
+ * @returns {LineString} The smallest line between the overlay and feature
27
+ *
28
+ * @private
29
+ */
30
+ const _getShortestLineBetweenOverlayAndFeature = (feature, overlay) => {
31
+ let result
32
+ let distanceSq = Infinity
33
+
34
+ let featureGeometry = feature.getGeometry()
35
+
36
+ if (featureGeometry instanceof Circle) {
37
+ featureGeometry = fromCircle(featureGeometry).clone()
38
+ }
39
+
40
+ const geometry = featureGeometry.getLinearRing ? featureGeometry.getLinearRing(0) : featureGeometry;
41
+
42
+ (geometry.getCoordinates() || geometry.getExtent()).forEach(coordinates => {
43
+ const closest = overlay.getPosition()
44
+ const distanceNew = Math.pow(closest[0] - coordinates[0], 2) + Math.pow(closest[1] - coordinates[1], 2)
45
+ if (distanceNew < distanceSq) {
46
+ distanceSq = distanceNew
47
+ result = [coordinates, closest]
48
+ }
49
+ })
50
+
51
+ const coordinates = overlay.getPosition()
52
+ const closest = geometry.getClosestPoint(coordinates)
53
+ const distanceNew = Math.pow(closest[0] - coordinates[0], 2) + Math.pow(closest[1] - coordinates[1], 2)
54
+ if (distanceNew < distanceSq) {
55
+ distanceSq = distanceNew
56
+ result = [closest, coordinates]
57
+ }
58
+
59
+ return new LineString(result)
60
+ }
61
+
17
62
  class _MarkupManager {
18
63
  constructor ({ map, pyramid, drawingSource, formatters, onClick, onStyle } = {}) {
19
64
  this._map = map
@@ -204,7 +249,7 @@ class _MarkupManager {
204
249
  (event) => {
205
250
  if (this.has(id)) {
206
251
  const view = this._map.getView()
207
- const unitSuffix = getUnitSuffix(view)
252
+ const unitSuffix = _getUnitSuffix(view)
208
253
  const format = this._getFormatter(event.target)
209
254
  const output = format(event.target, unitSuffix, this._pyramid)
210
255
  this.update({
@@ -434,7 +479,7 @@ class _MarkupManager {
434
479
  return
435
480
  }
436
481
 
437
- const line = getShortestLineBetweenOverlayAndFeature(
482
+ const line = _getShortestLineBetweenOverlayAndFeature(
438
483
  feature,
439
484
  markup.overlay
440
485
  )
@@ -1,5 +1,5 @@
1
1
  import Enums from '../../enums'
2
- import { getUnitSuffix } from '../../utils'
2
+ import { _getUnitSuffix } from '../../utils'
3
3
  import {
4
4
  _getFeatureArea,
5
5
  _getFeatureLength
@@ -10,9 +10,12 @@ import {
10
10
  *
11
11
  * @param {Feature} feature feature
12
12
  * @param {string} units units
13
+ *
13
14
  * @return {string} The formatted measure of this feature
15
+ *
16
+ * @private
14
17
  */
15
- export const format = (feature, units, pyramid) => {
18
+ export const _format = (feature, units, pyramid) => {
16
19
  const area = _getFeatureArea(feature, pyramid)
17
20
  const length = _getFeatureLength(feature, pyramid)
18
21
  const value = length || area || 0
@@ -25,7 +28,10 @@ export const format = (feature, units, pyramid) => {
25
28
  * Checks if feature has measurement markup properties.
26
29
  *
27
30
  * @param {object} feature
31
+ *
28
32
  * @returns {boolean} true if feature has measurement markup properties
33
+ *
34
+ * @private
29
35
  */
30
36
  const _isMeasurement = (feature) =>
31
37
  Enums.Markup.Measurement === feature.get(Enums.InternalProperties.Markup)
@@ -37,16 +43,18 @@ const _isMeasurement = (feature) =>
37
43
  * @param {object} dependencies.map Viewer's map instance
38
44
  * @param {object} dependencies.pyramid Pyramid metadata
39
45
  * @param {object} dependencies.markupManager MarkupManager shared instance
46
+ *
47
+ * @private
40
48
  */
41
49
  const MeasurementMarkup = ({ map, pyramid, markupManager }) => {
42
50
  return {
43
51
  onAdd: (feature) => {
44
52
  if (_isMeasurement(feature)) {
45
53
  const view = map.getView()
46
- const unitSuffix = getUnitSuffix(view)
54
+ const unitSuffix = _getUnitSuffix(view)
47
55
  markupManager.create({
48
56
  feature,
49
- value: format(feature, unitSuffix, pyramid)
57
+ value: _format(feature, unitSuffix, pyramid)
50
58
  })
51
59
  }
52
60
  },
@@ -68,12 +76,12 @@ const MeasurementMarkup = ({ map, pyramid, markupManager }) => {
68
76
  },
69
77
  onUpdate: (feature) => {
70
78
  const view = map.getView()
71
- const unitSuffix = getUnitSuffix(view)
79
+ const unitSuffix = _getUnitSuffix(view)
72
80
  const id = feature.getId()
73
81
  const markup = markupManager.get(id)
74
82
  markupManager.update({
75
83
  feature,
76
- value: format(feature, unitSuffix, pyramid),
84
+ value: _format(feature, unitSuffix, pyramid),
77
85
  coordinate: markup.overlay.getPosition()
78
86
  })
79
87
  },
@@ -9,16 +9,22 @@ import Enums from '../../enums'
9
9
  * Format free text output.
10
10
  *
11
11
  * @param {Feature} feature feature
12
+ *
12
13
  * @return {string} The formatted output
14
+ *
15
+ * @private
13
16
  */
14
- export const format = (feature) =>
17
+ export const _format = (feature) =>
15
18
  feature.get(Enums.InternalProperties.Label) || ''
16
19
 
17
20
  /**
18
21
  * Builds the text evaluation style.
19
22
  *
20
23
  * @param {object} feature
24
+ *
21
25
  * @returns {object} Style instance
26
+ *
27
+ * @private
22
28
  */
23
29
  const _applyStyle = (feature) => {
24
30
  if (_hasMarker(feature)) {
@@ -42,19 +48,25 @@ const _applyStyle = (feature) => {
42
48
  }
43
49
 
44
50
  /**
45
- * Checks if feature has text evaluation properties.
51
+ * Check if feature has text evaluation properties.
46
52
  *
47
53
  * @param {object} feature
48
- * @returns {boolean} true if feature has text evaluation properties
54
+ *
55
+ * @returns {boolean} yes/no answer
56
+ *
57
+ * @private
49
58
  */
50
59
  const _hasMarkup = (feature) =>
51
60
  Enums.Markup.TextEvaluation === feature.get(Enums.InternalProperties.Markup)
52
61
 
53
62
  /**
54
- * Checks if feature has marker properties.
63
+ * Check if feature has marker properties.
55
64
  *
56
65
  * @param {object} feature
57
- * @returns {boolean} true if feature has marker properties
66
+ *
67
+ * @returns {boolean} yes/no answer
68
+ *
69
+ * @private
58
70
  */
59
71
  const _hasMarker = (feature) => !!feature.get(Enums.InternalProperties.Marker)
60
72
 
@@ -64,13 +76,14 @@ const _hasMarker = (feature) => !!feature.get(Enums.InternalProperties.Marker)
64
76
  *
65
77
  * @param {object} feature
66
78
  * @param {object} markupManager MarkupManager instance
67
- * @returns {void}
79
+ *
80
+ * @private
68
81
  */
69
82
  const _onInteractionEventHandler = ({ feature, markupManager }) => {
70
83
  const featureHasMarker = _hasMarker(feature)
71
84
  markupManager.create({
72
85
  feature,
73
- value: format(feature),
86
+ value: _format(feature),
74
87
  isLinkable: featureHasMarker,
75
88
  isDraggable: featureHasMarker
76
89
  })
@@ -82,6 +95,8 @@ const _onInteractionEventHandler = ({ feature, markupManager }) => {
82
95
  *
83
96
  * @param {object} dependencies Shared dependencies
84
97
  * @param {object} dependencies.markupManager MarkupManager shared instance
98
+ *
99
+ * @private
85
100
  */
86
101
  const TextEvaluationMarkup = ({ markupManager }) => {
87
102
  return {
@@ -113,7 +128,7 @@ const TextEvaluationMarkup = ({ markupManager }) => {
113
128
  },
114
129
  onUpdate: (feature) => {
115
130
  if (_hasMarkup(feature)) {
116
- markupManager.update({ feature, value: format(feature) })
131
+ markupManager.update({ feature, value: _format(feature) })
117
132
  }
118
133
  },
119
134
  onDrawStart: ({ feature }) => {
package/src/color.js CHANGED
@@ -1,9 +1,14 @@
1
1
  import colormap from 'colormap'
2
2
 
3
- import { generateUID, rescale } from './utils.js'
3
+ import { _generateUID, rescale } from './utils.js'
4
4
 
5
5
  const _attrs = Symbol('attrs')
6
6
 
7
+ /**
8
+ * Enumerated values for color map names.
9
+ *
10
+ * @memberof color
11
+ */
7
12
  const ColormapNames = {
8
13
  VIRIDIS: 'VIRIDIS',
9
14
  INFERNO: 'INFERNO',
@@ -16,13 +21,16 @@ const ColormapNames = {
16
21
  }
17
22
  Object.freeze(ColormapNames)
18
23
 
19
- /** Create a color map.
24
+ /**
25
+ * Create a color map.
20
26
  *
21
27
  * @param {object} options
22
28
  * @param {string} options.name - Name of the color map
23
29
  * @param {string} options.bins - Number of color bins
24
30
  *
25
31
  * @returns {number[][]} RGB triplet for each color
32
+ *
33
+ * @memberof color
26
34
  */
27
35
  function createColormap ({ name, bins }) {
28
36
  const lut = {
@@ -61,6 +69,8 @@ function createColormap ({ name, bins }) {
61
69
  * @param {number} options.firstValueMapped - First value that should be mapped
62
70
  *
63
71
  * @returns {PaletteColorLookupTable} Mapping of grayscale pixel values to RGB color triplets
72
+ *
73
+ * @memberof color
64
74
  */
65
75
  function buildPaletteColorLookupTable ({ data, firstValueMapped }) {
66
76
  if (data == null) {
@@ -90,7 +100,7 @@ function buildPaletteColorLookupTable ({ data, firstValueMapped }) {
90
100
  const descriptor = [numberOfEntries, firstValueMapped, 8]
91
101
 
92
102
  return new PaletteColorLookupTable({
93
- uid: generateUID(),
103
+ uid: _generateUID(),
94
104
  redDescriptor: descriptor,
95
105
  greenDescriptor: descriptor,
96
106
  blueDescriptor: descriptor,
@@ -102,10 +112,25 @@ function buildPaletteColorLookupTable ({ data, firstValueMapped }) {
102
112
 
103
113
  /**
104
114
  * A Palette Color Lookup Table
115
+ *
116
+ * @class
117
+ * @memberof color
105
118
  */
106
119
  class PaletteColorLookupTable {
107
120
  /**
108
121
  * Create a new PaletteColorLookupTable object.
122
+ *
123
+ * @param {object} options
124
+ * @param {string} options.uid - UID
125
+ * @param {number[]} options.redDescriptor - Red LUT descriptor
126
+ * @param {number[]} options.greenDescriptor - Green LUT descriptor
127
+ * @param {number[]} options.blueDescriptor - Blue LUT descriptor
128
+ * @param {Uint8Array|Uint16Array} options.redData - Red LUT data
129
+ * @param {Uint8Array|Uint16Array} options.greenData - Green LUT data
130
+ * @param {Uint8Array|Uint16Array} options.blueData - Blue LUT data
131
+ * @param {Uint8Array|Uint16Array} options.redSegmentedData - Red segmented LUT data
132
+ * @param {Uint8Array|Uint16Array} options.greenSegmentedData - Green segmented LUT data
133
+ * @param {Uint8Array|Uint16Array} options.blueSegmentedData - Blue segmented LUT data
109
134
  */
110
135
  constructor ({
111
136
  uid,