How to use the cornerstone-tools.getToolForElement function in cornerstone-tools

To help you get started, weโ€™ve selected a few cornerstone-tools examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github OHIF / Viewers / src / lib / getMeasurementLocationCallback.js View on Github external
export default function getMeasurementLocationCallback(
  eventData,
  tool,
  options
) {
  const { toolType } = tool;
  const { element } = eventData;
  const doneCallback = updateTableWithNewMeasurementData;

  const ToolInstance = cornerstoneTools.getToolForElement(element, toolType);

  if (
    !ToolInstance ||
    !ToolInstance.configuration ||
    !ToolInstance.configuration.getMeasurementLocationCallback
  ) {
    console.warn(
      'Tool instance configuration is missing: getMeasurementLocationCallback'
    );

    return;
  }

  ToolInstance.configuration.getMeasurementLocationCallback(
    tool,
    eventData,
github OHIF / Viewers / extensions / cornerstone / src / commandsModule.js View on Github external
elementToolData.data.forEach((toolData, index) => {
          let elementToolInstance = cornerstoneTools.getToolForElement(
            element,
            toolType
          );

          if (!elementToolInstance) {
            elementToolInstance = cornerstoneTools.getToolForElement(
              element,
              `${toolType}Tool`
            );
          }

          if (!elementToolInstance) {
            console.warn('Tool not found.');
            return undefined;
          }
github OHIF / Viewers / platform / viewer / src / appExtensions / MeasurementsPanel / getMeasurementLocationCallback.js View on Github external
export default function getMeasurementLocationCallback(
  eventData,
  tool,
  options
) {
  const { toolType } = tool;
  const { element } = eventData;
  const doneCallback = updateTableWithNewMeasurementData;

  const ToolInstance = cornerstoneTools.getToolForElement(element, toolType);

  if (
    !ToolInstance ||
    !ToolInstance.configuration ||
    !ToolInstance.configuration.getMeasurementLocationCallback
  ) {
    console.warn(
      'Tool instance configuration is missing: getMeasurementLocationCallback'
    );

    return;
  }

  ToolInstance.configuration.getMeasurementLocationCallback(
    tool,
    eventData,
github OHIF / Viewers / extensions / cornerstone / src / commandsModule.js View on Github external
elementToolData.data.forEach((toolData, index) => {
          let elementToolInstance = cornerstoneTools.getToolForElement(
            element,
            toolType
          );

          if (!elementToolInstance) {
            elementToolInstance = cornerstoneTools.getToolForElement(
              element,
              `${toolType}Tool`
            );
          }

          if (!elementToolInstance) {
            console.warn('Tool not found.');
            return undefined;
          }

          if (
            elementToolInstance.pointNearTool(
              element,
              toolData,
              canvasCoordinates
            )