How to use the cornerstone-tools.zoom 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 chestrays / cornerstone_widget / js / lib / cs_widget.js View on Github external
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') {
                ctools.rectangleRoi.enable(this.viewer);
                ctools.rectangleRoi.activate(this.viewer, 1);
            }
            if (tool_name == 'probe') {
                ctools.probe.enable(this.viewer);
                ctools.probe.activate(this.viewer, 1);
            }
github Kitware / paraview-glance / Sources / externals / MedicalCornerstone / toolsConfig.js View on Github external
// Dummy binding value of true since mouse wheels don't
      // have specific bind slots.
      true: 'stackScroll',
    },
  },
  definitions: {
    pan: {
      tool: cornerstoneTools.pan,
      type: ToolTypes.Mouse,
      binding: MouseButtons.Middle,
      icon: 'arrows-alt',
      activateArgs: ['binding'],
      deactivateArgs: ['binding'],
    },
    zoom: {
      tool: cornerstoneTools.zoom,
      type: ToolTypes.Mouse,
      binding: MouseButtons.Right,
      icon: 'search-plus',
      activateArgs: ['binding'],
      deactivateArgs: ['binding'],
    },
    wwwc: {
      // When using a bundled cornerstone tool, be sure to name
      // the tool as the same name as the cornerstone tool to ensure
      // tool state is synchronized.
      tool: cornerstoneTools.wwwc,
      type: ToolTypes.Mouse,
      // What binding argument for the type of tool.
      binding: MouseButtons.Left,
      // This is a FontAwesome icon name
      icon: 'adjust',
github GleasonBian / CornerstoneVueWADO / src / components / HelloWorld.vue View on Github external
// Enable Inputs
      cornerstoneTools.mouseInput.enable(canvas);
      cornerstoneTools.mouseWheelInput.enable(canvas);
      cornerstoneTools.touchInput.enable(canvas);

      // Set the stack as tool state
      cornerstoneTools.addStackStateManager(canvas, ["stack"]);
      cornerstoneTools.addToolState(canvas, "stack", canvasStack);
      cornerstoneTools.stackScrollWheel.activate(canvas); // Mouse wheel
      cornerstoneTools.scrollIndicator.enable(canvas); // Position indicator

      // Mouse
      cornerstoneTools.wwwc.activate(canvas, 1); // left click
      cornerstoneTools.pan.activate(canvas, 2); // middle click
      cornerstoneTools.zoom.activate(canvas, 4); // right click

      // Touch / Gesture
      cornerstoneTools.wwwcTouchDrag.activate(canvas); // - Drag
      cornerstoneTools.zoomTouchPinch.activate(canvas); // - Pinch
      cornerstoneTools.panMultiTouch.activate(canvas); // - Multi (x2)
    },
    /*
github chestrays / cornerstone_widget / js / lib / cs_widget.js View on Github external
_setup_tools: function () {
        ctools.mouseInput.enable(this.viewer);
        ctools.mouseWheelInput.enable(this.viewer);
        ctools.wwwc.activate(this.viewer, 1); // Left Click
        ctools.pan.activate(this.viewer, 2); // Middle Click
        ctools.zoom.activate(this.viewer, 4); // Right Click
        ctools.zoomWheel.activate(this.viewer); // Mouse Wheel
    },
    _disable_all_tools: function (element) {