How to use the cornerstone-tools.external 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 cornerstonejs / react-cornerstone-viewport / examples / initCornerstone.js View on Github external
export default function initCornerstone() {
  // Cornertone Tools
  cornerstoneTools.external.cornerstone = cornerstone;
  cornerstoneTools.external.Hammer = Hammer;
  cornerstoneTools.external.cornerstoneMath = cornerstoneMath;

  //
  cornerstoneTools.init();

  // Preferences
  const fontFamily =
    'Work Sans, Roboto, OpenSans, HelveticaNeue-Light, Helvetica Neue Light, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif';
  cornerstoneTools.textStyle.setFont(`16px ${fontFamily}`);
  cornerstoneTools.toolStyle.setToolWidth(2);
  cornerstoneTools.toolColors.setToolColor('rgb(255, 255, 0)');
  cornerstoneTools.toolColors.setActiveColor('rgb(0, 255, 0)');

  cornerstoneTools.store.state.touchProximity = 40;

  // IMAGE LOADER
  cornerstoneWADOImageLoader.external.cornerstone = cornerstone;
github cornerstonejs / react-cornerstone-viewport / examples / initCornerstone.js View on Github external
export default function initCornerstone() {
  // Cornertone Tools
  cornerstoneTools.external.cornerstone = cornerstone;
  cornerstoneTools.external.Hammer = Hammer;
  cornerstoneTools.external.cornerstoneMath = cornerstoneMath;

  //
  cornerstoneTools.init();

  // Preferences
  const fontFamily =
    'Work Sans, Roboto, OpenSans, HelveticaNeue-Light, Helvetica Neue Light, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif';
  cornerstoneTools.textStyle.setFont(`16px ${fontFamily}`);
  cornerstoneTools.toolStyle.setToolWidth(2);
  cornerstoneTools.toolColors.setToolColor('rgb(255, 255, 0)');
  cornerstoneTools.toolColors.setActiveColor('rgb(0, 255, 0)');

  cornerstoneTools.store.state.touchProximity = 40;
github OHIF / react-vtkjs-viewport / examples / initCornerstone.js View on Github external
import dicomParser from 'dicom-parser';
import cornerstone from 'cornerstone-core';
import cornerstoneMath from 'cornerstone-math';
import cornerstoneWADOImageLoader from 'cornerstone-wado-image-loader';
import cornerstoneTools from 'cornerstone-tools';
import Hammer from 'hammerjs';

cornerstoneTools.external.cornerstone = cornerstone;
cornerstoneTools.external.Hammer = Hammer;
cornerstoneTools.external.cornerstoneMath = cornerstoneMath;

cornerstoneTools.init();

// Set the tool font and font size
// context.font = "[style] [variant] [weight] [size]/[line height] [font family]";
const fontFamily =
  'Work Sans, Roboto, OpenSans, HelveticaNeue-Light, Helvetica Neue Light, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif';
cornerstoneTools.textStyle.setFont(`16px ${fontFamily}`);

// Set the tool width
cornerstoneTools.toolStyle.setToolWidth(2);

// Set color for inactive tools
cornerstoneTools.toolColors.setToolColor('rgb(255, 255, 0)');

// Set color for active tools
github PulseTile / PulseTile-React-Core / src / components / pages / Images / images-page-component / CornerstoneImage.js View on Github external
initCornerstone = () => {
    const { imageId, visibleCornerstone, index } = this.props;
    const { reEnableCornerstoneElement } = this.state;
    const element = document.getElementById(`dicomImage-${index}`);
    /* istanbul ignore next */
    if (element) {
      console.log('element ---->', element);
      cornerstoneTools.external.cornerstone = cornerstone;
      cornerstoneTools.external.cornerstoneMath = cornerstoneMath;
      cornerstoneWebImageLoader.external.cornerstone = cornerstone;
      cornerstoneWebImageLoader.external.cornerstoneMath = cornerstoneMath;

      if (reEnableCornerstoneElement) {
        console.log('reEnableCornerstoneElement --->', reEnableCornerstoneElement);
        cornerstone.enable(element);
      }

      cornerstone.loadImage(imageId).then((image) => {
        console.log('image --->', image);
        cornerstone.displayImage(element, image);
        if (image) {
          this.setState({ reEnableCornerstoneElement: false });
          visibleCornerstone(true)
        }
      }).catch((e) => {
github OHIF / Viewers / extensions / cornerstone / src / initCornerstoneTools.js View on Github external
export default function(configuration = {}) {
  // For debugging
  window.cornerstoneTools = cornerstoneTools;

  cornerstoneTools.external.cornerstone = cornerstone;
  cornerstoneTools.external.Hammer = Hammer;
  cornerstoneTools.external.cornerstoneMath = cornerstoneMath;
  cornerstoneTools.init(configuration);

  // Set the tool font and font size
  // context.font = "[style] [variant] [weight] [size]/[line height] [font family]";
  const fontFamily =
    'Roboto, OpenSans, HelveticaNeue-Light, Helvetica Neue Light, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif';
  cornerstoneTools.textStyle.setFont(`16px ${fontFamily}`);

  // Tool styles/colors
  cornerstoneTools.toolStyle.setToolWidth(2);
  cornerstoneTools.toolColors.setToolColor('rgb(255, 255, 0)');
  cornerstoneTools.toolColors.setActiveColor('rgb(0, 255, 0)');

  cornerstoneTools.store.state.touchProximity = 40;
}
github OHIF / Viewers / Packages / ohif-cornerstone / main.js View on Github external
import Hammer from 'hammerjs';
import cornerstone from 'cornerstone-core';
import cornerstoneMath from 'cornerstone-math';
import cornerstoneTools from 'cornerstone-tools';
import cornerstoneWADOImageLoader from 'cornerstone-wado-image-loader';
import dicomParser from 'dicom-parser';
import * as dcmjs from 'dcmjs/build/dcmjs';

cornerstoneTools.external.Hammer = Hammer;
cornerstoneTools.external.cornerstone = cornerstone;
cornerstoneTools.external.cornerstoneMath = cornerstoneMath;
cornerstoneWADOImageLoader.external.cornerstone = cornerstone;
cornerstoneWADOImageLoader.external.dicomParser = dicomParser;

// Export scripts that will populate the Cornerstone namespace as a side effect only import.
// This is effectively the public API...
export {
    cornerstone,
    cornerstoneTools,
    cornerstoneMath,
    cornerstoneWADOImageLoader,
    dicomParser,
    dcmjs
};
github GleasonBian / CornerstoneVueWADO / src / components / HelloWorld.vue View on Github external
//ๅผ•ๅ…ฅ cornerstone,dicomParser,cornerstoneWADOImageLoader
import * as cornerstone from "cornerstone-core";
import * as dicomParser from "dicom-parser";

// ไธๅปบ่ฎฎ npm ๅฎ‰่ฃ… cornerstoneWADOImageLoader ๅฆ‚ๆžœไฝ ๅšไบ† ไผšๅพˆๅคด็–ผ
import * as cornerstoneWADOImageLoader from "../../static/dist/cornerstoneWADOImageLoader.js";

// Cornerstone ๅทฅๅ…ทๅค–้ƒจไพ่ต–
import Hammer from "hammerjs";
import * as cornerstoneMath from "cornerstone-math";
import * as cornerstoneTools from "cornerstone-tools";

// Specify external dependencies
cornerstoneTools.external.Hammer = Hammer;
cornerstoneTools.external.cornerstone = cornerstone;
cornerstoneTools.external.cornerstoneMath = cornerstoneMath;
cornerstoneWADOImageLoader.external.cornerstoneMath = cornerstoneMath;

//ๆŒ‡ๅฎš่ฆๆณจๅ†ŒๅŠ ่ฝฝ็จ‹ๅบ็š„ๅŸบ็Ÿณๅฎžไพ‹
cornerstoneWADOImageLoader.external.cornerstone = cornerstone;

cornerstone.registerImageLoader("http", cornerstoneWADOImageLoader.loadImage);
cornerstone.registerImageLoader("https", cornerstoneWADOImageLoader.loadImage);

//้…็ฝฎ webWorker (ๅฟ…้กป้…็ฝฎ)
//ๆณจๆ„่ฟ™้‡Œ็š„่ทฏๅพ„้—ฎ้ข˜  ๅฆ‚ๆžœ่ทฏๅพ„ไธๅฏน cornerstoneWADOImageLoaderWebWorker ไผšๆŠฅ้”™ index.html Uncaught SyntaxError: Unexpected token <
var config = {
  webWorkerPath: "/static/dist/cornerstoneWADOImageLoaderWebWorker.js",
  taskConfiguration: {
    decodeTask: {
      codecsPath: "/static/dist/cornerstoneWADOImageLoaderCodecs.js"
    }
github Kitware / paraview-glance / Sources / externals / MedicalCornerstone / index.js View on Github external
import vtkURLExtract from 'vtk.js/Sources/Common/Core/URLExtract';

import * as cornerstone from 'cornerstone-core';
import * as cornerstoneTools from 'cornerstone-tools';
import * as cornerstoneMath from 'cornerstone-math';

import CornerstoneToolControl from './CornerstoneToolControl';
import ImageLoader from './CornerstoneImageLoader';
import proxyConfig from './proxyConfig';

cornerstoneTools.external.cornerstone = cornerstone;
cornerstoneTools.external.cornerstoneMath = cornerstoneMath;
cornerstone.registerImageLoader('vtkImage', ImageLoader.loader);

export function registerToGlance(Glance) {
  const { mode } = vtkURLExtract.extractURLParameters();
  if (Glance && mode === 'Medical') {
    Glance.setActiveProxyConfiguration(proxyConfig);

    Glance.registerControlTab(
      'CornerstoneTools',
      CornerstoneToolControl,
      1,
      'pencil-alt'
    );
  }
}