Skip to content

Commit a3b35b8

Browse files
authored
docs: Add migration guides for v4.x (#430)
1 parent c5e19ad commit a3b35b8

File tree

1 file changed

+156
-71
lines changed

1 file changed

+156
-71
lines changed

README.md

+156-71
Original file line numberDiff line numberDiff line change
@@ -1,102 +1,183 @@
1-
[![NPM version][npm-version-image]][npm-url] [![NPM downloads][npm-downloads-image]][npm-url] [![MIT License][license-image]][license-url] [![Build Status][travis-image]][travis-url]
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]
25
[![Coverage Status][coverage-image]][coverage-url]
36

4-
cornerstone WADO Image Loader
5-
=============================
6-
7-
A [cornerstone](https://github.com/cornerstonejs/cornerstone) Image Loader for DICOM P10 instances over
8-
HTTP (WADO-URI) or DICOMWeb (WADO-RS). This can be used to integrate cornerstone with WADO-URI
9-
servers, DICOMWeb servers or any other HTTP based server that returns DICOM P10 instances
10-
(e.g. [Orthanc](http://www.orthanc-server.com/) or custom servers)
11-
12-
Troubleshooting
13-
---------------
14-
15-
Having problems viewing your images with cornerstonWADOImageLoader? Check out the
16-
[troubleshooting guide](https://github.com/cornerstonejs/cornerstoneWADOImageLoader/wiki/troubleshooting).
17-
18-
Live Examples
19-
---------------
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
2034

2135
[Click here for a live example of this library in use!](http://rawgithub.com/cornerstonejs/cornerstoneWADOImageLoader/master/examples/index.html)
2236

2337
You can also see it in action with the
2438
[cornerstoneDemo application](https://github.com/chafey/cornerstoneDemo).
2539

26-
Install
27-
-------
40+
## Install
2841

2942
Get the distributed unminimized file:
3043

31-
* [cornerstoneWADOImageLoader.js](https://unpkg.com/cornerstone-wado-image-loader/dist/cornerstoneWADOImageLoader.js)
44+
- [cornerstoneWADOImageLoader.js](https://unpkg.com/cornerstone-wado-image-loader/dist/cornerstoneWADOImageLoader.js)
3245

3346
or the distributed minimized file:
3447

35-
* [cornerstoneWADOImageLoader.min.js](https://unpkg.com/cornerstone-wado-image-loader/dist/cornerstoneWADOImageLoader.min.js)
48+
- [cornerstoneWADOImageLoader.min.js](https://unpkg.com/cornerstone-wado-image-loader/dist/cornerstoneWADOImageLoader.min.js)
3649

37-
Usage
38-
-------
50+
## Usage
3951

40-
The cornerstoneWADOImageLoader depends on the following external libraries which should be loaded before cornerstoneWADOImageLoader.js:
52+
The cornerstoneWADOImageLoader depends on the following external libraries which
53+
should be loaded before cornerstoneWADOImageLoader.js:
4154

42-
43-
1. [dicomParser](https://github.com/cornerstonejs/dicomParser)
55+
1. [dicomParser](https://github.com/cornerstonejs/dicomParser)
4456
2. [cornerstone](https://github.com/cornerstonejs/cornerstone)
4557

46-
*New in 1.0.0*: Specify the cornerstone instance you want to register the loader with.
58+
_New in 1.0.0_: Specify the cornerstone instance you want to register the loader
59+
with.
4760

48-
````javascript
61+
```javascript
4962
cornerstoneWADOImageLoader.external.cornerstone = cornerstone;
50-
````
63+
```
5164

5265
Have your code configure the web worker framework:
5366

5467
```javascript
55-
var config = {
56-
maxWebWorkers: navigator.hardwareConcurrency || 1,
57-
startWebWorkersOnDemand : true,
58-
};
59-
cornerstoneWADOImageLoader.webWorkerManager.initialize(config);
68+
var config = {
69+
maxWebWorkers: navigator.hardwareConcurrency || 1,
70+
startWebWorkersOnDemand: true,
71+
};
72+
cornerstoneWADOImageLoader.webWorkerManager.initialize(config);
6073
```
6174

62-
See the [web workers](docs/WebWorkers.md) documentation for more details on configuring.
63-
64-
Key Features
65-
------------
66-
67-
* Implements a [cornerstone ImageLoader](https://github.com/cornerstonejs/cornerstone/wiki/ImageLoader) for DICOM P10 Instances via a HTTP get request.
68-
* Can be used with a WADO-URI server
69-
* Can be used with Orthanc's file endpoint
70-
* Can be used with any server that returns DICOM P10 instances via HTTP GET
71-
* Implements a [cornerstone ImageLoader](https://github.com/cornerstonejs/cornerstone/wiki/ImageLoader) for WADO-RS (DICOMWeb)
72-
* Supports many popular transfer syntaxes and photometric interpretations [see full list](https://github.com/cornerstonejs/cornerstoneWADOImageLoader/blob/master/docs/TransferSyntaxes.md) and [codec](docs/Codecs.md) for more information.
73-
* Framework to execute CPU intensive tasks in [web workers](docs/WebWorkers.md)
74-
* Used for image decoding
75-
* Can be used for your own CPU intensive tasks (e.g. image processing)
76-
77-
Backlog
78-
-------
79-
80-
* Support for images with pixel padding
81-
* Support for high bit (e.g. mask out burned in overlays)
82-
* Free up DICOM P10 instance after decoding to reduce memory consumption
83-
* Add support for compressed images to WADO-RS loader
84-
* Look at using EMSCRIPTEN based build of IJG for JPEG
85-
* Consolidate all EMSCRIPTEN codecs into one build to cut down on memory use and startup times
86-
* Add support for bulk data items to WADO-RS Loader
87-
* Add events to webWorkerManager so its activity can be monitored
88-
* Add support for issuing progress events from web worker tasks
89-
90-
FAQ
91-
===
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
92172

93173
_Why is this a separate library from cornerstone?_
94174

95-
Mainly to avoid adding a dependency to cornerstone for the DICOM parsing library. While cornerstone is
96-
intended to be used to display medical images that are stored in DICOM, cornerstone aims to simplify
97-
the use of medical imaging and therefore tries to hide some of the complexity that exists within
98-
DICOM. It is also desirable to support display of non DICOM images so a DICOM independent image model
99-
makes sense.
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.
100181

101182
_How do I build this library myself?_
102183

@@ -110,8 +191,8 @@ _How do I create imageIds that work with this image loader?_
110191

111192
See the documentation [here](docs/ImageIds.md)
112193

113-
Copyright
114-
============
194+
# Copyright
195+
115196
Copyright 2016 Chris Hafey [[email protected]](mailto:[email protected])
116197

117198
<!--
@@ -134,3 +215,7 @@ Copyright 2016 Chris Hafey [[email protected]](mailto:[email protected])
134215
[coverage-image]: https://coveralls.io/repos/github/cornerstonejs/cornerstoneWADOImageLoader/badge.svg?branch=master
135216

136217
<!-- prettier-ignore-end -->
218+
219+
```
220+
221+
```

0 commit comments

Comments
 (0)