All files / extensions/cornerstone-dicom-sr/src/utils SRSCOOR3DProbeMapper.ts

5.26% Statements 1/19
0% Branches 0/7
0% Functions 0/3
5.26% Lines 1/19

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 6334x                                                                                                                            
const SRSCOOR3DProbe = {
  toAnnotation: measurement => {},
 
  /**
   * Maps cornerstone annotation event data to measurement service format.
   *
   * @param {Object} cornerstone Cornerstone event data
   * @return {Measurement} Measurement instance
   */
  toMeasurement: (
    csToolsEventDetail,
    displaySetService,
    CornerstoneViewportService,
    getValueTypeFromToolType,
    customizationService
  ) => {
    const { annotation } = csToolsEventDetail;
    const { metadata, data, annotationUID } = annotation;
 
    Iif (!metadata || !data) {
      console.warn('Probe tool: Missing metadata or data');
      return null;
    }
 
    const { toolName } = metadata;
    const { points } = data.handles;
 
    const displayText = getDisplayText(annotation);
    return {
      uid: annotationUID,
      points,
      metadata,
      toolName: metadata.toolName,
      label: data.label,
      displayText: displayText,
      data: data.cachedStats,
      type: getValueTypeFromToolType?.(toolName) ?? null,
    };
  },
};
 
function getDisplayText(annotation) {
  const { data } = annotation;
 
  Iif (!data) {
    return [''];
  }
  const { labels } = data;
 
  const displayText = [];
 
  for (const label of labels) {
    // make this generic
    Iif (label.label === '33636980076') {
      displayText.push(`Finding Site: ${label.value}`);
    }
  }
 
  return displayText;
}
 
export default SRSCOOR3DProbe;