How to use the cornerstone-core.updateImage function in cornerstone-core

To help you get started, we’ve selected a few cornerstone-core 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 chestrays / cornerstone_widget / js / lib / cs_widget.js View on Github external
activate_tool: function () {
        var tool_name = this.model.get('_selected_tool');
        console.log('switching to tool: ' + tool_name);
        if (tool_name == 'reset') {
            this._disable_all_tools(this.viewer);
            cs.reset(this.viewer);
            var toolStateManager = ctools.getElementToolStateManager(this.viewer);
            // Note that this only works on ImageId-specific tool state managers (for now)
            toolStateManager.clear(this.viewer);
            cs.updateImage(this.viewer);
            this.model.set('_tool_state_in', '');
            this.model.set('_tool_state_out', '');
            this._setup_tools();
        } else {
            this._disable_all_tools(this.viewer);
            if (tool_name == 'zoom') {
                ctools.zoom.activate(this.viewer, 1);
            }
            if (tool_name == 'window') {
                ctools.wwwc.activate(this.viewer, 1);
            }
            if (tool_name == 'pan') {
                ctools.pan.activate(this.viewer, 1);
                ctools.zoom.activate(this.viewer, 2);
            }
            if (tool_name == 'bbox') {
github sisobus / cornerstoneTools-RotatedEllipticalRoiTool / src / cornerstone-tools-rotated-elliptical-roi-tool.ts View on Github external
addNewMeasurement(evt: any) {
    const eventData = evt.detail
    const { element, image } = eventData
    const measurementData: any = this.createNewMeasurement(eventData)

    cornerstoneTools.addToolState(element, this.name, measurementData)
    const { end } = measurementData.handles

    cornerstone.updateImage(element)

    moveNewHandle(
      eventData,
      this.name,
      measurementData,
      end,
      {},
      'mouse',
      () => {
        if (anyHandlesOutsideImage(eventData, measurementData.handles)) {
          // Delete the measurement
          cornerstoneTools.removeToolState(element, this.name, measurementData)
        } else {
          const center = getCenter(measurementData.handles)

          measurementData.handles.perpendicularPoint.x = center.x
github sisobus / cornerstoneTools-RotatedEllipticalRoiTool / src / cornerstone-tools-rotated-elliptical-roi-tool.ts View on Github external
const handleDoneMove = (handle: any) => {
      data.invalidated = true
      if (anyHandlesOutsideImage(eventData, data.handles)) {
        // Delete the measurement
        cornerstoneTools.removeToolState(element, this.name, data)
      }

      if (handle) {
        handle.moving = false
        handle.selected = true
      }

      setToolCursor(this.element, this.svgCursor)

      cornerstone.updateImage(element)
      element.addEventListener(EVENTS.MOUSE_MOVE, this.mouseMoveCallback)
      element.addEventListener(EVENTS.TOUCH_START, this._moveCallback)
    }
github OHIF / ohif-core / src / measurements / measurementHandlers / handleChildMeasurementAdded.js View on Github external
cornerstone.getEnabledElements().forEach(enabledElement => {
    cornerstone.updateImage(enabledElement.element);
  });
github OHIF / react-vtkjs-viewport / examples / VTKCornerstonePaintingSyncExample.js View on Github external
continue;
      }

      if (labelmap2D) {
        labelmap2D.segmentsOnLabelmap.push(segmentIndex);
      } else {
        labelmap2D = getters.labelmap2DByImageIdIndex(
          labelmap3D,
          i,
          rows,
          columns
        );
      }
    }

    cornerstone.updateImage(element);
  };
github OHIF / ohif-core / src / measurements / measurementHandlers / handleSingleMeasurementAdded.js View on Github external
cornerstone.getEnabledElements().forEach(enabledElement => {
    cornerstone.updateImage(enabledElement.element);
  });
github OHIF / Viewers / extensions / cornerstone / src / commandsModule.js View on Github external
removeToolState: ({ element, toolType, tool }) => {
      cornerstoneTools.removeToolState(element, toolType, tool);
      cornerstone.updateImage(element);
    },
  };
github OHIF / ohif-core / src / measurements / measurementHandlers / handleChildMeasurementRemoved.js View on Github external
cornerstone.getEnabledElements().forEach(enabledElement => {
    cornerstone.updateImage(enabledElement.element);
  });
github OHIF / ohif-core / src / measurements / measurementHandlers / handleSingleMeasurementRemoved.js View on Github external
cornerstone.getEnabledElements().forEach(enabledElement => {
    cornerstone.updateImage(enabledElement.element);
  });
github OHIF / Viewers / platform / viewer / src / appExtensions / MeasurementsPanel / ConnectedMeasurementTable.js View on Github external
cornerstone.getEnabledElements().forEach(enabledElement => {
        cornerstone.updateImage(enabledElement.element);
      });