@cornerstonejs/dicom-image-loader 0.1.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,6 @@
1
+ # Browsers that we support
2
+
3
+ > 1%
4
+ IE 11
5
+ not dead
6
+ not op_mini all
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2014 Chris Hafey (chafey@gmail.com)
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,225 @@
1
+ [![NPM version][npm-version-image]][npm-url]
2
+ [![NPM downloads][npm-downloads-image]][npm-url]
3
+ [![MIT License][license-image]][license-url]
4
+ [![Build Status][travis-image]][travis-url]
5
+ [![Coverage Status][coverage-image]][coverage-url]
6
+
7
+ # cornerstone WADO Image Loader
8
+
9
+ A [cornerstone](https://github.com/cornerstonejs/cornerstone) Image Loader for
10
+ DICOM P10 instances over HTTP (WADO-URI) or DICOMWeb (WADO-RS). This can be used
11
+ to integrate cornerstone with WADO-URI servers, DICOMWeb servers or any other
12
+ HTTP based server that returns DICOM P10 instances (e.g.
13
+ [Orthanc](http://www.orthanc-server.com/) or custom servers)
14
+
15
+ ## Key Features
16
+
17
+ - Implements a
18
+ [cornerstone ImageLoader](https://github.com/cornerstonejs/cornerstone/wiki/ImageLoader)
19
+ for DICOM P10 Instances via a HTTP get request.
20
+ - Can be used with a WADO-URI server
21
+ - Can be used with Orthanc's file endpoint
22
+ - Can be used with any server that returns DICOM P10 instances via HTTP GET
23
+ - Implements a
24
+ [cornerstone ImageLoader](https://github.com/cornerstonejs/cornerstone/wiki/ImageLoader)
25
+ for WADO-RS (DICOMWeb)
26
+ - Supports many popular transfer syntaxes and photometric interpretations
27
+ [see full list](https://github.com/cornerstonejs/cornerstoneWADOImageLoader/blob/master/docs/TransferSyntaxes.md)
28
+ and [codec](docs/Codecs.md) for more information.
29
+ - Framework to execute CPU intensive tasks in [web workers](docs/WebWorkers.md)
30
+ - Used for image decoding
31
+ - Can be used for your own CPU intensive tasks (e.g. image processing)
32
+
33
+ ## Live Examples
34
+
35
+ [Click here for a live example of this library in use!](http://rawgithub.com/cornerstonejs/cornerstoneWADOImageLoader/master/examples/index.html)
36
+
37
+ You can also see it in action with the
38
+ [cornerstoneDemo application](https://github.com/chafey/cornerstoneDemo).
39
+
40
+ ## Install
41
+
42
+ Get the distributed unminimized file:
43
+
44
+ - [cornerstoneWADOImageLoader.js](https://unpkg.com/cornerstone-wado-image-loader)
45
+
46
+ or the distributed minimized file:
47
+
48
+ - [cornerstoneWADOImageLoader.bundle.min.js](https://unpkg.com/cornerstone-wado-image-loader)
49
+
50
+ ## Usage
51
+
52
+ The cornerstoneWADOImageLoader depends on the following external libraries which
53
+ should be loaded before cornerstoneWADOImageLoader.js:
54
+
55
+ 1. [dicomParser](https://github.com/cornerstonejs/dicomParser)
56
+ 2. [cornerstone](https://github.com/cornerstonejs/cornerstone)
57
+
58
+ _New in 1.0.0_: Specify the cornerstone instance you want to register the loader
59
+ with.
60
+
61
+ ```javascript
62
+ cornerstoneWADOImageLoader.external.cornerstone = cornerstone;
63
+ ```
64
+
65
+ Have your code configure the web worker framework:
66
+
67
+ ```javascript
68
+ var config = {
69
+ maxWebWorkers: navigator.hardwareConcurrency || 1,
70
+ startWebWorkersOnDemand: true,
71
+ };
72
+ cornerstoneWADOImageLoader.webWorkerManager.initialize(config);
73
+ ```
74
+
75
+ See the [web workers](docs/WebWorkers.md) documentation for more details on
76
+ configuring.
77
+
78
+ ## Upgrade to CWIL v4.x
79
+
80
+ Cornerstone-WADO-Image-Loader (CWIL) v4.0.x has been released, which adds
81
+ support for using WebAssembly (WASM) builds of each codec. This significantly
82
+ improves image decoding performance and enables us to load codec at runtime when
83
+ needed dynamically, which reduces the build time and complexity.
84
+
85
+ In addition, we have improved the image loading performance in CWIL v4.x. In
86
+ previous versions of CWIL, image loading includes fetching AND decoding an image
87
+ before returning a promise completion, preventing more requests from being made
88
+ until the queue is empty. This limitation has been fixed in CWIL v4, which
89
+ separates image retrieval and decoding into two steps. Now after an image is
90
+ retrieved, a new request is sent to the server immediately.
91
+
92
+ | | Improvement |
93
+ | ------------------- | -------------------------------------------------- |
94
+ | CWIL Bundle Size | 30x smaller (3.0 MB vs 87 kb with dynamic import) |
95
+ | JPEG Baseline Codec | 4.5x faster (2.87 ms for 512x512 16 bit CT Slice) |
96
+ | JPEG 2000 Codec | 1.8x faster (41.02 ms for 512x512 16 bit CT Slice) |
97
+
98
+ ### Steps to upgrade
99
+
100
+ #### Dynamic Import
101
+
102
+ In v4.x, we have added dynamic importing support for the codecs as needed. To be
103
+ able to use such feature, instead of
104
+
105
+ ```js
106
+ import cornerstoneWADOImageLoader from 'cornerstone-wado-image-loader';
107
+ ```
108
+
109
+ you need to do:
110
+
111
+ ```js
112
+ import cornerstoneWADOImageLoader from 'cornerstone-wado-image-loader/dist/dynamic-import/cornerstoneWADOImageLoader.min.js';
113
+ ```
114
+
115
+ This way, codecs are loaded dynamically when needed. You have another option to
116
+ create an alias in the webpack config file as we do
117
+ [here](https://github.com/OHIF/Viewers/blob/33307d3cd28599cbb4d7189560afdd7f65033ab8/platform/viewer/.webpack/webpack.pwa.js#L65)
118
+ for OHIF Viewer.
119
+
120
+ ```js
121
+ resolve: {
122
+ alias: {
123
+ 'cornerstone-wado-image-loader':
124
+ 'cornerstone-wado-image-loader/dist/dynamic-import/cornerstoneWADOImageLoader.min.js',
125
+ },
126
+ },
127
+ ```
128
+
129
+ In addition WASM builds of the codec files should be made available in the build
130
+ folder. We use `CopyWebpackPlugin` to copy the WASM files to the build folder.
131
+ See
132
+ [here](https://github.com/OHIF/Viewers/blob/33307d3cd28599cbb4d7189560afdd7f65033ab8/platform/viewer/.webpack/webpack.pwa.js#L100)
133
+ for how we do it in OHIF Viewer.
134
+
135
+ ```js
136
+ plugins: [
137
+ new CopyWebpackPlugin([
138
+ {
139
+ from:
140
+ '../../../node_modules/cornerstone-wado-image-loader/dist/dynamic-import',
141
+ to: DIST_DIR,
142
+ },
143
+ ]),
144
+ ```
145
+
146
+ Note 1: You need to give the correct path in the `CopyWebpackPlugin`, the above
147
+ path is relative to the `node_modules` folder in the OHIF Viewer.
148
+
149
+ Note 2: For other http servers like IIS, you need to configure it to serve WASM
150
+ files with the correct MIME type.
151
+
152
+ ## Troubleshooting
153
+
154
+ Having problems viewing your images with cornerstonWADOImageLoader? Check out
155
+ the
156
+ [troubleshooting guide](https://github.com/cornerstonejs/cornerstoneWADOImageLoader/wiki/troubleshooting).
157
+
158
+ ## Backlog
159
+
160
+ - Support for images with pixel padding
161
+ - Support for high bit (e.g. mask out burned in overlays)
162
+ - Free up DICOM P10 instance after decoding to reduce memory consumption
163
+ - Add support for compressed images to WADO-RS loader
164
+ - Look at using EMSCRIPTEN based build of IJG for JPEG
165
+ - Consolidate all EMSCRIPTEN codecs into one build to cut down on memory use and
166
+ startup times
167
+ - Add support for bulk data items to WADO-RS Loader
168
+ - Add events to webWorkerManager so its activity can be monitored
169
+ - Add support for issuing progress events from web worker tasks
170
+
171
+ # FAQ
172
+
173
+ _Why is this a separate library from cornerstone?_
174
+
175
+ Mainly to avoid adding a dependency to cornerstone for the DICOM parsing
176
+ library. While cornerstone is intended to be used to display medical images that
177
+ are stored in DICOM, cornerstone aims to simplify the use of medical imaging and
178
+ therefore tries to hide some of the complexity that exists within DICOM. It is
179
+ also desirable to support display of non DICOM images so a DICOM independent
180
+ image model makes sense.
181
+
182
+ _How do I build this library myself?_
183
+
184
+ See the documentation [here](docs/Building.md)
185
+
186
+ _How do I add my own custom web worker tasks?_
187
+
188
+ See the documentation [here](docs/WebWorkers.md)
189
+
190
+ _How do I create imageIds that work with this image loader?_
191
+
192
+ See the documentation [here](docs/ImageIds.md)
193
+
194
+ # What Transfer Syntaxes are supported?
195
+
196
+ See [transfer syntaxes](docs/TransferSyntaxes.md)
197
+
198
+ # Copyright
199
+
200
+ Copyright 2016 Chris Hafey [chafey@gmail.com](mailto:chafey@gmail.com)
201
+
202
+ <!--
203
+ LINKS
204
+ -->
205
+
206
+ <!-- prettier-ignore-start -->
207
+
208
+ [license-image]: http://img.shields.io/badge/license-MIT-blue.svg?style=flat
209
+ [license-url]: LICENSE
210
+
211
+ [npm-url]: https://npmjs.org/package/cornerstone-wado-image-loader
212
+ [npm-version-image]: http://img.shields.io/npm/v/cornerstone-wado-image-loader.svg?style=flat
213
+ [npm-downloads-image]: http://img.shields.io/npm/dm/cornerstone-wado-image-loader.svg?style=flat
214
+
215
+ [travis-url]: http://travis-ci.org/cornerstonejs/cornerstoneWADOImageLoader
216
+ [travis-image]: https://travis-ci.org/cornerstonejs/cornerstoneWADOImageLoader.svg?branch=master
217
+
218
+ [coverage-url]: https://coveralls.io/github/cornerstonejs/cornerstoneWADOImageLoader?branch=master
219
+ [coverage-image]: https://coveralls.io/repos/github/cornerstonejs/cornerstoneWADOImageLoader/badge.svg?branch=master
220
+
221
+ <!-- prettier-ignore-end -->
222
+
223
+ ```
224
+
225
+ ```
@@ -0,0 +1,11 @@
1
+ {
2
+ "presets": ["@babel/preset-env"],
3
+ "plugins": [
4
+ ["@babel/plugin-proposal-object-rest-spread"],
5
+ ["@babel/plugin-transform-runtime",
6
+ {
7
+ "regenerator": true,
8
+ "corejs": 3
9
+ }]
10
+ ]
11
+ }
package/package.json ADDED
@@ -0,0 +1,101 @@
1
+ {
2
+ "name": "@cornerstonejs/dicom-image-loader",
3
+ "version": "0.1.4",
4
+ "description": "Cornerstone Image Loader for DICOM WADO-URI and WADO-RS and Local file",
5
+ "keywords": [
6
+ "DICOM",
7
+ "WADO",
8
+ "cornerstone",
9
+ "medical",
10
+ "imaging"
11
+ ],
12
+ "author": "@cornerstonejs (previously Chris Hafey)",
13
+ "homepage": "https://github.com/cornerstonejs/cornerstone3D-beta",
14
+ "license": "MIT",
15
+ "main": "./dist/cornerstoneDICOMImageLoader.bundle.min.js",
16
+ "repository": {
17
+ "type": "git",
18
+ "url": "https://github.com/cornerstonejs/cornerstone3D-beta.git"
19
+ },
20
+ "publishConfig": {
21
+ "access": "public"
22
+ },
23
+ "scripts": {
24
+ "build": "echo 'build not implemented yet'",
25
+ "cm": "npx git-cz",
26
+ "clean": "npm run clean:dist && npm run clean:coverage",
27
+ "clean:dist": "shx rm -rf dist",
28
+ "clean:docs": "shx rm -rf documentation",
29
+ "clean:coverage": "shx rm -rf coverage",
30
+ "doc": "npm run doc:generate && opn documentation/index.html",
31
+ "doc:generate": "npm run clean:docs && jsdoc -c .jsdocrc",
32
+ "eslint": "eslint -c .eslintrc.js src",
33
+ "eslint-quiet": "eslint -c .eslintrc.js --quiet src",
34
+ "eslint-fix": "eslint -c .eslintrc.js --fix src",
35
+ "eslint-fix-test": "eslint -c .eslintrc.js --fix test",
36
+ "start": "npm run webpack:dev",
37
+ "start:dev": "webpack-dev-server --config ./config/webpack/webpack-dev",
38
+ "test": "npm run test:chrome",
39
+ "test:ci": "echo 'test:ci not implemented yet'",
40
+ "test:all": "npm run test && npm run test:chrome && npm run test:firefox",
41
+ "test:chrome": "karma start config/karma/karma-base.js",
42
+ "test:firefox": "karma start config/karma/karma-firefox.js",
43
+ "test:watch": "karma start config/karma/karma-watch.js",
44
+ "watch": "npm run clean && shx mkdir dist && npm run webpack:watch",
45
+ "dev": "npm run webpack:dev",
46
+ "webpack:dev": "webpack serve --progress --config ./config/webpack/webpack-dev.js",
47
+ "webpack:dynamic-import": "webpack --progress --config ./config/webpack/webpack-dynamic-import",
48
+ "webpack:bundle": "webpack --progress --config ./config/webpack/webpack-bundle",
49
+ "webpack:dynamic-import:watch": "webpack --progress --watch --config ./config/webpack/webpack-dynamic-import",
50
+ "webpack:watch": "webpack --progress --watch --config ./config/webpack",
51
+ "prepublishOnly": "echo 'prepublishOnly not implemented yet'"
52
+ },
53
+ "devDependencies": {
54
+ "@babel/plugin-proposal-object-rest-spread": "^7.14.7",
55
+ "@babel/runtime-corejs3": "^7.15.4",
56
+ "chai": "^4.3.4",
57
+ "concat": "^1.0.3",
58
+ "core-js": "^3.26.1",
59
+ "coveralls": "^3.1.1",
60
+ "docdash": "^1.2.0",
61
+ "exports-loader": "^3.0.0",
62
+ "fs-extra": "^10.0.0",
63
+ "jsdoc": "^3.6.7",
64
+ "karma-mocha": "^2.0.1",
65
+ "lodash": "^4.17.21",
66
+ "mocha": "^9.1.1",
67
+ "open-cli": "^7.0.1",
68
+ "puppeteer": "^10.2.0",
69
+ "shx": "^0.3.3"
70
+ },
71
+ "dependencies": {
72
+ "@babel/eslint-parser": "^7.19.1",
73
+ "@cornerstonejs/codec-charls": "^0.1.1",
74
+ "@cornerstonejs/codec-libjpeg-turbo-8bit": "^0.0.7",
75
+ "@cornerstonejs/codec-openjpeg": "^0.1.0",
76
+ "@cornerstonejs/codec-openjph": "^1.0.3",
77
+ "coverage-istanbul-loader": "^3.0.5",
78
+ "date-format": "^4.0.14",
79
+ "dicom-parser": "^1.8.9",
80
+ "pako": "^2.0.4",
81
+ "uuid": "^9.0.0"
82
+ },
83
+ "husky": {
84
+ "hooks": {
85
+ "pre-commit": "lint-staged"
86
+ }
87
+ },
88
+ "lint-staged": {
89
+ "src/**/*.{js,jsx,json,css}": [
90
+ "eslint --fix",
91
+ "prettier --write",
92
+ "git add"
93
+ ]
94
+ },
95
+ "config": {
96
+ "commitizen": {
97
+ "path": "./node_modules/cz-conventional-changelog"
98
+ }
99
+ },
100
+ "gitHead": "b5bdf41c08ee5913263c2dac774de4629cf197ce"
101
+ }