CornerstoneTools
[Deprecated] Use Cornerstone3D Instead https://cornerstonejs.org/
Install / Use
/learn @cornerstonejs/CornerstoneToolsREADME
🔔🔔🔔🔔 Attention: Cornerstone.js has evolved! We're excited to introduce Cornerstone3D 🚀. Expect advanced rendering, stellar performance, and a modern toolset. 🌐 Navigate to the new repository for the latest updates and improvements.
<div align="center"> <h1>cornerstone-tools</h1> <p>Provides a simple, extensible framework for creating tools on top of <a href="https://github.com/cornerstonejs/cornerstone/">Cornerstone.js</a>. Includes common tool implementations, and leverages DICOM metadata (when available) for advanced functionality.</p> </div> <hr /> <!-- prettier-ignore-start -->[![Build Status][build-badge]][build]
[![Coverage Status][coverage-badge]][coverage]
[![NPM version][npm-version-image]][npm-url] [![NPM downloads][npm-downloads-image]][npm-url] [![MIT License][license-image]][license-url]
<!-- prettier-ignore-end -->Index
The Fun Stuff
Everything Else
- Installing
- Examples & Docs
- [Contributing][contributing]
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][npm-url] which is bundled with [node][node] and
should be installed as one of your project's dependencies:
// To install the newest version
npm install --save cornerstone-tools
// To install the legacy version (2.4.x branch)
npm install --save cornerstone-tools@2
This library has peerDependencies listings for:
hammerjs- Better touch supportcornerstone-corecornerstone-math- Simplifies and provides shared complex tool math logic- Any Cornerstone "Image Loader"
cornerstone-web-image-loader- JPEG/PNG imagescornerstone-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. Our BrowserList target:
"browserslist": [
"> 1%",
"IE 11",
"not dead",
"not IE < 11",
"not op_mini all"
]
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.
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][version-2] ported, either create an issue or make a pull request ^_^
Tools
Annotation Tools
3rd Party Tool Plugins
A huge thanks to tool authors, like @sisobus, for sharing their work with the community!
Other Solutions
- OHIF Viewer: [Source][ohif-source] | [Demo][ohif-demo]
Contributors
Thanks goes to these people ([emoji key][emojis]):
<!-- ALL-CONTRIBUTORS-LIST:START - Do not remove or modify this section --> <!-- prettier-ignore -->| <img src="https://avatars2.githubusercontent.com/u/1268698?v=4" width="100px;" alt="Chris Hafey"/><br /><sub><b>Chris Hafey</b></sub><br />📖 💻 📝 📢 | <img src="https://avatars3.githubusercontent.com/u/607793?v=4" width="100px;" alt="Erik Ziegler"/><br /><sub><b>Erik Ziegler</b></sub><br />💻 📖 👀 🚧 🚇 💬 | <img src="https://avatars1.githubusercontent.com/u/5797588?v=4" width="100px;" alt="Danny Brown"/><br /><sub><b>Danny Brown</b></sub><br />💻 📖 👀 🚧 🚇 🔌 💬 | <img src="https://avatars0.githubusercontent.com/u/25818497?v=4" width="100px;" alt="James Petts"/><br /><sub><b>James Petts</b></sub><br />💻 👀 🔌 📖 💬 | <img src="https://avatars0.githubusercontent.com/u/126077?v=4" width="100px;" alt="Steve Pieper"/><br /><sub><b>Steve Pieper</b></sub><br />💬 🔧 | <img src="https://avatars3.githubusercontent.com/u/1905961?v=4" width="100px;" alt="Rodrigo Antinarelli"/><br /><sub><b>Rodrigo Antinarelli</b></sub><br />💻 | <img src="https://avatars2.githubusercontent.com/u/10813109?v=4" width="100px;" alt="Zaid Safadi"/><br /><sub><b>Zaid Safadi</b></sub><br />💬 💻 | | :---: | :---: | :---: | :---: | :---: | :---: | :---: | | <img src="https://avatars3.githubusercontent.com/u/2378326?v=4" width="100px;" alt="Gustavo André Lelis"/><br /><sub><b>Gustavo André Lelis</b></sub><br />💻 | <img src="https://avatars1.githubusercontent.com/u/3926071?v=4" width="100px;" alt="Kofifus"/><br /><sub><b>Kofifus</b></sub><br />💻 🔧 🐛 | <img src="https://avatars2.githubusercontent.com/u/25580127?v=4" width="100px;" alt="Aloïs Dreyfus"/><br /><sub><b>Aloïs Dreyfus</b></sub><br />💻 | [<im
