Mercurial > hg > orthanc-book
annotate Sphinx/source/plugins/wsi.rst @ 1113:a588960a72e5 default tip
spelling
author | Alain Mazy <am@orthanc.team> |
---|---|
date | Mon, 28 Oct 2024 09:23:08 +0100 |
parents | ebe3214f3ab0 |
children |
rev | line source |
---|---|
52 | 1 .. _wsi: |
2 | |
3 | |
85 | 4 Whole-slide microscopic imaging |
81 | 5 =============================== |
52 | 6 |
7 .. contents:: | |
8 | |
81 | 9 The Orthanc project provides three **official tools** to support DICOM |
10 for whole-slide microscopic imaging (WSI): | |
11 | |
12 1. A so-called "DICOM-izer" command-line tool that converts | |
13 whole-slide images to DICOM series, following `Supplement 145 | |
14 <ftp://medical.nema.org/medical/dicom/final/sup145_ft.pdf>`__. | |
15 2. A plugin that extends Orthanc with a Web viewer of whole-slide | |
16 images for digital pathology. | |
17 3. Another command-line tool that converts a DICOM series stored | |
82 | 18 inside Orthanc, to a standard hierarchical TIFF image. |
52 | 19 |
1055
ebe3214f3ab0
added citation instructions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
993
diff
changeset
|
20 Check out our `demonstration server |
ebe3214f3ab0
added citation instructions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
993
diff
changeset
|
21 <https://orthanc.uclouvain.be/wsi/>`__. |
ebe3214f3ab0
added citation instructions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
993
diff
changeset
|
22 |
ebe3214f3ab0
added citation instructions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
993
diff
changeset
|
23 **For researchers**: `Please cite this paper |
ebe3214f3ab0
added citation instructions
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
993
diff
changeset
|
24 <https://doi.org/10.5220/0006155100810087>`__. |
81 | 25 |
26 | |
27 Compilation | |
28 ----------- | |
29 | |
129 | 30 Static linking |
31 ^^^^^^^^^^^^^^ | |
32 | |
85 | 33 .. highlight:: text |
81 | 34 |
35 The procedure to compile the WSI framework is similar of that for the | |
36 :ref:`core of Orthanc <binaries>`. The following commands should work | |
761 | 37 for most UNIX-like distribution (including GNU/Linux):: |
81 | 38 |
39 # Firstly, compile the command-line tools | |
40 $ mkdir Applications/Build | |
41 $ cd Applications/Build | |
42 $ cmake .. -DSTATIC_BUILD=ON -DCMAKE_BUILD_TYPE=Release | |
43 $ make | |
129 | 44 |
85 | 45 # Secondly, compile the viewer plugin |
81 | 46 $ mkdir ../../ViewerPlugin/Build |
47 $ cd ../../ViewerPlugin/Build | |
48 $ cmake .. -DSTATIC_BUILD=ON -DCMAKE_BUILD_TYPE=Release | |
49 $ make | |
50 | |
51 The compilation will produce 3 binaries: | |
52 | |
53 * ``Applications/Build/OrthancWSIDicomizer``, which contains the DICOM-izer. | |
54 * ``Applications/Build/OrthancWSIDicomToTiff``, which contains the DICOM-to-TIFF converter. | |
82 | 55 * ``ViewerPlugin/Build/OrthancWSI``, which is a shared library containing the viewer plugin for Orthanc. |
81 | 56 |
129 | 57 Microsoft Windows |
58 ^^^^^^^^^^^^^^^^^ | |
59 | |
81 | 60 Note that pre-compiled binaries for Microsoft Windows `are available |
993
05b106383b2a
migration to UCLouvain servers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
979
diff
changeset
|
61 <https://orthanc.uclouvain.be/downloads/windows-32/orthanc-wsi/index.html>`__. |
81 | 62 |
63 | |
129 | 64 Dynamic linking |
65 ^^^^^^^^^^^^^^^ | |
66 | |
67 .. highlight:: text | |
68 | |
69 If static linking is not desired, here are build instructions for | |
70 Ubuntu 16.04 (provided build dependencies for the :ref:`core of | |
71 Orthanc <compiling>` have already been installed):: | |
72 | |
73 $ sudo apt-get install libopenjpeg-dev | |
74 | |
75 # Firstly, compile the command-line tools | |
76 $ mkdir Applications/Build | |
77 $ cd Applications/Build | |
78 $ cmake .. -DCMAKE_BUILD_TYPE=Release -DUSE_SYSTEM_ORTHANC_SDK=OFF | |
79 $ make | |
80 | |
81 # Secondly, compile the viewer plugin | |
82 $ mkdir ../../ViewerPlugin/Build | |
83 $ cd ../../ViewerPlugin/Build | |
84 $ cmake .. -DCMAKE_BUILD_TYPE=Release -DUSE_SYSTEM_ORTHANC_SDK=OFF -DALLOW_DOWNLOADS=ON | |
85 $ make | |
86 | |
87 | |
88 | |
85 | 89 Usage of the plugin |
90 ------------------- | |
81 | 91 |
797 | 92 .. highlight:: text |
81 | 93 |
94 You of course first have to :ref:`install Orthanc <compiling>`. Once | |
95 Orthanc is installed, you must change the :ref:`configuration file | |
96 <configuration>` to tell Orthanc where it can find the plugin: This is | |
85 | 97 done by properly modifying the ``Plugins`` configuration option. You |
98 could for instance use the following configuration file under | |
99 GNU/Linux:: | |
81 | 100 |
101 { | |
102 "Name" : "MyOrthanc", | |
103 [...] | |
104 "Plugins" : [ | |
105 "/home/user/orthanc-wsi/ViewerPlugin/Build/libOrthancWSI.so" | |
106 ] | |
107 } | |
108 | |
109 Orthanc must of course be restarted after the modification of its | |
110 configuration file. The WSI plugin has no specific configuration | |
111 option. | |
112 | |
85 | 113 Once a :ref:`DICOM series <model-world>` is opened using :ref:`Orthanc |
114 Explorer <orthanc-explorer>`, a yellow button entitled ``Whole-Slide | |
115 Imaging Viewer`` will show up for series corresponding to whole-slide | |
116 images. This button will open the WSI viewer for that particular | |
117 series. This behavior can be seen on the Orthanc Explorer interface | |
118 running on our `WSI demonstration server | |
993
05b106383b2a
migration to UCLouvain servers
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
979
diff
changeset
|
119 <https://orthanc.uclouvain.be/wsi-orthanc/app/explorer.html>`__. |
81 | 120 |
121 | |
967
2df3597eacc8
documentation of IIIF support
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
966
diff
changeset
|
122 Support of IIIF |
2df3597eacc8
documentation of IIIF support
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
966
diff
changeset
|
123 --------------- |
2df3597eacc8
documentation of IIIF support
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
966
diff
changeset
|
124 |
2df3597eacc8
documentation of IIIF support
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
966
diff
changeset
|
125 Starting with its release 2.0, the WSI plugin can act as a data source |
2df3597eacc8
documentation of IIIF support
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
966
diff
changeset
|
126 that follows the `IIIF specification |
2df3597eacc8
documentation of IIIF support
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
966
diff
changeset
|
127 <https://en.wikipedia.org/wiki/International_Image_Interoperability_Framework>`__. This |
2df3597eacc8
documentation of IIIF support
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
966
diff
changeset
|
128 turns Orthanc into a tool to deliver collection of high-resolutions |
2df3597eacc8
documentation of IIIF support
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
966
diff
changeset
|
129 images over the web through IIIF, while simultaneously enabling a |
2df3597eacc8
documentation of IIIF support
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
966
diff
changeset
|
130 standard, long-term preservation of those collections through `DICOM |
2df3597eacc8
documentation of IIIF support
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
966
diff
changeset
|
131 vendor-neutral archiving <https://en.wikipedia.org/wiki/DICOM>`__. |
2df3597eacc8
documentation of IIIF support
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
966
diff
changeset
|
132 |
2df3597eacc8
documentation of IIIF support
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
966
diff
changeset
|
133 REST API |
2df3597eacc8
documentation of IIIF support
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
966
diff
changeset
|
134 ^^^^^^^^ |
2df3597eacc8
documentation of IIIF support
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
966
diff
changeset
|
135 |
2df3597eacc8
documentation of IIIF support
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
966
diff
changeset
|
136 The WSI plugin associates each of the **DICOM series** stored by |
2df3597eacc8
documentation of IIIF support
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
966
diff
changeset
|
137 Orthanc whose :ref:`Orthanc identifier <orthanc-ids>` is ``seriesId``, |
2df3597eacc8
documentation of IIIF support
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
966
diff
changeset
|
138 with a IIIF-compliant `Presentation API 3.0 |
2df3597eacc8
documentation of IIIF support
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
966
diff
changeset
|
139 <https://iiif.io/api/presentation/3.0/>`__ manifest located at URI |
2df3597eacc8
documentation of IIIF support
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
966
diff
changeset
|
140 ``/wsi/iiif/series/{seriesId}/manifest.json`` in the Web server of |
2df3597eacc8
documentation of IIIF support
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
966
diff
changeset
|
141 Orthanc. In turn, this manifest points to a IIIF-compliant `Image API |
2df3597eacc8
documentation of IIIF support
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
966
diff
changeset
|
142 3.0 <https://iiif.io/api/image/3.0/>`__ data source to deliver the |
2df3597eacc8
documentation of IIIF support
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
966
diff
changeset
|
143 DICOM series over the web. |
2df3597eacc8
documentation of IIIF support
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
966
diff
changeset
|
144 |
2df3597eacc8
documentation of IIIF support
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
966
diff
changeset
|
145 Note that this data source is not only available for the whole-slide |
2df3597eacc8
documentation of IIIF support
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
966
diff
changeset
|
146 microscopic series, but also for the other types of medical images, |
2df3597eacc8
documentation of IIIF support
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
966
diff
changeset
|
147 which enables both telepathology and teleradiology workflows: |
2df3597eacc8
documentation of IIIF support
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
966
diff
changeset
|
148 |
2df3597eacc8
documentation of IIIF support
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
966
diff
changeset
|
149 * In the case of a whole-slide image, the URI to the IIIF data source |
2df3597eacc8
documentation of IIIF support
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
966
diff
changeset
|
150 is: ``/wsi/iiif/tiles/{seriesId}/info.json``. |
2df3597eacc8
documentation of IIIF support
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
966
diff
changeset
|
151 |
2df3597eacc8
documentation of IIIF support
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
966
diff
changeset
|
152 * In the case of a regular radiology series, one IIIF data source is |
2df3597eacc8
documentation of IIIF support
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
966
diff
changeset
|
153 associated with each frame of the DICOM series. Indeed, the |
2df3597eacc8
documentation of IIIF support
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
966
diff
changeset
|
154 :ref:`DICOM model of the real-world <model-world>` specifies that a |
2df3597eacc8
documentation of IIIF support
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
966
diff
changeset
|
155 single DICOM series can contain multiple instances, which in turn |
2df3597eacc8
documentation of IIIF support
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
966
diff
changeset
|
156 can contain multiple frames. The URI to the IIIF data source |
2df3597eacc8
documentation of IIIF support
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
966
diff
changeset
|
157 corresponding to one individual frame of interest is: |
2df3597eacc8
documentation of IIIF support
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
966
diff
changeset
|
158 ``/wsi/iiif/frames/{seriesId}/{frameIndex}/info.json``, where |
2df3597eacc8
documentation of IIIF support
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
966
diff
changeset
|
159 ``frameIndex`` is the index of the frame in the DICOM series. The |
2df3597eacc8
documentation of IIIF support
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
966
diff
changeset
|
160 ``manifest.json`` of the parent DICOM series automatically |
2df3597eacc8
documentation of IIIF support
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
966
diff
changeset
|
161 aggregates all the frames of the series as a single collection. |
2df3597eacc8
documentation of IIIF support
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
966
diff
changeset
|
162 |
2df3597eacc8
documentation of IIIF support
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
966
diff
changeset
|
163 |
2df3597eacc8
documentation of IIIF support
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
966
diff
changeset
|
164 Web user interface |
2df3597eacc8
documentation of IIIF support
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
966
diff
changeset
|
165 ^^^^^^^^^^^^^^^^^^ |
2df3597eacc8
documentation of IIIF support
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
966
diff
changeset
|
166 |
2df3597eacc8
documentation of IIIF support
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
966
diff
changeset
|
167 :ref:`Orthanc Explorer <orthanc-explorer>` contains a button to easily |
2df3597eacc8
documentation of IIIF support
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
966
diff
changeset
|
168 copy/paste the URL of the IIIF manifest corresponding to a DICOM |
2df3597eacc8
documentation of IIIF support
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
966
diff
changeset
|
169 series: |
2df3597eacc8
documentation of IIIF support
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
966
diff
changeset
|
170 |
2df3597eacc8
documentation of IIIF support
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
966
diff
changeset
|
171 .. image:: ../images/2023-07-13-IIIF.png |
2df3597eacc8
documentation of IIIF support
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
966
diff
changeset
|
172 :align: center |
2df3597eacc8
documentation of IIIF support
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
966
diff
changeset
|
173 :width: 500px |
2df3597eacc8
documentation of IIIF support
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
966
diff
changeset
|
174 |
2df3597eacc8
documentation of IIIF support
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
966
diff
changeset
|
175 | |
2df3597eacc8
documentation of IIIF support
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
966
diff
changeset
|
176 |
2df3597eacc8
documentation of IIIF support
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
966
diff
changeset
|
177 Furthermore, as can be seen in the image above, buttons can be enabled |
2df3597eacc8
documentation of IIIF support
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
966
diff
changeset
|
178 to test the opening of the IIIF data source using `Mirador |
2df3597eacc8
documentation of IIIF support
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
966
diff
changeset
|
179 <https://projectmirador.org/>`__ and/or `OpenSeadragon |
2df3597eacc8
documentation of IIIF support
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
966
diff
changeset
|
180 <https://openseadragon.github.io/>`__. |
2df3597eacc8
documentation of IIIF support
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
966
diff
changeset
|
181 |
2df3597eacc8
documentation of IIIF support
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
966
diff
changeset
|
182 Pay attention to the fact that the assets of Mirador and OpenSeadragon |
2df3597eacc8
documentation of IIIF support
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
966
diff
changeset
|
183 (notably JavaScript) are loaded from the `unpkg CDN |
2df3597eacc8
documentation of IIIF support
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
966
diff
changeset
|
184 <https://www.unpkg.com/>`__, which necessitates an Internet |
2df3597eacc8
documentation of IIIF support
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
966
diff
changeset
|
185 connection. For this reason, these assets are disabled by default. |
2df3597eacc8
documentation of IIIF support
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
966
diff
changeset
|
186 |
2df3597eacc8
documentation of IIIF support
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
966
diff
changeset
|
187 |
2df3597eacc8
documentation of IIIF support
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
966
diff
changeset
|
188 Configuration options |
2df3597eacc8
documentation of IIIF support
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
966
diff
changeset
|
189 ^^^^^^^^^^^^^^^^^^^^^ |
2df3597eacc8
documentation of IIIF support
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
966
diff
changeset
|
190 |
2df3597eacc8
documentation of IIIF support
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
966
diff
changeset
|
191 .. highlight:: json |
2df3597eacc8
documentation of IIIF support
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
966
diff
changeset
|
192 |
2df3597eacc8
documentation of IIIF support
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
966
diff
changeset
|
193 The IIIF features can be configured using the following |
2df3597eacc8
documentation of IIIF support
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
966
diff
changeset
|
194 :ref:`configuration file <configuration>` of Orthanc:: |
2df3597eacc8
documentation of IIIF support
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
966
diff
changeset
|
195 |
2df3597eacc8
documentation of IIIF support
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
966
diff
changeset
|
196 { |
2df3597eacc8
documentation of IIIF support
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
966
diff
changeset
|
197 "Name" : "MyOrthanc", |
2df3597eacc8
documentation of IIIF support
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
966
diff
changeset
|
198 [...] |
2df3597eacc8
documentation of IIIF support
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
966
diff
changeset
|
199 "Plugins" : [ |
2df3597eacc8
documentation of IIIF support
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
966
diff
changeset
|
200 "/home/user/orthanc-wsi/ViewerPlugin/Build/libOrthancWSI.so" |
2df3597eacc8
documentation of IIIF support
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
966
diff
changeset
|
201 ], |
2df3597eacc8
documentation of IIIF support
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
966
diff
changeset
|
202 "WholeSlideImaging" : { |
2df3597eacc8
documentation of IIIF support
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
966
diff
changeset
|
203 "EnableIIIF" : true, // Can be used to disable support of IIIF |
2df3597eacc8
documentation of IIIF support
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
966
diff
changeset
|
204 "OrthancPublicURL" : "http://localhost:8042/", |
2df3597eacc8
documentation of IIIF support
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
966
diff
changeset
|
205 "ServeMirador" : false, // Whether to show the "Test IIIF in Mirador" button |
979 | 206 "ServeOpenSeadragon" : false, // Whether to show the "Test IIIF in OpenSeadragon" button |
967
2df3597eacc8
documentation of IIIF support
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
966
diff
changeset
|
207 "ForcePowersOfTwoScaleFactors" : true // Can be used to disable the compatibility mode |
2df3597eacc8
documentation of IIIF support
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
966
diff
changeset
|
208 } |
2df3597eacc8
documentation of IIIF support
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
966
diff
changeset
|
209 } |
2df3597eacc8
documentation of IIIF support
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
966
diff
changeset
|
210 |
2df3597eacc8
documentation of IIIF support
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
966
diff
changeset
|
211 A few remarks: |
2df3597eacc8
documentation of IIIF support
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
966
diff
changeset
|
212 |
2df3597eacc8
documentation of IIIF support
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
966
diff
changeset
|
213 * The ``OrthancPublicURL`` option must be adapted if Orthanc is |
2df3597eacc8
documentation of IIIF support
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
966
diff
changeset
|
214 branched behind a :ref:`reverse proxy <nginx>`. |
2df3597eacc8
documentation of IIIF support
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
966
diff
changeset
|
215 |
2df3597eacc8
documentation of IIIF support
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
966
diff
changeset
|
216 * In the case of a whole-slide image, the |
2df3597eacc8
documentation of IIIF support
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
966
diff
changeset
|
217 ``ForcePowersOfTwoScaleFactors`` option instruct the WSI plugin to |
2df3597eacc8
documentation of IIIF support
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
966
diff
changeset
|
218 only publish the pyramid levels whose scale factors follow a |
2df3597eacc8
documentation of IIIF support
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
966
diff
changeset
|
219 powers-of-two patterns (i.e., 1, 2, 4, 8, 16...). This provides |
2df3597eacc8
documentation of IIIF support
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
966
diff
changeset
|
220 maximum compatibility with viewers (for instance, consider `this |
2df3597eacc8
documentation of IIIF support
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
966
diff
changeset
|
221 issue |
2df3597eacc8
documentation of IIIF support
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
966
diff
changeset
|
222 <https://github.com/openseadragon/openseadragon/issues/2379>`__), |
2df3597eacc8
documentation of IIIF support
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
966
diff
changeset
|
223 but can break a smooth delivery of high-resolution images whose |
2df3597eacc8
documentation of IIIF support
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
966
diff
changeset
|
224 pyramid is irregular. Compatibility mode is enabled by default. |
2df3597eacc8
documentation of IIIF support
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
966
diff
changeset
|
225 |
81 | 226 |
227 Command-line tools | |
228 ------------------ | |
229 | |
85 | 230 .. highlight:: text |
81 | 231 |
232 The command-line tools ``OrthancWSIDicomizer`` and | |
233 ``OrthancWSIDicomToTiff`` provide documentation of all their options | |
234 if started with the ``--help`` parameter:: | |
235 | |
85 | 236 $ ./OrthancWSIDicomizer --help |
237 $ ./OrthancWSIDicomToTiff --help | |
81 | 238 |
239 In this section, we review the most common usages of these tools. | |
240 | |
241 | |
242 Transcoding a DICOM image | |
243 ^^^^^^^^^^^^^^^^^^^^^^^^^ | |
244 | |
245 The most simple usage consists in converting some whole-slide image to | |
246 DICOM, then uploading it to Orthanc:: | |
247 | |
85 | 248 $ ./OrthancWSIDicomizer Source.tif |
81 | 249 |
250 This command will transcode some `hierarchical, tiled TIFF | |
251 <https://en.wikipedia.org/wiki/TIFF>`__ image called ``Source.tif``, | |
85 | 252 and push the generated DICOM files to the default Orthanc server |
253 (running on ``localhost`` and listening to HTTP port ``8042``) using | |
254 its :ref:`REST API <rest>`. The log of the command will give you the | |
255 :ref:`identifier of the generated series <orthanc-ids>`, so that you | |
256 can locate it in Orthanc Explorer. This conversion is fast, as no | |
257 re-encoding takes place: If the source TIFF image contains JPEG tiles, | |
258 these tiles will be simply written as such. | |
81 | 259 |
85 | 260 Obviously, you can specify the parameters of the REST API of your |
261 target Orthanc server:: | |
82 | 262 |
85 | 263 $ ./OrthancWSIDicomizer Source.tif --orthanc=http://localhost:8042/ --username=orthanc --password=orthanc |
82 | 264 |
85 | 265 It is also possible to write the DICOM instances directly onto some |
82 | 266 folder of the filesystem (the target folder must be existing):: |
267 | |
85 | 268 $ ./OrthancWSIDicomizer Source.tif --folder=/tmp/dicomized/ |
82 | 269 |
85 | 270 This command will create a set of files entitled like |
271 ``/tmp/dicomized/wsi-XXXXXX.dcm``. You can modify this pattern using | |
272 the command-line option ``--folder-pattern``. | |
273 | |
274 By default, the DICOM-izer will spread the output series as a set of | |
275 DICOM files whose size stays below 10MB. This prevents the appearance | |
276 of huge files, which speeds up further processing. This behavior can | |
277 be controlled using the ``--max-size`` command-line option. | |
82 | 278 |
81 | 279 |
280 Re-encoding a DICOM image | |
281 ^^^^^^^^^^^^^^^^^^^^^^^^^ | |
282 | |
85 | 283 The section above explained how to transcode whole-slide images, |
284 without modifying the compression scheme of their individual tiles | |
285 (which is most commonly JPEG). You can instruct the DICOM-izer to | |
286 re-encode each and every individual tile as follows:: | |
287 | |
288 $ ./OrthancWSIDicomizer Source.tif --reencode=1 --compression=jpeg2000 | |
289 | |
290 This example would create a series of DICOM instances encoded using | |
291 the JPEG2k transfer syntax (whose UID is ``1.2.840.10008.1.2.4.90``). | |
292 As JPEG2k is not natively supported by many Web browsers, the Web | |
293 viewer plugin would transparently convert such JPEG2k-encoded tiles to | |
294 PNG images. | |
295 | |
296 It is also possible to re-encode the image so as to reduce disk space | |
297 consumption by changing the JPEG quality:: | |
298 | |
299 $ ./OrthancWSIDicomizer Source.tif --reencode=1 --compression=jpeg --jpeg-quality=10 | |
300 | |
301 The DICOM-izer also allows to re-generate all the multi-resolution | |
302 pyramid. This is extremely importantly to enhance the user experience | |
303 of the Web interface, if the source image only features the finest | |
304 zoom level of the whole-slide image:: | |
305 | |
306 $ ./OrthancWSIDicomizer Source.tif --pyramid=1 --smooth=1 | |
307 | |
308 The number of levels in the pyramid can be controlled using the | |
309 ``--levels`` command-line option. The ``--smooth=1`` option tells the | |
310 DICOM-izer to apply `Gaussian smoothing | |
311 <https://en.wikipedia.org/wiki/Gaussian_blur>`__ when re-scaling the | |
312 image, in order to avoid the appearance of aliasing in the | |
313 multi-resolution pyramid. This produces nicer images, at the price of | |
314 higher computation time. | |
315 | |
316 All the examples described in this section are obviously much more | |
317 CPU-intensive than simple transcoding. The DICOM-izer takes advantage | |
318 in multi-threading to reduce the computation time. By default, it will | |
319 use half the number of logical CPU cores that are available. This | |
320 behavior can be fine-tuned using command-line option ``--threads``. | |
81 | 321 |
322 | |
323 | |
324 Proprietary file formats | |
325 ^^^^^^^^^^^^^^^^^^^^^^^^ | |
326 | |
327 Out-of-the-box, the DICOM-izer supports standard hierarchical TIFF | |
328 images. Some commonplace image formats (PNG and JPEG) can be | |
329 DICOM-ized as well. However, whole-slide images can come in many | |
85 | 330 proprietary file formats. To re-encode such images, the DICOM-izer |
358
011b01ccf52d
fixing external hyperlinks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
129
diff
changeset
|
331 relies upon the `OpenSlide toolbox <https://openslide.org/>`__. |
81 | 332 |
333 For this feature to work, you have to tell the command-line tool where | |
334 it can find the OpenSlide shared library. GNU/Linux distributions | |
335 generally provide packages containing the OpenSlide shared library | |
85 | 336 (e.g. under Debian/Ubuntu, simply install the ``libopenslide0`` |
337 package):: | |
81 | 338 |
85 | 339 $ ./OrthancWSIDicomizer --openslide=libopenslide.so CMU-1-JP2K-33005.svs |
81 | 340 |
85 | 341 Pre-compiled Microsoft Windows binaries of this shared library can be |
358
011b01ccf52d
fixing external hyperlinks
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
129
diff
changeset
|
342 found on the `OpenSlide homepage <https://openslide.org/download/>`__ (Note that |
87
f8aa67501041
extra info for libOpenSlide Windows package
Alain Mazy <alain@mazy.be>
parents:
85
diff
changeset
|
343 you should copy all .dll files from the OpenSlide package next to the OrthancWSIDicomizer |
f8aa67501041
extra info for libOpenSlide Windows package
Alain Mazy <alain@mazy.be>
parents:
85
diff
changeset
|
344 executable):: |
81 | 345 |
85 | 346 $ ./OrthancWSIDicomizer --openslide=libopenslide-0.dll CMU-1-JP2K-33005.svs |
81 | 347 |
348 Note that this operation implies the re-encoding of the source image | |
349 from the proprietary file format, which is much more time-consuming | |
350 than simply transcoding a TIFF image. | |
351 | |
352 | |
353 Specifying a DICOM dataset | |
354 ^^^^^^^^^^^^^^^^^^^^^^^^^^ | |
355 | |
85 | 356 So far, we have only been discussing the whole-slide image by itself, |
357 and not the :ref:`medical information <dicom-tags>` that is associated | |
358 with each DICOM file. The DICOM tags that must be embedded inside the | |
359 generated DICOM series can be specified using the user-friendly JSON | |
360 file format. You would first generate a minimal, sample JSON dataset | |
361 as follows:: | |
362 | |
363 $ ./OrthancWSIDicomizer --sample-dataset > dataset.json | |
364 | |
365 Secondly, you would edit the just-generated ``dataset.json`` file | |
366 using any text editor (or any script interfaced with your RIS), so as | |
367 to encode medical information associated with the image | |
368 acquisition. Finally, tell the DICOM-izer where it can find the | |
369 dataset when re-encoding or transcoding the image:: | |
370 | |
371 $ ./OrthancWSIDicomizer Source.tif --dataset=dataset.json | |
372 | |
373 Note that it is always a good idea to check whether all the required | |
374 DICOM tags have been properly provided, e.g. by running the | |
375 ``dciodvfy`` command-line tool provided by `David Clunie | |
376 <http://www.dclunie.com/dicom3tools.html>`__ that checks the | |
377 compliance of DICOM files. | |
378 | |
81 | 379 |
380 Converting DICOM to TIFF | |
381 ^^^^^^^^^^^^^^^^^^^^^^^^ | |
382 | |
85 | 383 The whole-slide imaging framework for Orthanc also provides a |
384 command-line tool that converts some DICOM series, as a standard | |
385 hierarchical, tiled TIFF image. This is important if you wish to | |
386 export some DICOM file to a framework that does not support DICOM | |
387 Supplement 145. | |
388 | |
389 Here is how you would convert a whole-slide image stored in the | |
390 default Orthanc server:: | |
391 | |
392 $ ./OrthancWSIDicomToTiff fdf53e42-06d7377a-c24c59fd-3704e72d-f4c75b68 Target.tif | |
393 | |
394 You just have to provide the :ref:`Orthanc identifier <orthanc-ids>` | |
395 of the series of interest (that can be retrieved using :ref:`Orthanc | |
396 Explorer <orthanc-explorer>` or the :ref:`REST API <rest>`), and the | |
397 path to the target TIFF file. | |
398 | |
399 Similarly to the DICOM-izer, the command-line options ``--orthanc``, | |
400 ``--username`` and ``--password`` can be used to specify the | |
401 parameters of your Orthanc server. | |
402 | |
81 | 403 |
797 | 404 Interface with Cytomine |
405 ----------------------- | |
406 | |
407 `Cytomine <https://cytomine.be/>`__ is an "*open-source rich internet | |
408 application for collaborative analysis of multi-gigapixel images.*" | |
409 Starting with release 1.1 of the whole-slide imaging framework for | |
410 Orthanc, it is possible to exchange digital pathology images back and | |
411 forth between Orthanc and Cytomine according to the following | |
412 workflow: | |
413 | |
414 .. image:: ../images/2021-12-12-Cytomine.png | |
415 :align: center | |
416 :width: 500px | |
417 | |
418 | | |
419 | |
420 As can be seen, ``OrthancWSIDicomizer`` imports the source image from | |
421 Cytomine using its REST API, then puts the converted DICOM instances | |
422 onto Orthanc using its REST API. Here is a minimalist sample call to | |
423 the ``OrthancWSIDicomizer`` command-line tool to convert an image from | |
424 a Cytomine server onto an Orthanc server listening on | |
425 ``localhost:8042`` with default parameters :: | |
426 | |
427 $ ./OrthancWSIDicomizer --cytomine-url=http://XXX --cytomine-image=325 \ | |
428 --cytomine-public-key=YYY --cytomine-private-key=ZZZ \ | |
429 --threads=4 --pyramid=1 --username=orthanc --password=orthanc --verbose | |
430 | |
431 The ``--cytomine-image`` parameter corresponds to the ID of the `Image | |
432 Instance <https://doc.uliege.cytomine.org/dev-guide/api/reference>`__ | |
433 of interest. This ID can easily be retrieved from the Web interface of | |
434 Cytomine: | |
435 | |
436 .. image:: ../images/Cytomine.png | |
437 :align: center | |
438 :width: 600px | |
439 | |
440 | | |
441 | |
442 The ``--cytomine-public-key`` and ``--cytomine-private-key`` | |
443 parameters grant access to the REST API of Cytomine, and can be found | |
444 in the parameters of your account using the Web interface of Cytomine: | |
445 | |
446 .. image:: ../images/CytomineKeys.png | |
447 :align: center | |
448 :width: 600px | |
449 | |
450 | | |
451 | |
452 | |
453 | |
454 | |
81 | 455 REST API |
456 -------- | |
457 | |
85 | 458 Besides providing an user interface, the plugin for whole-slide |
459 imaging also enrich the :ref:`REST API <rest>` of Orthanc with some | |
460 new URIs, that are described in this section. | |
461 | |
462 Note that the Web interface of the plugin exclusively relies upon this | |
463 enriched REST API in order to display whole-slide images using the | |
464 `OpenLayers 3 <https://openlayers.org/>`__ JavaScript library. | |
465 | |
466 | |
467 Information about a whole-slide image | |
468 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | |
469 | |
470 You can check whether a DICOM series associated with some known | |
471 :ref:`Orthanc ID <orthanc-ids>` ``id`` corresponds to a whole-slide | |
472 image by calling the ``/wsi/pyramids/{id}`` URI. A HTTP status code | |
473 404 is returned if the series is *not* a whole-slide image:: | |
474 | |
475 $ curl -v http://localhost:8042/wsi/pyramids/ca2cc2ef-2dd8be12-0a4506ae-d565b7e1-a4ca9068 | |
476 [...] | |
477 < HTTP/1.1 404 Not Found | |
478 | |
479 However, if the identifier corresponds to a valid whole-slide image, | |
480 you will get information about its multi-resolution pyramid, formatted | |
481 using JSON:: | |
482 | |
483 $ curl http://localhost:8042/wsi/pyramids/f0ed5846-2ce36a70-d27bb5d3-6ed9dac2-ee638d85 | |
484 { | |
485 "ID" : "f0ed5846-2ce36a70-d27bb5d3-6ed9dac2-ee638d85", | |
486 "Resolutions" : [ 1, 2, 4, 8, 16 ], | |
487 "Sizes" : [ | |
488 [ 10800, 5400 ], | |
489 [ 5400, 2700 ], | |
490 [ 2700, 1350 ], | |
491 [ 1350, 675 ], | |
492 [ 675, 338 ] | |
493 ], | |
494 "TileHeight" : 512, | |
495 "TileWidth" : 512, | |
496 "TilesCount" : [ | |
497 [ 22, 11 ], | |
498 [ 11, 6 ], | |
499 [ 6, 3 ], | |
500 [ 3, 2 ], | |
501 [ 2, 1 ] | |
502 ], | |
503 "TotalHeight" : 5400, | |
504 "TotalWidth" : 10800 | |
505 } | |
506 | |
507 The size of the finest level of the pyramid is verbatim available from | |
508 this output (in the example above, ``10,800 x 5,400`` pixels), as well | |
509 as the size of each individual tile (``512 x 512`` pixels). The | |
510 ``TilesCount`` gives, for each level of the pyramid (sorted in | |
511 decreasing resolutions), the number of tiles along each dimension: In | |
512 the example above, the coarsest level contains 2 tiles along the X | |
513 axis, and 1 tile along the Y. | |
514 | |
515 Note that the interpretation of the whole-slide image is done | |
516 transparently by the plugin, which frees the user from parsing each | |
517 and every DICOM instance in the series. | |
518 | |
519 The medical information associated with the series or its instances | |
520 can as usual be retrieved using the core :ref:`REST API <rest>` of | |
521 Orthanc. | |
522 | |
523 | |
524 Decoding the individual tiles | |
525 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | |
526 | |
527 As discussed above, the ``/wsi/pyramids/{id}`` gives information about | |
528 the number of tiles in each level of the multi-resolution pyramid | |
529 associated with series ``id``. | |
530 | |
531 You can then retrieve the individual tiles of each level using the | |
532 ``/wsi/tiles/{id}/{z}/{x}/{y}`` URI, where ``z`` corresponds to the | |
533 level of interest, and (``x``, ``y``) the index of the tile of | |
534 interest at this level. All of these indices start at zero, the level | |
535 ``z=0`` corresponding to the finest level. | |
536 | |
537 For instance, here is how to retrieve the central tile of the finest | |
538 level of the pyramid (that contains ``22 x 11`` tiles in our example):: | |
539 | |
540 $ curl http://localhost:8042/wsi/tiles/f0ed5846-2ce36a70-d27bb5d3-6ed9dac2-ee638d85/0/11/5 > tile.jpg | |
541 $ identify ./tile.jpg | |
542 ./tile.jpg JPEG 512x512 512x512+0+0 8-bit DirectClass 88.5KB 0.000u 0:00.000 | |
543 | |
544 As can be seen, the plugin has returned a JPEG image of size ``512 x | |
545 512``, which corresponds to the size of the tiles in this sample | |
546 image. If trying to access a tile outside the image, the plugin will | |
547 return with an HTTP status code that is not ``200 OK``. Similarly, | |
548 here is how to retrieve a tile at the coarsest level (the pyramid has | |
549 5 levels in our example):: | |
550 | |
551 $ curl http://localhost:8042/wsi/tiles/f0ed5846-2ce36a70-d27bb5d3-6ed9dac2-ee638d85/4/0/0 > tile.jpg | |
552 | |
553 Depending upon the transfer syntax of the DICOM instances, the tile | |
554 might not be encoded using JPEG. Indeed, if the transfer syntax is | |
555 uncompressed (UID ``1.2.840.10008.1.2`` and friends) or JPEG2k | |
556 lossless (UID ``1.2.840.10008.1.2.4.90``), the plugin will | |
557 transparently re-encode the tile to PNG in order to avoid any | |
558 destructive compression. | |
966
02121f3c7e65
note about the Accept header in WSI plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
797
diff
changeset
|
559 |
02121f3c7e65
note about the Accept header in WSI plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
797
diff
changeset
|
560 NB: Starting with version 2.0 of the WSI plugin, the |
02121f3c7e65
note about the Accept header in WSI plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
797
diff
changeset
|
561 ``/wsi/tiles/{id}/{z}/{x}/{y}`` route accepts the ``Accept`` HTTP |
02121f3c7e65
note about the Accept header in WSI plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
797
diff
changeset
|
562 header, which can be used to force the compression of the tile. The |
02121f3c7e65
note about the Accept header in WSI plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
797
diff
changeset
|
563 allowed values for ``Accept`` are: ``image/png``, ``image/jpeg``, and |
02121f3c7e65
note about the Accept header in WSI plugin
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
797
diff
changeset
|
564 ``image/jp2`` (which corresponds to JPEG2k). |