How to use the cornerstone-core.getDefaultViewportForImage 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 GleasonBian / CornerstoneVueWADO / src / components / HelloWorld.vue View on Github external
function(image) {
                console.log(image);
                // 设置元素视口
                var viewport = cornerstone.getDefaultViewportForImage(
                  canvas,
                  image
                );
                // 显示图像
                cornerstone.displayImage(canvas, image, viewport);
                // 激活工具
                _this.initCanvasTools();
              },
              function(err) {
github chestrays / cornerstone_widget / js / lib / cs_widget.js View on Github external
dicom_changed: function () {
        var img_bytes = this.model.get('img_bytes');
        console.log('image bytes', img_bytes)
        var img_width = this.model.get('img_width');
        var img_height = this.model.get('img_height');
        var img_min = this.model.get('img_min');
        var img_max = this.model.get('img_max');
        var color = this.model.get('img_color')
        var out_img = this.parse_image(img_bytes, img_width, img_height, img_min, img_max, color);
        cs.enable(this.viewer);
        this.viewport = cs.getDefaultViewportForImage(this.viewer, out_img);
        console.log(out_img);
        cs.displayImage(this.viewer, out_img, this.viewport);
        this._setup_tools();
    },
    _setup_tools: function () {
github Kitware / paraview-glance / Sources / externals / MedicalCornerstone / CornerstoneRenderer.js View on Github external
.then((image) => {
        const viewport = Object.assign(
          {},
          cornerstone.getViewport(model.container)
        );

        if (resetViewport) {
          Object.assign(
            viewport,
            cornerstone.getDefaultViewportForImage(model.container, image)
          );
        }

        Object.assign(viewport, {
          voi: {
            windowWidth: model.representation.getColorWindow(),
            windowCenter: model.representation.getColorLevel(),
          },
          hflip: model.representation.getHFlip(),
          vflip: model.representation.getVFlip(),
          pixelReplication: !model.representation.getInterpolation(),
          invert: model.representation.getInvertColors(),
          rotation: model.rotateAngle,
        });

        cornerstone.displayImage(model.container, image, viewport);