Skip to content

Commit 654eb8b

Browse files
committed
Update documentation
1 parent 2490366 commit 654eb8b

34 files changed

+12380
-1537
lines changed
Lines changed: 226 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,226 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="utf-8">
5+
<title>JSDoc: Source: annotations/_AnnotationManager.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/_AnnotationManager.js</h1>
21+
22+
23+
24+
25+
26+
27+
<section>
28+
<article>
29+
<pre class="prettyprint source linenums"><code>import dcmjs from "dcmjs";
30+
31+
import _MarkupManager from "./markups/_MarkupManager";
32+
33+
/** Enums */
34+
import Enums from "../enums";
35+
36+
/** Markers */
37+
import ArrowMarker, { format as arrowFormat } from "./markers/arrow";
38+
39+
/** Markups */
40+
import MeasurementMarkup, {
41+
format as measurementFormat,
42+
} from "./markups/measurement";
43+
import TextEvaluationMarkup, {
44+
format as textFormat,
45+
} from "./markups/textEvaluation";
46+
47+
/** Utils */
48+
import { areCodedConceptsEqual, getContentItemNameCodedConcept } from "../utils";
49+
50+
const { Marker, Markup } = Enums;
51+
52+
class _AnnotationManager {
53+
constructor({ map, pyramid } = {}) {
54+
const markupManager = new _MarkupManager({
55+
map,
56+
pyramid,
57+
formatters: {
58+
[Marker.Arrow]: arrowFormat,
59+
[Markup.Measurement]: measurementFormat,
60+
[Markup.TextEvaluation]: textFormat,
61+
},
62+
});
63+
64+
this.props = {
65+
map,
66+
pyramid,
67+
markupManager,
68+
};
69+
70+
/** Markups */
71+
this[Markup.Measurement] = MeasurementMarkup(this.props);
72+
this[Markup.TextEvaluation] = TextEvaluationMarkup(this.props);
73+
74+
/** Markers */
75+
this[Marker.Arrow] = ArrowMarker(this.props);
76+
}
77+
78+
/**
79+
* Add markup properties based on ROI
80+
* measurements and evaluations.
81+
*
82+
* @param {Feature} feature The feature
83+
*/
84+
_addMeasurementsAndEvaluationsProperties(feature) {
85+
const { measurements, evaluations } = feature.getProperties();
86+
87+
if (measurements &amp;&amp; measurements.length) {
88+
return measurements.some((measurement) => {
89+
const SUPPORTED_MEASUREMENTS_CODED_CONCEPTS = [
90+
new dcmjs.sr.coding.CodedConcept({
91+
meaning: "Area",
92+
value: "42798000",
93+
schemeDesignator: "SCT",
94+
}),
95+
new dcmjs.sr.coding.CodedConcept({
96+
meaning: "Length",
97+
value: "410668003",
98+
schemeDesignator: "SCT",
99+
}),
100+
];
101+
const measurementCodedConcept = getContentItemNameCodedConcept(
102+
measurement
103+
);
104+
if (
105+
SUPPORTED_MEASUREMENTS_CODED_CONCEPTS.some((codedConcept) =>
106+
areCodedConceptsEqual(measurementCodedConcept, codedConcept)
107+
)
108+
) {
109+
feature.set(
110+
Enums.InternalProperties.Markup,
111+
Enums.Markup.Measurement
112+
);
113+
}
114+
});
115+
}
116+
117+
if (evaluations &amp;&amp; evaluations.length) {
118+
return evaluations.some((evaluation) => {
119+
const SUPPORTED_EVALUATIONS_CODED_CONCEPTS = [
120+
new dcmjs.sr.coding.CodedConcept({
121+
value: "112039",
122+
meaning: "Tracking Identifier",
123+
schemeDesignator: "DCM",
124+
}),
125+
];
126+
const evaluationCodedConcept = getContentItemNameCodedConcept(
127+
evaluation
128+
);
129+
if (
130+
SUPPORTED_EVALUATIONS_CODED_CONCEPTS.some((codedConcept) =>
131+
areCodedConceptsEqual(codedConcept, evaluationCodedConcept)
132+
)
133+
) {
134+
feature.set(
135+
Enums.InternalProperties.Markup,
136+
Enums.Markup.TextEvaluation
137+
);
138+
}
139+
});
140+
}
141+
}
142+
143+
/**
144+
* Sets annotations visibility.
145+
*
146+
* @param {boolean} isVisible
147+
*/
148+
setVisible(isVisible) {
149+
this.props.markupManager.setVisible(isVisible);
150+
}
151+
152+
onAdd(feature) {
153+
/**
154+
* Add properties to ROI feature before triggering
155+
* markup and markers callbacks to keep UI in sync.
156+
*/
157+
this._addMeasurementsAndEvaluationsProperties(feature);
158+
159+
this[Marker.Arrow].onAdd(feature);
160+
this[Markup.Measurement].onAdd(feature);
161+
this[Markup.TextEvaluation].onAdd(feature);
162+
}
163+
164+
onFailure(uid) {
165+
this[Marker.Arrow].onFailure(uid);
166+
this[Markup.Measurement].onFailure(uid);
167+
this[Markup.TextEvaluation].onFailure(uid);
168+
}
169+
170+
onRemove(feature) {
171+
this[Marker.Arrow].onRemove(feature);
172+
this[Markup.Measurement].onRemove(feature);
173+
this[Markup.TextEvaluation].onRemove(feature);
174+
}
175+
176+
onUpdate(feature) {
177+
this[Marker.Arrow].onUpdate(feature);
178+
this[Markup.Measurement].onUpdate(feature);
179+
this[Markup.TextEvaluation].onUpdate(feature);
180+
}
181+
182+
onDrawStart(event) {
183+
this[Marker.Arrow].onDrawStart(event);
184+
this[Markup.Measurement].onDrawStart(event);
185+
this[Markup.TextEvaluation].onDrawStart(event);
186+
}
187+
188+
onDrawEnd(event) {
189+
this[Marker.Arrow].onDrawEnd(event);
190+
this[Markup.Measurement].onDrawEnd(event);
191+
this[Markup.TextEvaluation].onDrawEnd(event);
192+
this.props.markupManager.onDrawEnd(event);
193+
}
194+
195+
onDrawAbort(event) {
196+
this[Marker.Arrow].onDrawAbort(event);
197+
this[Markup.Measurement].onDrawAbort(event);
198+
this[Markup.TextEvaluation].onDrawAbort(event);
199+
this.props.markupManager.onDrawAbort(event);
200+
}
201+
}
202+
203+
export default _AnnotationManager;
204+
</code></pre>
205+
</article>
206+
</section>
207+
208+
209+
210+
211+
</div>
212+
213+
<nav>
214+
<h2><a href="index.html">Home</a></h2><h3>Namespaces</h3><ul><li><a href="api.html">api</a></li><li><a href="events.html">events</a></li><li><a href="metadata.html">metadata</a></li><li><a href="roi.html">roi</a></li><li><a href="scoord3d.html">scoord3d</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="metadata.Comprehensive3DSR.html">Comprehensive3DSR</a></li><li><a href="metadata.VLWholeSlideMicroscopyImage.html">VLWholeSlideMicroscopyImage</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="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#_addROIPropertiesToFeature">_addROIPropertiesToFeature</a></li><li><a href="global.html#_applyStyle">_applyStyle</a></li><li><a href="global.html#_applyStyles">_applyStyles</a></li><li><a href="global.html#_getOpenLayersStyle">_getOpenLayersStyle</a></li><li><a href="global.html#_hasMarker">_hasMarker</a></li><li><a href="global.html#_isMeasurement">_isMeasurement</a></li><li><a href="global.html#_isTextEvaluation">_isTextEvaluation</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#_updateFeatureEvaluations">_updateFeatureEvaluations</a></li><li><a href="global.html#_updateFeatureMeasurements">_updateFeatureMeasurements</a></li><li><a href="global.html#_wireMeasurementsAndQualitativeEvaluationsEvents">_wireMeasurementsAndQualitativeEvaluationsEvents</a></li><li><a href="global.html#anchor">anchor</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#areCodedConceptsEqual">areCodedConceptsEqual</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#buildTransform">buildTransform</a></li><li><a href="global.html#computeRotation">computeRotation</a></li><li><a href="global.html#createRotationMatrix">createRotationMatrix</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#TextEvaluationMarkup">TextEvaluationMarkup</a></li></ul>
215+
</nav>
216+
217+
<br class="clear">
218+
219+
<footer>
220+
Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.5</a> on Wed May 05 2021 11:47:39 GMT-0400 (Eastern Daylight Time)
221+
</footer>
222+
223+
<script> prettyPrint(); </script>
224+
<script src="scripts/linenumber.js"> </script>
225+
</body>
226+
</html>

0 commit comments

Comments
 (0)