Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/cornerstonejs/cornerstonetools

[Deprecated] Use Cornerstone3D Instead https://cornerstonejs.org/
https://github.com/cornerstonejs/cornerstonetools

cornerstone dicom hacktoberfest javascript medical-imaging nci-itcr

Last synced: 3 days ago
JSON representation

[Deprecated] Use Cornerstone3D Instead https://cornerstonejs.org/

Awesome Lists containing this project

README

        

## πŸ””πŸ””πŸ””πŸ”” Attention: Cornerstone.js has evolved! We're excited to introduce [Cornerstone3D](https://github.com/cornerstonejs/cornerstone3D) πŸš€. Expect advanced rendering, stellar performance, and a modern toolset. 🌐 Navigate to the new repository for the latest updates and improvements.


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**](https://tools.cornerstonejs.org/) | [Edit the docs](https://github.com/cornerstonejs/cornerstoneTools/edit/master/docs/)


[![Build Status][build-badge]][build]
[![Coverage Status][coverage-badge]][coverage]
[![All Contributors](https://img.shields.io/badge/all_contributors-37-orange.svg?style=flat-square)](#contributors)

[![NPM version][npm-version-image]][npm-url]
[![NPM downloads][npm-downloads-image]][npm-url]
[![MIT License][license-image]][license-url]

## Index

### The Fun Stuff

- [TOOL EXAMPLES](https://tools.cornerstonejs.org/examples/)
- [Create or Update an Example](https://github.com/cornerstonejs/cornerstoneTools/tree/master/examples)

### Everything Else

- [Installing](#installation)
- [Examples & Docs](#examples--docs)
- [Contributing][contributing]

## The problem

Building one or two tools on top of [Cornerstone.js](https://github.com/cornerstonejs/cornerstone/) 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 element`s
- 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.

```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);
}
}
```

## 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`:

```js
// 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 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. Our BrowserList target:

```json
"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.**

> [**Docs**](https://tools.cornerstonejs.org/installation.html)

## 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 ^\_^

- [Documentation](https://tools.cornerstonejs.org)
- [Examples](https://tools.cornerstonejs.org/examples)
- [API](https://tools.cornerstonejs.org/api)

### Tools

#### Annotation Tools

- [Angle](https://tools.cornerstonejs.org/examples/tools/angle.html)
- [Elliptical ROI](https://tools.cornerstonejs.org/examples/tools/elliptical-roi.html)
- [Length](https://tools.cornerstonejs.org/examples/tools/length.html)
- [Rectangle ROI](https://tools.cornerstonejs.org/examples/tools/rectangle-roi.html)

#### 3rd Party Tool Plugins

- Image Statistics: [Source](https://github.com/QSolutionsLLC/cornerstone-tool-image-statistics) | [Demo](https://qsolutionsllc.github.io/cornerstone-tool-image-statistics/)
- Rotated Elliptical ROI Tool: [Source](https://github.com/sisobus/cornerstoneTools-RotatedEllipticalRoiTool) | [Demo](https://examples.sisobus.com/rotated-elliptical-roi/)

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]):

| [Chris Hafey
Chris Hafey](https://www.linkedin.com/in/chafey)
[πŸ“–](https://github.com/cornerstonejs/cornerstoneTools/commits?author=chafey "Documentation") [πŸ’»](https://github.com/cornerstonejs/cornerstoneTools/commits?author=chafey "Code") [πŸ“](#blog-chafey "Blogposts") [πŸ“’](#talk-chafey "Talks") | [Erik Ziegler
Erik Ziegler](https://github.com/swederik)
[πŸ’»](https://github.com/cornerstonejs/cornerstoneTools/commits?author=swederik "Code") [πŸ“–](https://github.com/cornerstonejs/cornerstoneTools/commits?author=swederik "Documentation") [πŸ‘€](#review-swederik "Reviewed Pull Requests") [🚧](#maintenance-swederik "Maintenance") [πŸš‡](#infra-swederik "Infrastructure (Hosting, Build-Tools, etc)") [πŸ’¬](#question-swederik "Answering Questions") | [Danny Brown
Danny Brown](http://dannyrb.com/)
[πŸ’»](https://github.com/cornerstonejs/cornerstoneTools/commits?author=dannyrb "Code") [πŸ“–](https://github.com/cornerstonejs/cornerstoneTools/commits?author=dannyrb "Documentation") [πŸ‘€](#review-dannyrb "Reviewed Pull Requests") [🚧](#maintenance-dannyrb "Maintenance") [πŸš‡](#infra-dannyrb "Infrastructure (Hosting, Build-Tools, etc)") [πŸ”Œ](#plugin-dannyrb "Plugin/utility libraries") [πŸ’¬](#question-dannyrb "Answering Questions") | [James Petts
James Petts](https://github.com/JamesAPetts)
[πŸ’»](https://github.com/cornerstonejs/cornerstoneTools/commits?author=JamesAPetts "Code") [πŸ‘€](#review-JamesAPetts "Reviewed Pull Requests") [πŸ”Œ](#plugin-JamesAPetts "Plugin/utility libraries") [πŸ“–](https://github.com/cornerstonejs/cornerstoneTools/commits?author=JamesAPetts "Documentation") [πŸ’¬](#question-JamesAPetts "Answering Questions") | [Steve Pieper
Steve Pieper](http://www.isomics.com)
[πŸ’¬](#question-pieper "Answering Questions") [πŸ”§](#tool-pieper "Tools") | [Rodrigo Antinarelli
Rodrigo Antinarelli](https://rodrigoea.com/)
[πŸ’»](https://github.com/cornerstonejs/cornerstoneTools/commits?author=rodrigolabs "Code") | [Zaid Safadi
Zaid Safadi](http://blog.zaidsafadi.com/)
[πŸ’¬](#question-Zaid-Safadi "Answering Questions") [πŸ’»](https://github.com/cornerstonejs/cornerstoneTools/commits?author=Zaid-Safadi "Code") |
| :---: | :---: | :---: | :---: | :---: | :---: | :---: |
| [Gustavo AndrΓ© Lelis
Gustavo AndrΓ© Lelis](https://github.com/galelis)
[πŸ’»](https://github.com/cornerstonejs/cornerstoneTools/commits?author=galelis "Code") | [Kofifus
Kofifus](https://github.com/kofifus)
[πŸ’»](https://github.com/cornerstonejs/cornerstoneTools/commits?author=kofifus "Code") [πŸ”§](#tool-kofifus "Tools") [πŸ›](https://github.com/cornerstonejs/cornerstoneTools/issues?q=author%3Akofifus "Bug reports") | [AloΓ―s Dreyfus
AloΓ―s Dreyfus](http://www.linkedin.com/in/alois-dreyfus/)
[πŸ’»](https://github.com/cornerstonejs/cornerstoneTools/commits?author=adreyfus "Code") | [Tim Leslie
Tim Leslie](http://www.timl.id.au)
[πŸ’»](https://github.com/cornerstonejs/cornerstoneTools/commits?author=timleslie "Code") | [diego0020
diego0020](https://github.com/diego0020)
[πŸ’»](https://github.com/cornerstonejs/cornerstoneTools/commits?author=diego0020 "Code") | [Evren Ozkan
Evren Ozkan](https://github.com/evren217)
[πŸ’»](https://github.com/cornerstonejs/cornerstoneTools/commits?author=evren217 "Code") | [Salvador Daniel Pelayo
Salvador Daniel Pelayo](https://github.com/daniel2101)
[πŸ’»](https://github.com/cornerstonejs/cornerstoneTools/commits?author=daniel2101 "Code") |
| [Juan Narvaez
Juan Narvaez](https://github.com/jdnarvaez)
[πŸ’»](https://github.com/cornerstonejs/cornerstoneTools/commits?author=jdnarvaez "Code") | [Mike
Mike](https://github.com/mikehazell)
[πŸ“–](https://github.com/cornerstonejs/cornerstoneTools/commits?author=mikehazell "Documentation") [πŸ’»](https://github.com/cornerstonejs/cornerstoneTools/commits?author=mikehazell "Code") [⚠️](https://github.com/cornerstonejs/cornerstoneTools/commits?author=mikehazell "Tests") | [Sangkeun Kim
Sangkeun Kim](http://sisobus.com)
[πŸ’»](https://github.com/cornerstonejs/cornerstoneTools/commits?author=sisobus "Code") [πŸ’¬](#question-sisobus "Answering Questions") | [Victor Saase
Victor Saase](https://github.com/vsaase)
[πŸ€”](#ideas-vsaase "Ideas, Planning, & Feedback") | [Michael Wasser
Michael Wasser](http://www.mikewasser.com)
[πŸ“–](https://github.com/cornerstonejs/cornerstoneTools/commits?author=untoldone "Documentation") | [Amandeep Singh
Amandeep Singh](https://github.com/singhArmani)
[πŸ–‹](#content-singhArmani "Content") | [Madison Dickson
Madison Dickson](http://mix3dstudios.com)
[πŸ“–](https://github.com/cornerstonejs/cornerstoneTools/commits?author=mix3d "Documentation") |
| [Kevin Lee Drum
Kevin Lee Drum](https://github.com/kevinleedrum)
[πŸ’»](https://github.com/cornerstonejs/cornerstoneTools/commits?author=kevinleedrum "Code") | [Makarand Bauskar
Makarand Bauskar](https://github.com/mmbauskar)
[πŸ’»](https://github.com/cornerstonejs/cornerstoneTools/commits?author=mbauskar "Code") | [Biharck Araujo
Biharck Araujo](http://www.biharck.com.br)
[πŸ’‘](#example-biharck "Examples") [πŸ“–](https://github.com/cornerstonejs/cornerstoneTools/commits?author=biharck "Documentation") | [Devon Bernard
Devon Bernard](https://www.linkedin.com/in/devonbernard)
[πŸ“–](https://github.com/cornerstonejs/cornerstoneTools/commits?author=DevonBernard "Documentation") | [Karl-Heinrich
Karl-Heinrich](https://github.com/Karl-Heinrich)
[πŸ›](https://github.com/cornerstonejs/cornerstoneTools/issues?q=author%3AKarl-Heinrich "Bug reports") [πŸ’»](https://github.com/cornerstonejs/cornerstoneTools/commits?author=Karl-Heinrich "Code") [⚠️](https://github.com/cornerstonejs/cornerstoneTools/commits?author=Karl-Heinrich "Tests") | [counterxing
counterxing](https://blog.xingbofeng.com/)
[πŸ›](https://github.com/cornerstonejs/cornerstoneTools/issues?q=author%3Axingbofeng "Bug reports") [πŸ’»](https://github.com/cornerstonejs/cornerstoneTools/commits?author=xingbofeng "Code") | [Jorge Lopes
Jorge Lopes](https://github.com/jlopes90)
[πŸ’¬](#question-jlopes90 "Answering Questions") |
| [Gabriel Garrido
Gabriel Garrido](http://garrido.io)
[πŸ’»](https://github.com/cornerstonejs/cornerstoneTools/commits?author=Ggpsv "Code") | [ASVBPREAUBV
ASVBPREAUBV](https://github.com/ASVBPREAUBV)
[πŸ“–](https://github.com/cornerstonejs/cornerstoneTools/commits?author=ASVBPREAUBV "Documentation") | [frolic06
frolic06](https://github.com/frolic06)
[πŸ’»](https://github.com/cornerstonejs/cornerstoneTools/commits?author=frolic06 "Code") | [codepage949
codepage949](https://github.com/codepage949)
[πŸ’»](https://github.com/cornerstonejs/cornerstoneTools/commits?author=codepage949 "Code") | [Asherah Connor
Asherah Connor](https://kivikakk.ee)
[πŸ’»](https://github.com/cornerstonejs/cornerstoneTools/commits?author=kivikakk "Code") | [Ikko Ashimine
Ikko Ashimine](https://bandism.net/)
[πŸ›](https://github.com/cornerstonejs/cornerstoneTools/issues?q=author%3Aeltociear "Bug reports") | [Bill Wallace
Bill Wallace](https://github.com/wayfarer3130)
[πŸ’»](https://github.com/cornerstonejs/cornerstoneTools/commits?author=wayfarer3130 "Code") [πŸ“–](https://github.com/cornerstonejs/cornerstoneTools/commits?author=wayfarer3130 "Documentation") |
| [Bruno Alves de Faria
Bruno Alves de Faria](http://radicalimaging.com/)
[πŸ›](https://github.com/cornerstonejs/cornerstoneTools/issues?q=author%3Abrunoalvesdefaria "Bug reports") [πŸ’»](https://github.com/cornerstonejs/cornerstoneTools/commits?author=brunoalvesdefaria "Code") [πŸ–‹](#content-brunoalvesdefaria "Content") [πŸ“–](https://github.com/cornerstonejs/cornerstoneTools/commits?author=brunoalvesdefaria "Documentation") [πŸ”Œ](#plugin-brunoalvesdefaria "Plugin/utility libraries") [πŸ‘€](#review-brunoalvesdefaria "Reviewed Pull Requests") [⚠️](https://github.com/cornerstonejs/cornerstoneTools/commits?author=brunoalvesdefaria "Tests") [πŸ”§](#tool-brunoalvesdefaria "Tools") [πŸ““](#userTesting-brunoalvesdefaria "User Testing") | [Igor Octaviano
Igor Octaviano](http://igoroctaviano.com)
[πŸ’»](https://github.com/cornerstonejs/cornerstoneTools/commits?author=igoroctaviano "Code") [πŸ“–](https://github.com/cornerstonejs/cornerstoneTools/commits?author=igoroctaviano "Documentation") [🚧](#maintenance-igoroctaviano "Maintenance") [πŸ‘€](#review-igoroctaviano "Reviewed Pull Requests") [πŸ““](#userTesting-igoroctaviano "User Testing") |

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

## Issues

_Looking to contribute? Look for the [Good First Issue][good-first-issue]
label._

### πŸ› Bugs

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

[**See Bugs**][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.

- [**See Feature Requests**][requests-feature]
- [**See Internal Change Requests**][requests-implementation]

### ❓ Questions

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

- [Google Group][google-group]

## LICENSE

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