-
Notifications
You must be signed in to change notification settings - Fork 37
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
34 changed files
with
12,380 additions
and
1,537 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,226 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="utf-8"> | ||
<title>JSDoc: Source: annotations/_AnnotationManager.js</title> | ||
|
||
<script src="scripts/prettify/prettify.js"> </script> | ||
<script src="scripts/prettify/lang-css.js"> </script> | ||
<!--[if lt IE 9]> | ||
<script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script> | ||
<![endif]--> | ||
<link type="text/css" rel="stylesheet" href="styles/prettify-tomorrow.css"> | ||
<link type="text/css" rel="stylesheet" href="styles/jsdoc-default.css"> | ||
</head> | ||
|
||
<body> | ||
|
||
<div id="main"> | ||
|
||
<h1 class="page-title">Source: annotations/_AnnotationManager.js</h1> | ||
|
||
|
||
|
||
|
||
|
||
|
||
<section> | ||
<article> | ||
<pre class="prettyprint source linenums"><code>import dcmjs from "dcmjs"; | ||
|
||
import _MarkupManager from "./markups/_MarkupManager"; | ||
|
||
/** Enums */ | ||
import Enums from "../enums"; | ||
|
||
/** Markers */ | ||
import ArrowMarker, { format as arrowFormat } from "./markers/arrow"; | ||
|
||
/** Markups */ | ||
import MeasurementMarkup, { | ||
format as measurementFormat, | ||
} from "./markups/measurement"; | ||
import TextEvaluationMarkup, { | ||
format as textFormat, | ||
} from "./markups/textEvaluation"; | ||
|
||
/** Utils */ | ||
import { areCodedConceptsEqual, getContentItemNameCodedConcept } from "../utils"; | ||
|
||
const { Marker, Markup } = Enums; | ||
|
||
class _AnnotationManager { | ||
constructor({ map, pyramid } = {}) { | ||
const markupManager = new _MarkupManager({ | ||
map, | ||
pyramid, | ||
formatters: { | ||
[Marker.Arrow]: arrowFormat, | ||
[Markup.Measurement]: measurementFormat, | ||
[Markup.TextEvaluation]: textFormat, | ||
}, | ||
}); | ||
|
||
this.props = { | ||
map, | ||
pyramid, | ||
markupManager, | ||
}; | ||
|
||
/** Markups */ | ||
this[Markup.Measurement] = MeasurementMarkup(this.props); | ||
this[Markup.TextEvaluation] = TextEvaluationMarkup(this.props); | ||
|
||
/** Markers */ | ||
this[Marker.Arrow] = ArrowMarker(this.props); | ||
} | ||
|
||
/** | ||
* Add markup properties based on ROI | ||
* measurements and evaluations. | ||
* | ||
* @param {Feature} feature The feature | ||
*/ | ||
_addMeasurementsAndEvaluationsProperties(feature) { | ||
const { measurements, evaluations } = feature.getProperties(); | ||
|
||
if (measurements && measurements.length) { | ||
return measurements.some((measurement) => { | ||
const SUPPORTED_MEASUREMENTS_CODED_CONCEPTS = [ | ||
new dcmjs.sr.coding.CodedConcept({ | ||
meaning: "Area", | ||
value: "42798000", | ||
schemeDesignator: "SCT", | ||
}), | ||
new dcmjs.sr.coding.CodedConcept({ | ||
meaning: "Length", | ||
value: "410668003", | ||
schemeDesignator: "SCT", | ||
}), | ||
]; | ||
const measurementCodedConcept = getContentItemNameCodedConcept( | ||
measurement | ||
); | ||
if ( | ||
SUPPORTED_MEASUREMENTS_CODED_CONCEPTS.some((codedConcept) => | ||
areCodedConceptsEqual(measurementCodedConcept, codedConcept) | ||
) | ||
) { | ||
feature.set( | ||
Enums.InternalProperties.Markup, | ||
Enums.Markup.Measurement | ||
); | ||
} | ||
}); | ||
} | ||
|
||
if (evaluations && evaluations.length) { | ||
return evaluations.some((evaluation) => { | ||
const SUPPORTED_EVALUATIONS_CODED_CONCEPTS = [ | ||
new dcmjs.sr.coding.CodedConcept({ | ||
value: "112039", | ||
meaning: "Tracking Identifier", | ||
schemeDesignator: "DCM", | ||
}), | ||
]; | ||
const evaluationCodedConcept = getContentItemNameCodedConcept( | ||
evaluation | ||
); | ||
if ( | ||
SUPPORTED_EVALUATIONS_CODED_CONCEPTS.some((codedConcept) => | ||
areCodedConceptsEqual(codedConcept, evaluationCodedConcept) | ||
) | ||
) { | ||
feature.set( | ||
Enums.InternalProperties.Markup, | ||
Enums.Markup.TextEvaluation | ||
); | ||
} | ||
}); | ||
} | ||
} | ||
|
||
/** | ||
* Sets annotations visibility. | ||
* | ||
* @param {boolean} isVisible | ||
*/ | ||
setVisible(isVisible) { | ||
this.props.markupManager.setVisible(isVisible); | ||
} | ||
|
||
onAdd(feature) { | ||
/** | ||
* Add properties to ROI feature before triggering | ||
* markup and markers callbacks to keep UI in sync. | ||
*/ | ||
this._addMeasurementsAndEvaluationsProperties(feature); | ||
|
||
this[Marker.Arrow].onAdd(feature); | ||
this[Markup.Measurement].onAdd(feature); | ||
this[Markup.TextEvaluation].onAdd(feature); | ||
} | ||
|
||
onFailure(uid) { | ||
this[Marker.Arrow].onFailure(uid); | ||
this[Markup.Measurement].onFailure(uid); | ||
this[Markup.TextEvaluation].onFailure(uid); | ||
} | ||
|
||
onRemove(feature) { | ||
this[Marker.Arrow].onRemove(feature); | ||
this[Markup.Measurement].onRemove(feature); | ||
this[Markup.TextEvaluation].onRemove(feature); | ||
} | ||
|
||
onUpdate(feature) { | ||
this[Marker.Arrow].onUpdate(feature); | ||
this[Markup.Measurement].onUpdate(feature); | ||
this[Markup.TextEvaluation].onUpdate(feature); | ||
} | ||
|
||
onDrawStart(event) { | ||
this[Marker.Arrow].onDrawStart(event); | ||
this[Markup.Measurement].onDrawStart(event); | ||
this[Markup.TextEvaluation].onDrawStart(event); | ||
} | ||
|
||
onDrawEnd(event) { | ||
this[Marker.Arrow].onDrawEnd(event); | ||
this[Markup.Measurement].onDrawEnd(event); | ||
this[Markup.TextEvaluation].onDrawEnd(event); | ||
this.props.markupManager.onDrawEnd(event); | ||
} | ||
|
||
onDrawAbort(event) { | ||
this[Marker.Arrow].onDrawAbort(event); | ||
this[Markup.Measurement].onDrawAbort(event); | ||
this[Markup.TextEvaluation].onDrawAbort(event); | ||
this.props.markupManager.onDrawAbort(event); | ||
} | ||
} | ||
|
||
export default _AnnotationManager; | ||
</code></pre> | ||
</article> | ||
</section> | ||
|
||
|
||
|
||
|
||
</div> | ||
|
||
<nav> | ||
<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> | ||
</nav> | ||
|
||
<br class="clear"> | ||
|
||
<footer> | ||
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) | ||
</footer> | ||
|
||
<script> prettyPrint(); </script> | ||
<script src="scripts/linenumber.js"> </script> | ||
</body> | ||
</html> |
Oops, something went wrong.