UNPKG

19.3 kBMarkdownView Raw
1<div align="center">
2<h1>cornerstone-tools</h1>
3
4<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>
5
6[**Read The Docs**](https://tools.cornerstonejs.org/) | [Edit the docs](https://github.com/cornerstonejs/cornerstoneTools/edit/master/docs/)
7
8</div>
9
10<hr />
11
12<!-- prettier-ignore-start -->
13[![Build Status][build-badge]][build]
14[![Coverage Status][coverage-badge]][coverage]
15[![All Contributors](https://img.shields.io/badge/all_contributors-34-orange.svg?style=flat-square)](#contributors)
16
17[![NPM version][npm-version-image]][npm-url]
18[![NPM downloads][npm-downloads-image]][npm-url]
19[![MIT License][license-image]][license-url]
20<!-- prettier-ignore-end -->
21
22## Index
23
24### The Fun Stuff
25
26- [TOOL EXAMPLES](https://tools.cornerstonejs.org/examples/)
27 - [Create or Update an Example](https://github.com/cornerstonejs/cornerstoneTools/tree/master/examples)
28
29### Everything Else
30
31- [Installing](#installation)
32- [Examples & Docs](#examples--docs)
33- [Contributing][contributing]
34
35## The problem
36
37Building 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:
38
39- Tools should behave and be configurable in a consistant way
40- Managing tools across multiple cornerstone `enabled element`s
41- Tools that need knowledge of a fellow tool's state
42- The ability to "drop-in" others' tools, and they "just work"
43- and many others
44
45This library solves these problems in a highly pluggable and extensible way.
46
47## This solution
48
49`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.
50
51## Example
52
53Below is a simplified example of creating a tool by extending `cornerstone-tool`'s `BaseTool` class.
54
55```javascript
56import cornerstone from 'cornerstone-core';
57import { BaseTool } from 'cornerstone-tools';
58import basicLevelingStrategy from '...';
59
60export default class WwwcTool extends BaseTool {
61 constructor(configuration = {}) {
62 const defaultConfig = {
63 name: 'Wwwc',
64 strategies: { basicLevelingStrategy },
65 supportedInteractionTypes: ['Mouse', 'Touch'],
66 configuration: {
67 orientation: 0,
68 },
69 };
70 const initialConfiguration = Object.assign(defaultConfig, configuration);
71
72 super(initialConfiguration);
73 }
74
75 mouseDragCallback(evt) {
76 this.applyActiveStrategy(evt);
77
78 cornerstone.setViewport(evt.detail.element, evt.detail.viewport);
79 }
80
81 touchDragCallback(evt) {
82 evt.stopImmediatePropagation();
83 this.applyActiveStrategy(evt);
84
85 cornerstone.setViewport(evt.detail.element, evt.detail.viewport);
86 }
87}
88```
89
90## Installation
91
92This module is distributed via [npm][npm-url] which is bundled with [node][node] and
93should be installed as one of your project's `dependencies`:
94
95```js
96// To install the newest version
97npm install --save cornerstone-tools
98
99// To install the legacy version (2.4.x branch)
100npm install --save cornerstone-tools@2
101```
102
103This library has `peerDependencies` listings for:
104
105- `hammerjs` - Better touch support
106- `cornerstone-core`
107- `cornerstone-math` - Simplifies and provides shared complex tool math logic
108- Any Cornerstone "Image Loader"
109 - `cornerstone-web-image-loader` - JPEG/PNG images
110 - `cornerstone-wado-image-loader` - DICOM images; also parses tags for tool use
111
112If you need to support the `IE11` Browser, you will need to provide polyfills as needed. Our BrowserList target:
113
114```json
115 "browserslist": [
116 "> 1%",
117 "IE 11",
118 "not dead",
119 "not IE < 11",
120 "not op_mini all"
121 ]
122```
123
124**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.**
125
126> [**Docs**](https://tools.cornerstonejs.org/installation.html)
127
128## Examples & Docs
129
130> 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 ^\_^
131
132- [Documentation](https://tools.cornerstonejs.org)
133- [Examples](https://tools.cornerstonejs.org/examples)
134- [API](https://tools.cornerstonejs.org/api)
135
136### Tools
137
138#### Annotation Tools
139
140- [Angle](https://tools.cornerstonejs.org/examples/tools/angle.html)
141- [Elliptical ROI](https://tools.cornerstonejs.org/examples/tools/elliptical-roi.html)
142- [Length](https://tools.cornerstonejs.org/examples/tools/length.html)
143- [Rectangle ROI](https://tools.cornerstonejs.org/examples/tools/rectangle-roi.html)
144
145#### 3rd Party Tool Plugins
146
147- Image Statistics: [Source](https://github.com/QSolutionsLLC/cornerstone-tool-image-statistics) | [Demo](https://qsolutionsllc.github.io/cornerstone-tool-image-statistics/)
148- Rotated Elliptical ROI Tool: [Source](https://github.com/sisobus/cornerstoneTools-RotatedEllipticalRoiTool) | [Demo](https://examples.sisobus.com/rotated-elliptical-roi/)
149
150A huge thanks to tool authors, like @sisobus, for sharing their work with the community!
151
152## Other Solutions
153
154- OHIF Viewer: [Source][ohif-source] | [Demo][ohif-demo]
155
156## Contributors
157
158Thanks goes to these people ([emoji key][emojis]):
159
160<!-- ALL-CONTRIBUTORS-LIST:START - Do not remove or modify this section -->
161<!-- prettier-ignore -->
162| [<img src="https://avatars2.githubusercontent.com/u/1268698?v=4" width="100px;" alt="Chris Hafey"/><br /><sub><b>Chris Hafey</b></sub>](https://www.linkedin.com/in/chafey)<br />[πŸ“–](https://github.com/cornerstonejs/cornerstoneTools/commits?author=chafey "Documentation") [πŸ’»](https://github.com/cornerstonejs/cornerstoneTools/commits?author=chafey "Code") [πŸ“](#blog-chafey "Blogposts") [πŸ“’](#talk-chafey "Talks") | [<img src="https://avatars3.githubusercontent.com/u/607793?v=4" width="100px;" alt="Erik Ziegler"/><br /><sub><b>Erik Ziegler</b></sub>](https://github.com/swederik)<br />[πŸ’»](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") | [<img src="https://avatars1.githubusercontent.com/u/5797588?v=4" width="100px;" alt="Danny Brown"/><br /><sub><b>Danny Brown</b></sub>](http://dannyrb.com/)<br />[πŸ’»](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") | [<img src="https://avatars0.githubusercontent.com/u/25818497?v=4" width="100px;" alt="James Petts"/><br /><sub><b>James Petts</b></sub>](https://github.com/JamesAPetts)<br />[πŸ’»](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") | [<img src="https://avatars0.githubusercontent.com/u/126077?v=4" width="100px;" alt="Steve Pieper"/><br /><sub><b>Steve Pieper</b></sub>](http://www.isomics.com)<br />[πŸ’¬](#question-pieper "Answering Questions") [πŸ”§](#tool-pieper "Tools") | [<img src="https://avatars3.githubusercontent.com/u/1905961?v=4" width="100px;" alt="Rodrigo Antinarelli"/><br /><sub><b>Rodrigo Antinarelli</b></sub>](https://rodrigoea.com/)<br />[πŸ’»](https://github.com/cornerstonejs/cornerstoneTools/commits?author=rodrigolabs "Code") | [<img src="https://avatars2.githubusercontent.com/u/10813109?v=4" width="100px;" alt="Zaid Safadi"/><br /><sub><b>Zaid Safadi</b></sub>](http://blog.zaidsafadi.com/)<br />[πŸ’¬](#question-Zaid-Safadi "Answering Questions") [πŸ’»](https://github.com/cornerstonejs/cornerstoneTools/commits?author=Zaid-Safadi "Code") |
163| :---: | :---: | :---: | :---: | :---: | :---: | :---: |
164| [<img src="https://avatars3.githubusercontent.com/u/2378326?v=4" width="100px;" alt="Gustavo AndrΓ© Lelis"/><br /><sub><b>Gustavo AndrΓ© Lelis</b></sub>](https://github.com/galelis)<br />[πŸ’»](https://github.com/cornerstonejs/cornerstoneTools/commits?author=galelis "Code") | [<img src="https://avatars1.githubusercontent.com/u/3926071?v=4" width="100px;" alt="Kofifus"/><br /><sub><b>Kofifus</b></sub>](https://github.com/kofifus)<br />[πŸ’»](https://github.com/cornerstonejs/cornerstoneTools/commits?author=kofifus "Code") [πŸ”§](#tool-kofifus "Tools") [πŸ›](https://github.com/cornerstonejs/cornerstoneTools/issues?q=author%3Akofifus "Bug reports") | [<img src="https://avatars2.githubusercontent.com/u/25580127?v=4" width="100px;" alt="AloΓ―s Dreyfus"/><br /><sub><b>AloΓ―s Dreyfus</b></sub>](http://www.linkedin.com/in/alois-dreyfus/)<br />[πŸ’»](https://github.com/cornerstonejs/cornerstoneTools/commits?author=adreyfus "Code") | [<img src="https://avatars0.githubusercontent.com/u/616382?v=4" width="100px;" alt="Tim Leslie"/><br /><sub><b>Tim Leslie</b></sub>](http://www.timl.id.au)<br />[πŸ’»](https://github.com/cornerstonejs/cornerstoneTools/commits?author=timleslie "Code") | [<img src="https://avatars3.githubusercontent.com/u/7297450?v=4" width="100px;" alt="diego0020"/><br /><sub><b>diego0020</b></sub>](https://github.com/diego0020)<br />[πŸ’»](https://github.com/cornerstonejs/cornerstoneTools/commits?author=diego0020 "Code") | [<img src="https://avatars1.githubusercontent.com/u/4920551?v=4" width="100px;" alt="Evren Ozkan"/><br /><sub><b>Evren Ozkan</b></sub>](https://github.com/evren217)<br />[πŸ’»](https://github.com/cornerstonejs/cornerstoneTools/commits?author=evren217 "Code") | [<img src="https://avatars2.githubusercontent.com/u/7647745?v=4" width="100px;" alt="Salvador Daniel Pelayo"/><br /><sub><b>Salvador Daniel Pelayo</b></sub>](https://github.com/daniel2101)<br />[πŸ’»](https://github.com/cornerstonejs/cornerstoneTools/commits?author=daniel2101 "Code") |
165| [<img src="https://avatars3.githubusercontent.com/u/3358381?v=4" width="100px;" alt="Juan Narvaez"/><br /><sub><b>Juan Narvaez</b></sub>](https://github.com/jdnarvaez)<br />[πŸ’»](https://github.com/cornerstonejs/cornerstoneTools/commits?author=jdnarvaez "Code") | [<img src="https://avatars0.githubusercontent.com/u/814227?v=4" width="100px;" alt="Mike"/><br /><sub><b>Mike</b></sub>](https://github.com/mikehazell)<br />[πŸ“–](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") | [<img src="https://avatars2.githubusercontent.com/u/3329885?v=4" width="100px;" alt="Sangkeun Kim"/><br /><sub><b>Sangkeun Kim</b></sub>](http://sisobus.com)<br />[πŸ’»](https://github.com/cornerstonejs/cornerstoneTools/commits?author=sisobus "Code") [πŸ’¬](#question-sisobus "Answering Questions") | [<img src="https://avatars3.githubusercontent.com/u/378021?v=4" width="100px;" alt="Victor Saase"/><br /><sub><b>Victor Saase</b></sub>](https://github.com/vsaase)<br />[πŸ€”](#ideas-vsaase "Ideas, Planning, & Feedback") | [<img src="https://avatars2.githubusercontent.com/u/120943?v=4" width="100px;" alt="Michael Wasser"/><br /><sub><b>Michael Wasser</b></sub>](http://www.mikewasser.com)<br />[πŸ“–](https://github.com/cornerstonejs/cornerstoneTools/commits?author=untoldone "Documentation") | [<img src="https://avatars2.githubusercontent.com/u/11068601?v=4" width="100px;" alt="Amandeep Singh"/><br /><sub><b>Amandeep Singh</b></sub>](https://github.com/singhArmani)<br />[πŸ–‹](#content-singhArmani "Content") | [<img src="https://avatars0.githubusercontent.com/u/1474137?v=4" width="100px;" alt="Madison Dickson"/><br /><sub><b>Madison Dickson</b></sub>](http://mix3dstudios.com)<br />[πŸ“–](https://github.com/cornerstonejs/cornerstoneTools/commits?author=mix3d "Documentation") |
166| [<img src="https://avatars1.githubusercontent.com/u/3342530?v=4" width="100px;" alt="Kevin Lee Drum"/><br /><sub><b>Kevin Lee Drum</b></sub>](https://github.com/kevinleedrum)<br />[πŸ’»](https://github.com/cornerstonejs/cornerstoneTools/commits?author=kevinleedrum "Code") | [<img src="https://avatars3.githubusercontent.com/u/11224291?v=4" width="100px;" alt="Makarand Bauskar"/><br /><sub><b>Makarand Bauskar</b></sub>](https://github.com/mmbauskar)<br />[πŸ’»](https://github.com/cornerstonejs/cornerstoneTools/commits?author=mbauskar "Code") | [<img src="https://avatars0.githubusercontent.com/u/1713255?v=4" width="100px;" alt="Biharck Araujo"/><br /><sub><b>Biharck Araujo</b></sub>](http://www.biharck.com.br)<br />[πŸ’‘](#example-biharck "Examples") [πŸ“–](https://github.com/cornerstonejs/cornerstoneTools/commits?author=biharck "Documentation") | [<img src="https://avatars3.githubusercontent.com/u/5349517?v=4" width="100px;" alt="Devon Bernard"/><br /><sub><b>Devon Bernard</b></sub>](https://www.linkedin.com/in/devonbernard)<br />[πŸ“–](https://github.com/cornerstonejs/cornerstoneTools/commits?author=DevonBernard "Documentation") | [<img src="https://avatars2.githubusercontent.com/u/38315992?v=4" width="100px;" alt="Karl-Heinrich"/><br /><sub><b>Karl-Heinrich</b></sub>](https://github.com/Karl-Heinrich)<br />[πŸ›](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") | [<img src="https://avatars0.githubusercontent.com/u/15172026?v=4" width="100px;" alt="counterxing"/><br /><sub><b>counterxing</b></sub>](https://blog.xingbofeng.com/)<br />[πŸ›](https://github.com/cornerstonejs/cornerstoneTools/issues?q=author%3Axingbofeng "Bug reports") [πŸ’»](https://github.com/cornerstonejs/cornerstoneTools/commits?author=xingbofeng "Code") | [<img src="https://avatars0.githubusercontent.com/u/50026015?v=4" width="100px;" alt="Jorge Lopes"/><br /><sub><b>Jorge Lopes</b></sub>](https://github.com/jlopes90)<br />[πŸ’¬](#question-jlopes90 "Answering Questions") |
167| [<img src="https://avatars2.githubusercontent.com/u/5546851?v=4" width="100px;" alt="Gabriel Garrido"/><br /><sub><b>Gabriel Garrido</b></sub>](http://garrido.io)<br />[πŸ’»](https://github.com/cornerstonejs/cornerstoneTools/commits?author=Ggpsv "Code") | [<img src="https://avatars0.githubusercontent.com/u/4126256?v=4" width="100px;" alt="ASVBPREAUBV"/><br /><sub><b>ASVBPREAUBV</b></sub>](https://github.com/ASVBPREAUBV)<br />[πŸ“–](https://github.com/cornerstonejs/cornerstoneTools/commits?author=ASVBPREAUBV "Documentation") | [<img src="https://avatars0.githubusercontent.com/u/50960211?v=4" width="100px;" alt="frolic06"/><br /><sub><b>frolic06</b></sub>](https://github.com/frolic06)<br />[πŸ’»](https://github.com/cornerstonejs/cornerstoneTools/commits?author=frolic06 "Code") | [<img src="https://avatars2.githubusercontent.com/u/26968918?v=4" width="100px;" alt="codepage949"/><br /><sub><b>codepage949</b></sub>](https://github.com/codepage949)<br />[πŸ’»](https://github.com/cornerstonejs/cornerstoneTools/commits?author=codepage949 "Code") | [<img src="https://avatars.githubusercontent.com/u/1915?v=4" width="100px;" alt="Asherah Connor"/><br /><sub><b>Asherah Connor</b></sub>](https://kivikakk.ee)<br />[πŸ’»](https://github.com/cornerstonejs/cornerstoneTools/commits?author=kivikakk "Code") | [<img src="https://avatars.githubusercontent.com/u/22633385?v=4" width="100px;" alt="Ikko Ashimine"/><br /><sub><b>Ikko Ashimine</b></sub>](https://bandism.net/)<br />[πŸ›](https://github.com/cornerstonejs/cornerstoneTools/issues?q=author%3Aeltociear "Bug reports") |
168<!-- ALL-CONTRIBUTORS-LIST:END -->
169
170This project follows the [all-contributors][all-contributors] specification.
171Contributions of any kind welcome!
172
173## Issues
174
175_Looking to contribute? Look for the [Good First Issue][good-first-issue]
176label._
177
178### πŸ› Bugs
179
180Please file an issue for bugs, missing documentation, or unexpected behavior.
181
182[**See Bugs**][bugs]
183
184### πŸ’‘ Feature Requests
185
186Please file an issue to suggest new features. Vote on feature requests by adding
187a πŸ‘. This helps maintainers prioritize what to work on.
188
189- [**See Feature Requests**][requests-feature]
190- [**See Internal Change Requests**][requests-implementation]
191
192### ❓ Questions
193
194For questions related to using the library, please visit our support community,
195or file an issue on GitHub.
196
197- [Google Group][google-group]
198
199## LICENSE
200
201MIT
202
203<!--
204Links:
205-->
206
207<!-- prettier-ignore-start -->
208[build-badge]: https://circleci.com/gh/cornerstonejs/cornerstoneTools/tree/master.svg?style=svg
209[build]: https://circleci.com/gh/cornerstonejs/cornerstoneTools/tree/master
210[contributing]: https://github.com/cornerstonejs/cornerstoneTools/blob/master/CONTRIBUTING.md
211[coverage-badge]: https://codecov.io/gh/cornerstonejs/cornerstoneTools/branch/master/graphs/badge.svg
212[coverage]: https://codecov.io/gh/cornerstonejs/cornerstoneTools/branch/master
213[npm-url]: https://npmjs.org/package/cornerstone-tools
214[npm-downloads-image]: http://img.shields.io/npm/dm/cornerstone-tools.svg?style=flat
215[npm-version-image]: http://img.shields.io/npm/v/cornerstone-tools.svg?style=flat
216[license-image]: http://img.shields.io/badge/license-MIT-blue.svg?style=flat
217[license-url]: LICENSE
218[version-2]: https://github.com/cornerstonejs/cornerstoneTools/tree/v2.4.x
219[node]: https://nodejs.org
220[ohif-demo]: https://viewer.ohif.org/demo-signin
221[ohif-source]: https://github.com/OHIF/Viewers
222[emojis]: https://github.com/kentcdodds/all-contributors#emoji-key
223[all-contributors]: https://github.com/kentcdodds/all-contributors
224[bugs]: https://github.com/cornerstonejs/cornerstoneTools/issues?q=is%3Aissue+is%3Aopen+label%3A"πŸ›+Bug%3A+Verified"+sort%3Acreated-desc
225[requests-feature]: https://github.com/cornerstonejs/cornerstoneTools/issues?q=is%3Aissue+sort%3Areactions-%2B1-desc+label%3A"πŸ’»+Change%3A+Feature"+is%3Aopen
226[requests-implementation]: https://github.com/cornerstonejs/cornerstoneTools/issues?q=is%3Aissue+sort%3Areactions-%2B1-desc+label%3A"πŸ’»+Change%3A+Implementation"+is%3Aopen
227[good-first-issue]: https://github.com/cornerstonejs/cornerstoneTools/issues?utf8=βœ“&q=is%3Aissue+is%3Aopen+sort%3Areactions-%2B1-desc+label%3A"πŸ₯‡+Good+First+Issue"
228[google-group]: https://groups.google.com/forum/#!forum/cornerstone-platform
229<!-- prettier-ignore-end -->