dicom-microscopy-viewer 0.36.0 → 0.36.3
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 +6 -1
- package/{build → dist}/08929516bda4c4fd2597.module.wasm +0 -0
- package/dist/4f2853de305c1b5afcac.module.wasm +0 -0
- package/{build → dist}/6ae9c6e051fd2bd70fad.module.wasm +0 -0
- package/dist/6b62efd6c7f30afd4c78.module.wasm +0 -0
- package/{build → dist}/7e1d2da75b59525e1933.module.wasm +0 -0
- package/{build → dist}/d051f2d564fae150ce94.module.wasm +0 -0
- package/dist/dicom-microscopy-viewer.js +2 -0
- package/{build → dist}/dicom-microscopy-viewer.js.LICENSE.txt +0 -0
- package/dist/dicom-microscopy-viewer.js.map +1 -0
- package/{build → dist}/e6305f756142e57c92cd.module.wasm +0 -0
- package/{build → dist}/f3e0c999ad06a34a7f75.module.wasm +0 -0
- package/docs/annotation.AnnotationGroup.html +2 -2
- package/docs/annotation.html +4 -3
- package/docs/annotation.js.html +8 -8
- package/docs/annotations__AnnotationManager.js.html +5 -5
- package/docs/annotations_markups__MarkupManager.js.html +52 -7
- package/docs/api.html +3 -3
- package/docs/color.PaletteColorLookupTable.html +688 -0
- package/docs/color.html +671 -0
- package/docs/color.js.html +30 -5
- package/docs/dicom-microscopy-viewer.js.html +30 -13
- package/docs/events.html +3 -3
- package/docs/events.js.html +2 -2
- package/docs/index.html +23 -24
- package/docs/mapping.ParameterMapping.html +10 -10
- package/docs/mapping.Transformation.html +180 -0
- package/docs/mapping.html +7 -4
- package/docs/mapping.js.html +7 -3
- package/docs/metadata.Comprehensive3DSR.html +2 -2
- package/docs/metadata.MicroscopyBulkSimpleAnnotations.html +2 -2
- package/docs/metadata.ParametricMap.html +2 -2
- package/docs/metadata.Segmentation.html +2 -2
- package/docs/metadata.VLWholeSlideMicroscopyImage.html +2 -2
- package/docs/metadata.html +3 -3
- package/docs/metadata.js.html +2 -2
- package/docs/opticalPath.OpticalPath.html +2 -2
- package/docs/opticalPath.html +3 -3
- package/docs/opticalPath.js.html +2 -2
- package/docs/pyramid.js.html +6 -4
- package/docs/roi.ROI.html +2 -2
- package/docs/roi.html +4 -4
- package/docs/roi.js.html +4 -4
- package/docs/scoord3d.Ellipse.html +2 -2
- package/docs/scoord3d.Ellipsoid.html +2 -2
- package/docs/scoord3d.Multipoint.html +2 -2
- package/docs/scoord3d.Point.html +2 -2
- package/docs/scoord3d.Polygon.html +2 -2
- package/docs/scoord3d.Polyline.html +2 -2
- package/docs/scoord3d.html +3 -3
- package/docs/scoord3d.js.html +4 -4
- package/docs/segment.Segment.html +2 -2
- package/docs/segment.html +4 -4
- package/docs/segment.js.html +2 -2
- package/docs/utils.html +2812 -5
- package/docs/utils.js.html +77 -14
- package/docs/viewer.LabelImageViewer.html +3 -3
- package/docs/viewer.OverviewImageViewer.html +3 -3
- package/docs/viewer.VolumeImageViewer.html +87 -87
- package/docs/viewer.html +3 -3
- package/docs/viewer.js.html +45 -14
- package/package.json +8 -7
- package/src/annotation.js +6 -6
- package/src/annotations/_AnnotationManager.js +3 -3
- package/src/annotations/markers/arrow.js +11 -2
- package/src/annotations/markups/_MarkupManager.js +49 -4
- package/src/annotations/markups/measurement.js +14 -6
- package/src/annotations/markups/textEvaluation.js +23 -8
- package/src/color.js +28 -3
- package/src/dicom-microscopy-viewer.js +28 -11
- package/src/mapping.js +5 -1
- package/src/pyramid.js +4 -2
- package/src/roi.js +2 -2
- package/src/scoord3d.js +2 -2
- package/src/utils.js +75 -12
- package/src/viewer.js +37 -10
- package/webpack.config.js +11 -1
- package/build/33ef438573e49fde75eb.module.wasm +0 -0
- package/build/510fe8aff40dafc5b19b.module.wasm +0 -0
- package/build/713dba1fa973be4d97f4.module.wasm +0 -0
- package/build/86e23957894a6f373e11.module.wasm +0 -0
- package/build/c337ef929a626d7e5353.module.wasm +0 -0
- package/build/ce3907ececff7b46856f.wasm +0 -0
- package/build/dicom-microscopy-viewer.js +0 -2
- package/build/dicom-microscopy-viewer.js.map +0 -1
- package/docs/PaletteColorLookupTable.html +0 -364
- package/docs/Transformation.html +0 -179
- package/docs/annotations_markers_arrow.js.html +0 -224
- package/docs/annotations_markups_measurement.js.html +0 -136
- package/docs/annotations_markups_textEvaluation.js.html +0 -184
- package/docs/annotations_markups_utils_getShortestLineBetweenOverlayAndFeature.js.html +0 -96
- package/docs/global.html +0 -6062
- package/examples/basic/index.html +0 -77
- package/examples/blend/index.html +0 -209
- package/examples/events/index.html +0 -436
- package/examples/index.html +0 -32
- package/examples/js/FileSaver.min.js +0 -3
- package/examples/js/jquery.min.js +0 -4
- package/examples/js/jquery.min.map +0 -1
- package/examples/simple_viewer/index.html +0 -520
- package/examples/simple_viewer/scripts/dicomdict.js +0 -34030
- package/examples/simple_viewer/scripts/metadata.js +0 -79
- package/examples/simple_viewer/styles/main.css +0 -238
- package/examples/structured_report/index.html +0 -278
- package/examples/styles.js +0 -46
- package/src/annotations/markups/utils/getShortestLineBetweenOverlayAndFeature.js +0 -45
- package/src/annotations/markups/utils/index.js +0 -1
|
@@ -1,224 +0,0 @@
|
|
|
1
|
-
<!DOCTYPE html>
|
|
2
|
-
<html lang="en">
|
|
3
|
-
<head>
|
|
4
|
-
<meta charset="utf-8">
|
|
5
|
-
<title>JSDoc: Source: annotations/markers/arrow.js</title>
|
|
6
|
-
|
|
7
|
-
<script src="scripts/prettify/prettify.js"> </script>
|
|
8
|
-
<script src="scripts/prettify/lang-css.js"> </script>
|
|
9
|
-
<!--[if lt IE 9]>
|
|
10
|
-
<script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
|
|
11
|
-
<![endif]-->
|
|
12
|
-
<link type="text/css" rel="stylesheet" href="styles/prettify-tomorrow.css">
|
|
13
|
-
<link type="text/css" rel="stylesheet" href="styles/jsdoc-default.css">
|
|
14
|
-
</head>
|
|
15
|
-
|
|
16
|
-
<body>
|
|
17
|
-
|
|
18
|
-
<div id="main">
|
|
19
|
-
|
|
20
|
-
<h1 class="page-title">Source: annotations/markers/arrow.js</h1>
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
<section>
|
|
28
|
-
<article>
|
|
29
|
-
<pre class="prettyprint source linenums"><code>import Style from 'ol/style/Style'
|
|
30
|
-
import Stroke from 'ol/style/Stroke'
|
|
31
|
-
import Point from 'ol/geom/Point'
|
|
32
|
-
import LineString from 'ol/geom/LineString'
|
|
33
|
-
import Icon from 'ol/style/Icon'
|
|
34
|
-
|
|
35
|
-
import Enums from '../../enums'
|
|
36
|
-
import defaultStyles from '../styles'
|
|
37
|
-
|
|
38
|
-
/**
|
|
39
|
-
* Format arrow output.
|
|
40
|
-
*
|
|
41
|
-
* @param {LineString} arrow geometry
|
|
42
|
-
* @return {string} The formatted output
|
|
43
|
-
*/
|
|
44
|
-
export const format = (feature) =>
|
|
45
|
-
feature.get(Enums.InternalProperties.Label) || ''
|
|
46
|
-
|
|
47
|
-
/**
|
|
48
|
-
* Build arrow styles.
|
|
49
|
-
*
|
|
50
|
-
* @param {object} feature The feature instance
|
|
51
|
-
* @param {object} map The viewer map instance
|
|
52
|
-
* @returns {object} Style instance
|
|
53
|
-
*/
|
|
54
|
-
const _applyStyles = (feature, map) => {
|
|
55
|
-
const geometry = feature.getGeometry()
|
|
56
|
-
if (geometry instanceof Point || geometry instanceof LineString) {
|
|
57
|
-
const anchor = [0, 0.5]
|
|
58
|
-
const rotation = 120
|
|
59
|
-
const point = geometry.getCoordinates()
|
|
60
|
-
const styleOptions = feature.get(Enums.InternalProperties.StyleOptions)
|
|
61
|
-
const color =
|
|
62
|
-
styleOptions && styleOptions.stroke && styleOptions.stroke.color
|
|
63
|
-
? styleOptions.stroke.color
|
|
64
|
-
: defaultStyles.stroke.color
|
|
65
|
-
|
|
66
|
-
feature.setStyle((feature, resolution) => {
|
|
67
|
-
const view = map.getView()
|
|
68
|
-
const currentZoomLevel = view.getZoom()
|
|
69
|
-
const zoomResolution = view.getResolutionForZoom(currentZoomLevel)
|
|
70
|
-
const newScale = zoomResolution / resolution
|
|
71
|
-
|
|
72
|
-
const pointIcon = `
|
|
73
|
-
<svg version="1.1" width="70px" height="70px" viewBox="0 -7.101 760.428 415.101" style="enable-background:new 0 0 408 408;" xmlns="http://www.w3.org/2000/svg">
|
|
74
|
-
<g>
|
|
75
|
-
<path style="fill:${encodeURIComponent(
|
|
76
|
-
color
|
|
77
|
-
)};" d="M 736.978 175.952 L 96.9 178.5 L 239.7 35.7 L 204 0 L 0 204 L 204 408 L 239.7 372.3 L 96.9 229.5 L 737.197 224.191 L 736.978 175.952 Z"/>
|
|
78
|
-
</g>
|
|
79
|
-
</svg>
|
|
80
|
-
`
|
|
81
|
-
|
|
82
|
-
const icon = `
|
|
83
|
-
<svg version="1.1" xmlns="http://www.w3.org/2000/svg" width="70px" height="70px" viewBox="0 0 407.436 407.436" style="enable-background:new 0 0 407.436 407.436;">
|
|
84
|
-
<polygon style="fill:${encodeURIComponent(
|
|
85
|
-
color
|
|
86
|
-
)};" points="315.869,21.178 294.621,0 91.566,203.718 294.621,407.436 315.869,386.258 133.924,203.718 "/>
|
|
87
|
-
</svg>
|
|
88
|
-
`
|
|
89
|
-
|
|
90
|
-
const styles = []
|
|
91
|
-
|
|
92
|
-
if (geometry instanceof LineString) {
|
|
93
|
-
geometry.forEachSegment((start, end) => {
|
|
94
|
-
const dx = end[0] - start[0]
|
|
95
|
-
const dy = end[1] - start[1]
|
|
96
|
-
const rotation = Math.atan2(dy, dx)
|
|
97
|
-
|
|
98
|
-
const arrowStyle = new Style({
|
|
99
|
-
geometry: new Point(start),
|
|
100
|
-
image: new Icon({
|
|
101
|
-
opacity: 1,
|
|
102
|
-
src: `data:image/svg+xml;utf8,${icon}`,
|
|
103
|
-
scale: newScale /** Absolute-sized icon */,
|
|
104
|
-
anchor: [0.3, 0.5],
|
|
105
|
-
rotateWithView: true,
|
|
106
|
-
rotation: -rotation
|
|
107
|
-
})
|
|
108
|
-
})
|
|
109
|
-
|
|
110
|
-
styles.push(
|
|
111
|
-
new Style({
|
|
112
|
-
stroke: new Stroke({
|
|
113
|
-
color,
|
|
114
|
-
width: 5 * newScale /** Keep scale sync with icon */
|
|
115
|
-
})
|
|
116
|
-
})
|
|
117
|
-
)
|
|
118
|
-
|
|
119
|
-
/** Arrow */
|
|
120
|
-
styles.push(arrowStyle)
|
|
121
|
-
})
|
|
122
|
-
|
|
123
|
-
return styles
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
const iconStyle = new Style({
|
|
127
|
-
geometry: new Point(point),
|
|
128
|
-
image: new Icon({
|
|
129
|
-
opacity: 1,
|
|
130
|
-
src: `data:image/svg+xml;utf8,${pointIcon}`,
|
|
131
|
-
scale: newScale /** Absolute-sized icon */,
|
|
132
|
-
anchor,
|
|
133
|
-
rotateWithView: true,
|
|
134
|
-
rotation: -rotation
|
|
135
|
-
})
|
|
136
|
-
})
|
|
137
|
-
|
|
138
|
-
return iconStyle
|
|
139
|
-
})
|
|
140
|
-
}
|
|
141
|
-
}
|
|
142
|
-
|
|
143
|
-
const _isArrow = (feature) =>
|
|
144
|
-
Enums.Marker.Arrow === feature.get(Enums.InternalProperties.Marker)
|
|
145
|
-
|
|
146
|
-
/**
|
|
147
|
-
* Arrow marker definition.
|
|
148
|
-
*
|
|
149
|
-
* @param {object} dependencies Shared dependencies
|
|
150
|
-
* @param {object} dependencies.map Map shared instance
|
|
151
|
-
* @param {object} dependencies.markupManager Markup manager shared instance
|
|
152
|
-
*/
|
|
153
|
-
const ArrowMarker = ({ map, markupManager }) => {
|
|
154
|
-
return {
|
|
155
|
-
onAdd: (feature) => {
|
|
156
|
-
if (_isArrow(feature)) {
|
|
157
|
-
_applyStyles(feature, map)
|
|
158
|
-
|
|
159
|
-
/** Keep arrow style after external style changes */
|
|
160
|
-
feature.on(
|
|
161
|
-
Enums.FeatureEvents.PROPERTY_CHANGE,
|
|
162
|
-
({ key: property, target: feature }) => {
|
|
163
|
-
if (property === Enums.InternalProperties.StyleOptions) {
|
|
164
|
-
_applyStyles(feature, map)
|
|
165
|
-
}
|
|
166
|
-
}
|
|
167
|
-
)
|
|
168
|
-
|
|
169
|
-
/** Update arrow icon position on feature geometry change */
|
|
170
|
-
feature.getGeometry().on(Enums._FeatureGeometryEvents.CHANGE, () => {
|
|
171
|
-
_applyStyles(feature, map)
|
|
172
|
-
})
|
|
173
|
-
}
|
|
174
|
-
},
|
|
175
|
-
onDrawStart: ({ feature }) => {
|
|
176
|
-
if (_isArrow(feature)) {
|
|
177
|
-
_applyStyles(feature, map)
|
|
178
|
-
}
|
|
179
|
-
},
|
|
180
|
-
onRemove: (feature) => {
|
|
181
|
-
if (_isArrow(feature)) {
|
|
182
|
-
const featureId = feature.getId()
|
|
183
|
-
markupManager.remove(featureId)
|
|
184
|
-
}
|
|
185
|
-
},
|
|
186
|
-
onFailure: (uid) => {
|
|
187
|
-
if (uid) {
|
|
188
|
-
markupManager.remove(uid)
|
|
189
|
-
}
|
|
190
|
-
},
|
|
191
|
-
onUpdate: (feature) => {
|
|
192
|
-
if (_isArrow(feature)) {
|
|
193
|
-
_applyStyles(feature, map)
|
|
194
|
-
}
|
|
195
|
-
},
|
|
196
|
-
onDrawEnd: ({ feature }) => {},
|
|
197
|
-
onDrawAbort: ({ feature }) => {}
|
|
198
|
-
}
|
|
199
|
-
}
|
|
200
|
-
|
|
201
|
-
export default ArrowMarker
|
|
202
|
-
</code></pre>
|
|
203
|
-
</article>
|
|
204
|
-
</section>
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
</div>
|
|
210
|
-
|
|
211
|
-
<nav>
|
|
212
|
-
<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>
|
|
213
|
-
</nav>
|
|
214
|
-
|
|
215
|
-
<br class="clear">
|
|
216
|
-
|
|
217
|
-
<footer>
|
|
218
|
-
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)
|
|
219
|
-
</footer>
|
|
220
|
-
|
|
221
|
-
<script> prettyPrint(); </script>
|
|
222
|
-
<script src="scripts/linenumber.js"> </script>
|
|
223
|
-
</body>
|
|
224
|
-
</html>
|
|
@@ -1,136 +0,0 @@
|
|
|
1
|
-
<!DOCTYPE html>
|
|
2
|
-
<html lang="en">
|
|
3
|
-
<head>
|
|
4
|
-
<meta charset="utf-8">
|
|
5
|
-
<title>JSDoc: Source: annotations/markups/measurement.js</title>
|
|
6
|
-
|
|
7
|
-
<script src="scripts/prettify/prettify.js"> </script>
|
|
8
|
-
<script src="scripts/prettify/lang-css.js"> </script>
|
|
9
|
-
<!--[if lt IE 9]>
|
|
10
|
-
<script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
|
|
11
|
-
<![endif]-->
|
|
12
|
-
<link type="text/css" rel="stylesheet" href="styles/prettify-tomorrow.css">
|
|
13
|
-
<link type="text/css" rel="stylesheet" href="styles/jsdoc-default.css">
|
|
14
|
-
</head>
|
|
15
|
-
|
|
16
|
-
<body>
|
|
17
|
-
|
|
18
|
-
<div id="main">
|
|
19
|
-
|
|
20
|
-
<h1 class="page-title">Source: annotations/markups/measurement.js</h1>
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
<section>
|
|
28
|
-
<article>
|
|
29
|
-
<pre class="prettyprint source linenums"><code>import Enums from '../../enums'
|
|
30
|
-
import { getUnitSuffix } from '../../utils'
|
|
31
|
-
import {
|
|
32
|
-
_getFeatureArea,
|
|
33
|
-
_getFeatureLength
|
|
34
|
-
} from '../../scoord3dUtils.js'
|
|
35
|
-
|
|
36
|
-
/**
|
|
37
|
-
* Format measure output.
|
|
38
|
-
*
|
|
39
|
-
* @param {Feature} feature feature
|
|
40
|
-
* @param {string} units units
|
|
41
|
-
* @return {string} The formatted measure of this feature
|
|
42
|
-
*/
|
|
43
|
-
export const format = (feature, units, pyramid) => {
|
|
44
|
-
const area = _getFeatureArea(feature, pyramid)
|
|
45
|
-
const length = _getFeatureLength(feature, pyramid)
|
|
46
|
-
const value = length || area || 0
|
|
47
|
-
return length
|
|
48
|
-
? `${value.toFixed(2)} ${units}`
|
|
49
|
-
: `${value.toFixed(2)} ${units}²`
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
/**
|
|
53
|
-
* Checks if feature has measurement markup properties.
|
|
54
|
-
*
|
|
55
|
-
* @param {object} feature
|
|
56
|
-
* @returns {boolean} true if feature has measurement markup properties
|
|
57
|
-
*/
|
|
58
|
-
const _isMeasurement = (feature) =>
|
|
59
|
-
Enums.Markup.Measurement === feature.get(Enums.InternalProperties.Markup)
|
|
60
|
-
|
|
61
|
-
/**
|
|
62
|
-
* Measurement markup definition.
|
|
63
|
-
*
|
|
64
|
-
* @param {object} dependencies Shared dependencies
|
|
65
|
-
* @param {object} dependencies.map Viewer's map instance
|
|
66
|
-
* @param {object} dependencies.pyramid Pyramid metadata
|
|
67
|
-
* @param {object} dependencies.markupManager MarkupManager shared instance
|
|
68
|
-
*/
|
|
69
|
-
const MeasurementMarkup = ({ map, pyramid, markupManager }) => {
|
|
70
|
-
return {
|
|
71
|
-
onAdd: (feature) => {
|
|
72
|
-
if (_isMeasurement(feature)) {
|
|
73
|
-
const view = map.getView()
|
|
74
|
-
const unitSuffix = getUnitSuffix(view)
|
|
75
|
-
markupManager.create({
|
|
76
|
-
feature,
|
|
77
|
-
value: format(feature, unitSuffix, pyramid)
|
|
78
|
-
})
|
|
79
|
-
}
|
|
80
|
-
},
|
|
81
|
-
onFailure: (uid) => {
|
|
82
|
-
if (uid) {
|
|
83
|
-
markupManager.remove(uid)
|
|
84
|
-
}
|
|
85
|
-
},
|
|
86
|
-
onRemove: (feature) => {
|
|
87
|
-
if (_isMeasurement(feature)) {
|
|
88
|
-
const featureId = feature.getId()
|
|
89
|
-
markupManager.remove(featureId)
|
|
90
|
-
}
|
|
91
|
-
},
|
|
92
|
-
onDrawStart: ({ feature }) => {
|
|
93
|
-
if (_isMeasurement(feature)) {
|
|
94
|
-
markupManager.create({ feature })
|
|
95
|
-
}
|
|
96
|
-
},
|
|
97
|
-
onUpdate: (feature) => {
|
|
98
|
-
const view = map.getView()
|
|
99
|
-
const unitSuffix = getUnitSuffix(view)
|
|
100
|
-
const id = feature.getId()
|
|
101
|
-
const markup = markupManager.get(id)
|
|
102
|
-
markupManager.update({
|
|
103
|
-
feature,
|
|
104
|
-
value: format(feature, unitSuffix, pyramid),
|
|
105
|
-
coordinate: markup.overlay.getPosition()
|
|
106
|
-
})
|
|
107
|
-
},
|
|
108
|
-
onDrawEnd: ({ feature }) => {},
|
|
109
|
-
onDrawAbort: ({ feature }) => {}
|
|
110
|
-
}
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
export default MeasurementMarkup
|
|
114
|
-
</code></pre>
|
|
115
|
-
</article>
|
|
116
|
-
</section>
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
</div>
|
|
122
|
-
|
|
123
|
-
<nav>
|
|
124
|
-
<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>
|
|
125
|
-
</nav>
|
|
126
|
-
|
|
127
|
-
<br class="clear">
|
|
128
|
-
|
|
129
|
-
<footer>
|
|
130
|
-
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)
|
|
131
|
-
</footer>
|
|
132
|
-
|
|
133
|
-
<script> prettyPrint(); </script>
|
|
134
|
-
<script src="scripts/linenumber.js"> </script>
|
|
135
|
-
</body>
|
|
136
|
-
</html>
|
|
@@ -1,184 +0,0 @@
|
|
|
1
|
-
<!DOCTYPE html>
|
|
2
|
-
<html lang="en">
|
|
3
|
-
<head>
|
|
4
|
-
<meta charset="utf-8">
|
|
5
|
-
<title>JSDoc: Source: annotations/markups/textEvaluation.js</title>
|
|
6
|
-
|
|
7
|
-
<script src="scripts/prettify/prettify.js"> </script>
|
|
8
|
-
<script src="scripts/prettify/lang-css.js"> </script>
|
|
9
|
-
<!--[if lt IE 9]>
|
|
10
|
-
<script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
|
|
11
|
-
<![endif]-->
|
|
12
|
-
<link type="text/css" rel="stylesheet" href="styles/prettify-tomorrow.css">
|
|
13
|
-
<link type="text/css" rel="stylesheet" href="styles/jsdoc-default.css">
|
|
14
|
-
</head>
|
|
15
|
-
|
|
16
|
-
<body>
|
|
17
|
-
|
|
18
|
-
<div id="main">
|
|
19
|
-
|
|
20
|
-
<h1 class="page-title">Source: annotations/markups/textEvaluation.js</h1>
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
<section>
|
|
28
|
-
<article>
|
|
29
|
-
<pre class="prettyprint source linenums"><code>import Fill from 'ol/style/Fill'
|
|
30
|
-
import Stroke from 'ol/style/Stroke'
|
|
31
|
-
import Style from 'ol/style/Style'
|
|
32
|
-
import Circle from 'ol/style/Circle'
|
|
33
|
-
|
|
34
|
-
import Enums from '../../enums'
|
|
35
|
-
|
|
36
|
-
/**
|
|
37
|
-
* Format free text output.
|
|
38
|
-
*
|
|
39
|
-
* @param {Feature} feature feature
|
|
40
|
-
* @return {string} The formatted output
|
|
41
|
-
*/
|
|
42
|
-
export const format = (feature) =>
|
|
43
|
-
feature.get(Enums.InternalProperties.Label) || ''
|
|
44
|
-
|
|
45
|
-
/**
|
|
46
|
-
* Builds the text evaluation style.
|
|
47
|
-
*
|
|
48
|
-
* @param {object} feature
|
|
49
|
-
* @returns {object} Style instance
|
|
50
|
-
*/
|
|
51
|
-
const _applyStyle = (feature) => {
|
|
52
|
-
if (_hasMarker(feature)) {
|
|
53
|
-
return
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
const style = new Style({
|
|
57
|
-
image: new Circle({
|
|
58
|
-
fill: new Fill({
|
|
59
|
-
color: 'rgba(255,255,255,0.0)'
|
|
60
|
-
}),
|
|
61
|
-
stroke: new Stroke({
|
|
62
|
-
color: 'rgba(255,255,255,0.0)',
|
|
63
|
-
width: 0
|
|
64
|
-
}),
|
|
65
|
-
radius: 5
|
|
66
|
-
})
|
|
67
|
-
})
|
|
68
|
-
|
|
69
|
-
feature.setStyle(style)
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
/**
|
|
73
|
-
* Checks if feature has text evaluation properties.
|
|
74
|
-
*
|
|
75
|
-
* @param {object} feature
|
|
76
|
-
* @returns {boolean} true if feature has text evaluation properties
|
|
77
|
-
*/
|
|
78
|
-
const _hasMarkup = (feature) =>
|
|
79
|
-
Enums.Markup.TextEvaluation === feature.get(Enums.InternalProperties.Markup)
|
|
80
|
-
|
|
81
|
-
/**
|
|
82
|
-
* Checks if feature has marker properties.
|
|
83
|
-
*
|
|
84
|
-
* @param {object} feature
|
|
85
|
-
* @returns {boolean} true if feature has marker properties
|
|
86
|
-
*/
|
|
87
|
-
const _hasMarker = (feature) => !!feature.get(Enums.InternalProperties.Marker)
|
|
88
|
-
|
|
89
|
-
/**
|
|
90
|
-
* Handler to create markups based on feature properties
|
|
91
|
-
* and apply text evaluation styles.
|
|
92
|
-
*
|
|
93
|
-
* @param {object} feature
|
|
94
|
-
* @param {object} markupManager MarkupManager instance
|
|
95
|
-
* @returns {void}
|
|
96
|
-
*/
|
|
97
|
-
const _onInteractionEventHandler = ({ feature, markupManager }) => {
|
|
98
|
-
const featureHasMarker = _hasMarker(feature)
|
|
99
|
-
markupManager.create({
|
|
100
|
-
feature,
|
|
101
|
-
value: format(feature),
|
|
102
|
-
isLinkable: featureHasMarker,
|
|
103
|
-
isDraggable: featureHasMarker
|
|
104
|
-
})
|
|
105
|
-
_applyStyle(feature)
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
/**
|
|
109
|
-
* Text evaluation markup definition.
|
|
110
|
-
*
|
|
111
|
-
* @param {object} dependencies Shared dependencies
|
|
112
|
-
* @param {object} dependencies.markupManager MarkupManager shared instance
|
|
113
|
-
*/
|
|
114
|
-
const TextEvaluationMarkup = ({ markupManager }) => {
|
|
115
|
-
return {
|
|
116
|
-
onAdd: (feature) => {
|
|
117
|
-
if (_hasMarkup(feature)) {
|
|
118
|
-
_onInteractionEventHandler({ feature, markupManager })
|
|
119
|
-
|
|
120
|
-
/** Keep text style after external style changes */
|
|
121
|
-
feature.on(
|
|
122
|
-
Enums.FeatureEvents.PROPERTY_CHANGE,
|
|
123
|
-
({ key: property, target: feature }) => {
|
|
124
|
-
if (property === Enums.InternalProperties.StyleOptions) {
|
|
125
|
-
_applyStyle(feature)
|
|
126
|
-
}
|
|
127
|
-
}
|
|
128
|
-
)
|
|
129
|
-
}
|
|
130
|
-
},
|
|
131
|
-
onFailure: (uid) => {
|
|
132
|
-
if (uid) {
|
|
133
|
-
markupManager.remove(uid)
|
|
134
|
-
}
|
|
135
|
-
},
|
|
136
|
-
onRemove: (feature) => {
|
|
137
|
-
if (_hasMarkup(feature)) {
|
|
138
|
-
const featureId = feature.getId()
|
|
139
|
-
markupManager.remove(featureId)
|
|
140
|
-
}
|
|
141
|
-
},
|
|
142
|
-
onUpdate: (feature) => {
|
|
143
|
-
if (_hasMarkup(feature)) {
|
|
144
|
-
markupManager.update({ feature, value: format(feature) })
|
|
145
|
-
}
|
|
146
|
-
},
|
|
147
|
-
onDrawStart: ({ feature }) => {
|
|
148
|
-
if (_hasMarkup(feature)) {
|
|
149
|
-
_onInteractionEventHandler({ feature, markupManager })
|
|
150
|
-
}
|
|
151
|
-
},
|
|
152
|
-
onDrawEnd: ({ feature }) => {
|
|
153
|
-
if (_hasMarkup(feature)) {
|
|
154
|
-
_onInteractionEventHandler({ feature, markupManager })
|
|
155
|
-
}
|
|
156
|
-
},
|
|
157
|
-
onDrawAbort: ({ feature }) => {}
|
|
158
|
-
}
|
|
159
|
-
}
|
|
160
|
-
|
|
161
|
-
export default TextEvaluationMarkup
|
|
162
|
-
</code></pre>
|
|
163
|
-
</article>
|
|
164
|
-
</section>
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
</div>
|
|
170
|
-
|
|
171
|
-
<nav>
|
|
172
|
-
<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>
|
|
173
|
-
</nav>
|
|
174
|
-
|
|
175
|
-
<br class="clear">
|
|
176
|
-
|
|
177
|
-
<footer>
|
|
178
|
-
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)
|
|
179
|
-
</footer>
|
|
180
|
-
|
|
181
|
-
<script> prettyPrint(); </script>
|
|
182
|
-
<script src="scripts/linenumber.js"> </script>
|
|
183
|
-
</body>
|
|
184
|
-
</html>
|