Medical imaging tools for the Cornerstone library
npm install @scollect/cornerstone-toolsProvides 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.
[![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]
- TOOL EXAMPLES
- Create or Update an Example
- Installing
- Examples & Docs
- [Contributing][contributing]
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.
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.
Below is a simplified example of creating a tool by extending cornerstone-tool's BaseTool class.
``javascript
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);
}
}
`
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:
`js
// 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 supportcornerstone-core
- cornerstone-math
- - Simplifies and provides shared complex tool math logiccornerstone-web-image-loader
- Any Cornerstone "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.
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
> 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 ^\_^
- Documentation
- Examples
- API
#### Annotation Tools
- Angle
- Elliptical ROI
- Length
- Rectangle ROI
#### 3rd Party Tool Plugins
- Image Statistics: Source | Demo
- OHIF Viewer: [Source][ohif-source] | [Demo][ohif-demo]
Thanks goes to these people ([emoji key][emojis]):
|
Chris Hafey
π π» π π’ |
Erik Ziegler
π» π π π§ π") π¬ |
Danny Brown
π» π π π§ π") π π¬ |
James Petts
π» π π π π¬ |
Steve Pieper
π¬ π§ |
Rodrigo Antinarelli
π» |
Zaid Safadi
π¬ π» |
| :---: | :---: | :---: | :---: | :---: | :---: | :---: |
|
Gustavo AndrΓ© Lelis
π» |
Kofifus
π» π§ π |
AloΓ―s Dreyfus
π» |
Tim Leslie
π» |
diego0020
π» |
Evren Ozkan
π» |
Salvador Daniel Pelayo
π» |
|
Juan Narvaez
π» |
Mike
π π» β οΈ |
Sangkeun Kim
π» π¬ |
Victor Saase
π€ |
Michael Wasser
π |
Amandeep Singh
π |
Madison Dickson
π |
|
Kevin Lee Drum
π» |
Makarand Bauskar
π» |
Biharck Araujo
π‘ π |
Devon Bernard
π |
Karl-Heinrich
π π» β οΈ |
counterxing
π π» |
Jorge Lopes
π¬ |
|
Gabriel Garrido
π» |
This project follows the [all-contributors][all-contributors] specification.
Contributions of any kind welcome!
_Looking to contribute? Look for the [Good First Issue][good-first-issue]
label._
Please file an issue for bugs, missing documentation, or unexpected behavior.
[See Bugs][bugs]
Please file an issue to suggest new features. Vote on feature requests by adding
a π. This helps maintainers prioritize what to work on.
- [See Feature Requests][requests-feature]
- [See Internal Change Requests][requests-implementation]
For questions related to using the library, please visit our support community,
or file an issue on GitHub.
- [Google Group][google-group]
MIT
[build-badge]: https://circleci.com/gh/cornerstonejs/cornerstoneTools/tree/master.svg?style=svg
[build]: https://circleci.com/gh/cornerstonejs/cornerstoneTools/tree/master
[contributing]: https://github.com/cornerstonejs/cornerstoneTools/blob/master/CONTRIBUTING.md
[coverage-badge]: https://codecov.io/gh/cornerstonejs/cornerstoneTools/branch/master/graphs/badge.svg
[coverage]: https://codecov.io/gh/cornerstonejs/cornerstoneTools/branch/master
[npm-url]: https://npmjs.org/package/cornerstone-tools
[npm-downloads-image]: http://img.shields.io/npm/dm/cornerstone-tools.svg?style=flat
[npm-version-image]: http://img.shields.io/npm/v/cornerstone-tools.svg?style=flat
[license-image]: http://img.shields.io/badge/license-MIT-blue.svg?style=flat
[license-url]: LICENSE
[version-2]: https://github.com/cornerstonejs/cornerstoneTools/tree/v2.4.x
[node]: https://nodejs.org
[ohif-demo]: https://viewer.ohif.org/demo-signin
[ohif-source]: https://github.com/OHIF/Viewers
[emojis]: https://github.com/kentcdodds/all-contributors#emoji-key
[all-contributors]: https://github.com/kentcdodds/all-contributors
[bugs]: https://github.com/cornerstonejs/cornerstoneTools/issues?q=is%3Aissue+is%3Aopen+label%3A"π+Bug%3A+Verified"+sort%3Acreated-desc
[requests-feature]: https://github.com/cornerstonejs/cornerstoneTools/issues?q=is%3Aissue+sort%3Areactions-%2B1-desc+label%3A"π»+Change%3A+Feature"+is%3Aopen
[requests-implementation]: https://github.com/cornerstonejs/cornerstoneTools/issues?q=is%3Aissue+sort%3Areactions-%2B1-desc+label%3A"π»+Change%3A+Implementation"+is%3Aopen
[good-first-issue]: https://github.com/cornerstonejs/cornerstoneTools/issues?utf8=β&q=is%3Aissue+is%3Aopen+sort%3Areactions-%2B1-desc+label%3A"π₯+Good+First+Issue"
[google-group]: https://groups.google.com/forum/#!forum/cornerstone-platform