dicom-microscopy-viewer
Version:
Interactive web-based viewer for DICOM Microscopy Images
171 lines (142 loc) • 7.01 kB
HTML
<html lang="en">
<head>
<meta charset="utf-8">
<title>JSDoc: Source: roi.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: roi.js</h1>
<section>
<article>
<pre class="prettyprint source linenums"><code>import { _generateUID } from './utils.js'
import Enums from './enums'
const _uid = Symbol('uid')
const _scoord3d = Symbol('scoord3d')
const _properties = Symbol('properties')
/** A region of interest (ROI)
*
* @class
* @memberof roi
*/
class ROI {
/**
* @param {Object} options - Options for construction of ROI
* @param {scoord3d.scoord3d} options.scoord3d - Spatial 3D coordinates
* @param {string} options.uid - Unique idenfifier
* @param {Object} options.properties - Properties (name-value pairs)
*/
constructor (options) {
if (!('scoord3d' in options)) {
throw new Error('spatial coordinates are required for ROI')
}
if (!(typeof options.scoord3d === 'object' || options.scoord3d !== null)) {
throw new Error('scoord3d of ROI must be a Scoord3D object')
}
if (!('uid' in options)) {
this[_uid] = _generateUID()
} else {
if (!(typeof options.uid === 'string' || options.uid instanceof String)) {
throw new Error('uid of ROI must be a string')
}
this[_uid] = options.uid
}
this[_scoord3d] = options.scoord3d
if ('properties' in options) {
if (!(typeof options.properties === 'object')) {
throw new Error('properties of ROI must be an object')
}
this[_properties] = options.properties
if (this[_properties].evaluations === undefined) {
this[_properties][Enums.InternalProperties.Evaluations] = []
}
if (this[_properties].measurements === undefined) {
this[_properties][Enums.InternalProperties.Measurements] = []
}
} else {
this[_properties] = {}
this[_properties][Enums.InternalProperties.Evaluations] = []
this[_properties][Enums.InternalProperties.Measurements] = []
}
Object.freeze(this)
}
/**
* Unique identifier of region of interest.
*
* @type string
*/
get uid () {
return this[_uid]
}
/**
* Spatial coordinates of region of interest.
*
* @type scoord3d.Scoord3D
*/
get scoord3d () {
return this[_scoord3d]
}
/**
* Properties of region of interest.
*
* @type Object
*/
get properties () {
return this[_properties]
}
/**
* Measurements of region of interest.
*
* @type Object[]
*/
get measurements () {
return this[_properties][Enums.InternalProperties.Measurements].slice(0)
}
/**
* Qualitative evaluations of region of interest.
*
* @type Object[]
*/
get evaluations () {
return this[_properties][Enums.InternalProperties.Evaluations].slice(0)
}
/**
* Add a measurement.
*
* @param {Object} item - NUM content item representing a measurement
*/
addMeasurement (item) {
this[_properties][Enums.InternalProperties.Measurements].push(item)
}
/**
* Add a qualitative evaluation.
*
* @param {Object} item - CODE content item representing a qualitative evaluation
*/
addEvaluation (item) {
this[_properties][Enums.InternalProperties.Evaluations].push(item)
}
}
export { ROI }
</code></pre>
</article>
</section>
</div>
<nav>
<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.SOPClass.html">SOPClass</a></li><li><a href="metadata.VLWholeSlideMicroscopyImage.html">VLWholeSlideMicroscopyImage</a></li><li><a href="module.exports_module.exports.html">exports</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="scoord3d.Scoord3D.html">Scoord3D</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><h3>Global</h3><ul><li><a href="global.html#addTask">addTask</a></li><li><a href="global.html#cancelTask">cancelTask</a></li><li><a href="global.html#decode">decode</a></li><li><a href="global.html#getStatistics">getStatistics</a></li><li><a href="global.html#handleMessageFromWorker">handleMessageFromWorker</a></li><li><a href="global.html#initialize">initialize</a></li><li><a href="global.html#loadWebWorkerTask">loadWebWorkerTask</a></li><li><a href="global.html#setTaskPriority">setTaskPriority</a></li><li><a href="global.html#spawnWebWorker">spawnWebWorker</a></li><li><a href="global.html#startTaskOnWebWorker">startTaskOnWebWorker</a></li><li><a href="global.html#terminateAllWebWorkers">terminateAllWebWorkers</a></li><li><a href="global.html#transform">transform</a></li></ul>
</nav>
<br class="clear">
<footer>
Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.10</a> on Thu Sep 29 2022 16:54:54 GMT-0400 (Eastern Daylight Time)
</footer>
<script> prettyPrint(); </script>
<script src="scripts/linenumber.js"> </script>
</body>
</html>