All files / extensions/tmtv/src init.js

0% Statements 0/8
100% Branches 0/0
0% Functions 0/1
0% Lines 0/8

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                                                                                                         
import {
  addTool,
  RectangleROIStartEndThresholdTool,
  CircleROIStartEndThresholdTool,
} from '@cornerstonejs/tools';
import { Enums as CSExtensionEnums } from '@ohif/extension-cornerstone';
 
import measurementServiceMappingsFactory from './utils/measurementServiceMappings/measurementServiceMappingsFactory';
 
const { CORNERSTONE_3D_TOOLS_SOURCE_NAME, CORNERSTONE_3D_TOOLS_SOURCE_VERSION } = CSExtensionEnums;
 
/**
 *
 * @param {Object} servicesManager
 * @param {Object} configuration
 * @param {Object|Array} configuration.csToolsConfig
 */
export default function init({ servicesManager }) {
  const { measurementService, displaySetService, cornerstoneViewportService } =
    servicesManager.services;
 
  addTool(RectangleROIStartEndThresholdTool);
  addTool(CircleROIStartEndThresholdTool);
 
  const { RectangleROIStartEndThreshold, CircleROIStartEndThreshold } =
    measurementServiceMappingsFactory(
      measurementService,
      displaySetService,
      cornerstoneViewportService
    );
 
  const csTools3DVer1MeasurementSource = measurementService.getSource(
    CORNERSTONE_3D_TOOLS_SOURCE_NAME,
    CORNERSTONE_3D_TOOLS_SOURCE_VERSION
  );
 
  measurementService.addMapping(
    csTools3DVer1MeasurementSource,
    'RectangleROIStartEndThreshold',
    RectangleROIStartEndThreshold.matchingCriteria,
    RectangleROIStartEndThreshold.toAnnotation,
    RectangleROIStartEndThreshold.toMeasurement
  );
 
  measurementService.addMapping(
    csTools3DVer1MeasurementSource,
    'CircleROIStartEndThreshold',
    CircleROIStartEndThreshold.matchingCriteria,
    CircleROIStartEndThreshold.toAnnotation,
    CircleROIStartEndThreshold.toMeasurement
  );
}