A framework for tools built on top of Cornerstone.
Branch: master
Clone or download
dannyrb Merge pull request #858 from cornerstonejs/bidirectional-lnn
fix(bidirectional): Support for lesion naming number in bidirectional
Latest commit 0369c2c Feb 22, 2019
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.circleci Avoid new host github issue Feb 16, 2019
.github Create a pull request template Mar 10, 2018
.vscode Debug jest tests in VS Code Nov 23, 2018
config/webpack chore(exports): Try to add a top-level export named cornerstoneTools (#… Dec 5, 2018
docs Add examples to menu link Feb 16, 2019
examples-old shift old examples to a different folder Feb 15, 2019
examples
src fix(bidirectional): Support for lesion naming number in bidirectional Feb 22, 2019
.all-contributorsrc docs: update .all-contributorsrc Feb 7, 2019
.babelrc Patch up test portion of config Oct 31, 2018
.eslintignore Ignore everything but src/ Nov 10, 2018
.eslintrc.js Update .eslintrc.js so that npm run lint behaves as expected Feb 6, 2019
.gitignore Ignore `docma` output Nov 9, 2018
.jsdocrc Migrate to ES6 Modules, Babel/Webpack build process May 19, 2017
.npmignore Remove unused packages Nov 26, 2018
.prettierrc Prettier config Nov 12, 2018
.releaserc target release branch Feb 5, 2019
CONTRIBUTING.md docs(Contributing): Basic contributing guide and information Feb 11, 2019
LICENSE build sucessfuly and touch tools tested Sep 29, 2014
README.md docs update; install note Feb 21, 2019
changelog.md Bump version to 2.4.0 Oct 25, 2018
docma-dev.json Add a docma-dev config Nov 24, 2018
docma.json Simplify namespacing Nov 13, 2018
index.html Fix the getEnabledElementByUID store getter. Jan 29, 2019
package-lock.json npm audit --fix Feb 16, 2019
package.json npm audit --fix Feb 16, 2019
yarn.lock migrate cobb angle Aug 21, 2018

README.md

cornerstone-tools

Provides a simple, extensible framework for creating tools on top of Cornerstone.js. Includes common tool implementations, and leverages DICOM metadata (when available) for advanced functionality.

Read The Docs | Edit the docs


Build Status Coverage Status All Contributors

NPM version NPM downloads MIT License

Index

The problem

Building one or two tools on top of Cornerstone.js is not that difficult. However, as the number of tools grow, you begin to encounter difficult problems:

  • Tools should behave and be configurable in a consistant way
  • Managing tools across multiple cornerstone enabled elements
  • Tools that need knowledge of a fellow tool's state
  • The ability to "drop-in" others' tools, and they "just work"
  • and many others

This library solves these problems in a highly pluggable and extensible way.

This solution

cornerstone-tools is a light-weight solution for building Tools on top of Cornerstone.js. It's only dependencies are libraries within the Cornerstone family. Instead of trying to "do everything" it aims to be extensible and pluggable to aid in the rapid development of new tools. Ideally, tools created using cornerstone-tools can be easily shared, allowing for the creation of a broader ecosystem.

Example

Below is a simplified example of creating a tool by extending cornerstone-tool's BaseTool class.

import cornerstone from 'cornerstone-core';
import { BaseTool } from 'cornerstone-tools';
import basicLevelingStrategy from '...';

export default class WwwcTool extends BaseTool {
  constructor(configuration = {}) {
    const defaultConfig = {
      name: 'Wwwc',
      strategies: { basicLevelingStrategy },
      supportedInteractionTypes: ['Mouse', 'Touch'],
      configuration: {
        orientation: 0,
      },
    };
    const initialConfiguration = Object.assign(defaultConfig, configuration);

    super(initialConfiguration);
  }

  mouseDragCallback(evt) {
    this.applyActiveStrategy(evt);

    cornerstone.setViewport(evt.detail.element, evt.detail.viewport);
  }

  touchDragCallback(evt) {
    evt.stopImmediatePropagation();
    this.applyActiveStrategy(evt);

    cornerstone.setViewport(evt.detail.element, evt.detail.viewport);
  }
}

Installation

This module is distributed via npm which is bundled with node and should be installed as one of your project's dependencies:

// To install the newest version
npm install --save cornerstone-tools@3

// To install the legacy version (2.4.x branch)
npm install --save cornerstone-tools@2

This library has peerDependencies listings for:

  • hammerjs - Better touch support
  • cornerstone-core
  • cornerstone-math - Simplifies and provides shared complex tool math logic
  • Any Cornerstone "Image Loader"
    • cornerstone-web-image-loader - JPEG/PNG images
    • cornerstone-wado-image-loader - DICOM images; also parses tags for tool use

If you need to support the IE11 Browser, you will need to provide polyfills as needed.

Setting up and configuring cornerstone-tools's depency can be the biggest hurdle to getting started. Be sure to check out our docs for assistance.

Docs

Examples & Docs

The latest major version has just been published. We are still flushing out our examples. If you have anything you would like to see documented, or you want a specific example from version 2 ported, either create an issue or make a pull request ^_^

Tools

Annotation Tools

3rd Party Tool Plugins

Other Solutions

Contributors

Thanks goes to these people (emoji key):

Chris Hafey
Chris Hafey

📖 💻 📝 📢
Erik Ziegler
Erik Ziegler

💻 📖 👀 🚧 🚇 💬
Danny Brown
Danny Brown

💻 📖 👀 🚧 🚇 🔌 💬
James Petts
James Petts

💻 👀 🔌 📖 💬
Steve Pieper
Steve Pieper

💬 🔧
Rodrigo Antinarelli
Rodrigo Antinarelli

💻
Zaid Safadi
Zaid Safadi

💬
Gustavo André Lelis
Gustavo André Lelis

💻
Kofifus
Kofifus

💻 🔧 🐛
Aloïs Dreyfus
Aloïs Dreyfus

💻
Tim Leslie
Tim Leslie

💻
diego0020
diego0020

💻
Evren Ozkan
Evren Ozkan

💻
Salvador Daniel Pelayo
Salvador Daniel Pelayo

💻

This project follows the all-contributors specification. Contributions of any kind welcome!

Issues

Looking to contribute? Look for the Good First Issue label.

🐛 Bugs

Please file an issue for bugs, missing documentation, or unexpected behavior.

See Bugs

💡 Feature Requests

Please file an issue to suggest new features. Vote on feature requests by adding a 👍. This helps maintainers prioritize what to work on.

Questions

For questions related to using the library, please visit our support community, or file an issue on GitHub.

LICENSE

MIT