How to use the cornerstone-core.setViewport 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 PulseTile / PulseTile-React-Core / src / components / pages / Images / ImagesDetail / ImagesDetail.js View on Github external
zoomout = /* istanbul ignore next */ () => {
    const cornerstoneElement = this.getImgBlock();
    const viewport = cornerstone.getViewport(cornerstoneElement);
    if (viewport.scale > 0.1) {
      viewport.scale -= 0.1;
      cornerstone.setViewport(cornerstoneElement, viewport);
    }
  };
github OHIF / Viewers / extensions / cornerstone / src / commandsModule.js View on Github external
flipViewportVertical: ({ viewports }) => {
      const enabledElement = getEnabledElement(viewports.activeViewportIndex);

      if (enabledElement) {
        let viewport = cornerstone.getViewport(enabledElement);
        viewport.vflip = !viewport.vflip;
        cornerstone.setViewport(enabledElement, viewport);
      }
    },
    scaleViewport: ({ direction, viewports }) => {
github chestrays / cornerstone_widget / js / lib / cs_widget.js View on Github external
zoom_changed: function () {
        this.viewport.scale = this.model.get('img_scale');
        cs.setViewport(this.viewer, this.viewport);
    }
});
github OHIF / Viewers / platform / viewer / src / connectedComponents / ConnectedDownloadDialog.js View on Github external
cornerstone.loadImage(enabledElement.image.imageId).then(image => {
            cornerstone.displayImage(viewportElement, image);
            cornerstone.setViewport(viewportElement, viewport);
            cornerstone.resize(viewportElement, true);

            const newWidth = Math.min(width || image.width, MAX_TEXTURE_SIZE);
            const newHeight = Math.min(
              height || image.height,
              MAX_TEXTURE_SIZE
            );

            resolve({ image, width: newWidth, height: newHeight });
          });
        }