@@ -26,10 +26,7 @@ <h1 class="page-title">Source: annotation.js</h1>
2626
2727 < section >
2828 < article >
29- < pre class ="prettyprint source linenums "> < code > import {
30- _fetchBulkdata,
31- getContentItemNameCodedConcept
32- } from './utils.js'
29+ < pre class ="prettyprint source linenums "> < code > import { _fetchBulkdata } from './utils.js'
3330
3431const _attrs = Symbol('attrs')
3532
@@ -242,11 +239,13 @@ <h1 class="page-title">Source: annotation.js</h1>
242239 )
243240 } else {
244241 if ('PointCoordinatesData' in bulkdataItem) {
242+ console.info(`fetch point coordinate data of annotation group "${uid}"`)
245243 return await _fetchBulkdata({
246244 client,
247245 reference: bulkdataItem.PointCoordinatesData
248246 })
249247 } else if ('DoublePointCoordinatesData' in bulkdataItem) {
248+ console.info(`fetch point coordinate data of annotation group "${uid}"`)
250249 return await _fetchBulkdata({
251250 client,
252251 reference: bulkdataItem.DoublePointCoordinatesData
@@ -294,6 +293,7 @@ <h1 class="page-title">Source: annotation.js</h1>
294293 }
295294 } else {
296295 if ('LongPrimitivePointIndexList' in bulkdataItem) {
296+ console.info(`fetch point index list of annotation group "${uid}"`)
297297 return await _fetchBulkdata({
298298 client,
299299 reference: bulkdataItem.LongPrimitivePointIndexList
@@ -352,6 +352,11 @@ <h1 class="page-title">Source: annotation.js</h1>
352352 measurementBulkdataItem.MeasurementValuesSequence[0]
353353 )
354354 if ('FloatingPointValues' in valuesBulkdataItem) {
355+ const nameItem = measurementMetadataItem.ConceptNameCodeSequence[0]
356+ const name = nameItem.CodeMeaning
357+ console.info(
358+ `fetch measurement values for measurement #${index} "${name}"`
359+ )
355360 return await _fetchBulkdata({
356361 client,
357362 reference: valuesBulkdataItem.FloatingPointValues
@@ -408,6 +413,11 @@ <h1 class="page-title">Source: annotation.js</h1>
408413 .MeasurementValuesSequence[0]
409414 )
410415 if ('AnnotationIndexList' in valuesBulkdataItem) {
416+ const nameItem = measurementMetadataItem.ConceptNameCodeSequence[0]
417+ const name = nameItem.CodeMeaning
418+ console.info(
419+ `fetch measurement indices for measurement #${index} "${name}"`
420+ )
411421 return await _fetchBulkdata({
412422 client,
413423 reference: valuesBulkdataItem.AnnotationIndexList
@@ -420,7 +430,7 @@ <h1 class="page-title">Source: annotation.js</h1>
420430}
421431
422432/**
423- * Fetch measurements of an annotation group.
433+ * Fetch all measurements of an annotation group.
424434 *
425435 * @param {object} options
426436 * @param {object} options.metadataItem - Metadata of Annotation Group Sequence item
@@ -440,7 +450,8 @@ <h1 class="page-title">Source: annotation.js</h1>
440450 if (metadataItem.MeasurementsSequence !== undefined) {
441451 for (let i = 0; i < metadataItem.MeasurementsSequence.length; i++) {
442452 const item = metadataItem.MeasurementsSequence[i]
443- const name = getContentItemNameCodedConcept(item)
453+ const name = item.ConceptNameCodeSequence[0]
454+ const unit = item.MeasurementUnitsCodeSequence[0]
444455 const values = await _fetchMeasurementValues({
445456 metadataItem,
446457 bulkdataItem,
@@ -455,6 +466,7 @@ <h1 class="page-title">Source: annotation.js</h1>
455466 })
456467 measurements.push({
457468 name,
469+ unit,
458470 values,
459471 indices
460472 })
@@ -463,6 +475,58 @@ <h1 class="page-title">Source: annotation.js</h1>
463475 return measurements
464476}
465477
478+ /**
479+ * Fetch an individual measurement of an annotation group.
480+ *
481+ * @param {object} options
482+ * @param {object} options.metadataItem - Metadata of Annotation Group Sequence item
483+ * @param {object} options.bulkdataItem - Bulkdata of Annotation Group Sequence item
484+ * @param {object} options.index - Index of the Measurements Sequence item
485+ * @param {object} options.client - DICOMweb client
486+ *
487+ * @returns {Promise<Array<object> > } Name, values, and indices of measurements
488+ *
489+ * @private
490+ */
491+ async function _fetchMeasurement ({
492+ metadataItem,
493+ bulkdataItem,
494+ index,
495+ client
496+ }) {
497+ if (metadataItem.MeasurementsSequence == null) {
498+ throw new Error(
499+ 'Measurements Sequence element is not contained in metadata.'
500+ )
501+ }
502+ if (metadataItem.MeasurementsSequence.length === 0) {
503+ throw new Error(
504+ 'Measurements Sequence element in empty.'
505+ )
506+ }
507+ const item = metadataItem.MeasurementsSequence[index]
508+ if (item == null) {
509+ throw new Error(
510+ `Measurements Sequence does not contain an item #${index}.`
511+ )
512+ }
513+ const name = item.ConceptNameCodeSequence[0]
514+ const unit = item.MeasurementUnitsCodeSequence[0]
515+ const values = await _fetchMeasurementValues({
516+ metadataItem,
517+ bulkdataItem,
518+ index,
519+ client
520+ })
521+ const indices = await _fetchMeasurementIndices({
522+ metadataItem,
523+ bulkdataItem,
524+ index,
525+ client
526+ })
527+ return { name, unit, values, indices }
528+ }
529+
466530/**
467531 * Get dimensionality of coordinates.
468532 *
@@ -753,6 +817,7 @@ <h1 class="page-title">Source: annotation.js</h1>
753817 _fetchGraphicData,
754818 _fetchGraphicIndex,
755819 _fetchMeasurements,
820+ _fetchMeasurement,
756821 _getCentroid,
757822 _getCommonZCoordinate,
758823 _getCoordinateDimensionality
@@ -773,7 +838,7 @@ <h2><a href="index.html">Home</a></h2><h3>Namespaces</h3><ul><li><a href="annota
773838< br class ="clear ">
774839
775840< footer >
776- Documentation generated by < a href ="https://github.com/jsdoc/jsdoc "> JSDoc 3.6.10</ a > on Mon Sep 05 2022 22:09:47 GMT-0400 (Eastern Daylight Time)
841+ Documentation generated by < a href ="https://github.com/jsdoc/jsdoc "> JSDoc 3.6.10</ a > on Mon Sep 12 2022 22:55:18 GMT-0400 (Eastern Daylight Time)
777842</ footer >
778843
779844< script > prettyPrint ( ) ; </ script >
0 commit comments