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 |
|
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 |
|
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 |
|
37 | 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:
|
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 |
|
45 | This 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 |
|
53 | Below is a simplified example of creating a tool by extending `cornerstone-tool`'s `BaseTool` class.
|
54 |
|
55 | ```javascript
|
56 | import cornerstone from 'cornerstone-core';
|
57 | import { BaseTool } from 'cornerstone-tools';
|
58 | import basicLevelingStrategy from '...';
|
59 |
|
60 | export 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 |
|
92 | This module is distributed via [npm][npm-url] which is bundled with [node][node] and
|
93 | should be installed as one of your project's `dependencies`:
|
94 |
|
95 | ```js
|
96 | // To install the newest version
|
97 | npm install --save cornerstone-tools
|
98 |
|
99 | // To install the legacy version (2.4.x branch)
|
100 | npm install --save cornerstone-tools@2
|
101 | ```
|
102 |
|
103 | This 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 |
|
112 | If 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 |
|
150 | A 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 |
|
158 | Thanks goes to these people ([emoji key][emojis]):
|
159 |
|
160 |
|
161 |
|
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 |
|
169 |
|
170 | This project follows the [all-contributors][all-contributors] specification.
|
171 | Contributions of any kind welcome!
|
172 |
|
173 | ## Issues
|
174 |
|
175 | _Looking to contribute? Look for the [Good First Issue][good-first-issue]
|
176 | label._
|
177 |
|
178 | ### π Bugs
|
179 |
|
180 | Please file an issue for bugs, missing documentation, or unexpected behavior.
|
181 |
|
182 | [**See Bugs**][bugs]
|
183 |
|
184 | ### π‘ Feature Requests
|
185 |
|
186 | Please file an issue to suggest new features. Vote on feature requests by adding
|
187 | a π. 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 |
|
194 | For questions related to using the library, please visit our support community,
|
195 | or file an issue on GitHub.
|
196 |
|
197 | - [Google Group][google-group]
|
198 |
|
199 | ## LICENSE
|
200 |
|
201 | MIT
|
202 |
|
203 |
|
204 | Links:
|
205 | -->
|
206 |
|
207 |
|
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 |
|