annotate Sphinx/source/plugins/wsi.rst @ 129:61050d813d74

build wsi
author Sebastien Jodogne <s.jodogne@gmail.com>
date Thu, 04 Jan 2018 11:06:35 +0100
parents f8aa67501041
children 011b01ccf52d
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
52
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1 .. _wsi:
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3
85
13dd3f20a00a wsi rest api
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 82
diff changeset
4 Whole-slide microscopic imaging
81
4eea0dc5f071 documenting wsi
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 52
diff changeset
5 ===============================
52
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7 .. contents::
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8
81
4eea0dc5f071 documenting wsi
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 52
diff changeset
9 The Orthanc project provides three **official tools** to support DICOM
4eea0dc5f071 documenting wsi
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 52
diff changeset
10 for whole-slide microscopic imaging (WSI):
4eea0dc5f071 documenting wsi
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 52
diff changeset
11
4eea0dc5f071 documenting wsi
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 52
diff changeset
12 1. A so-called "DICOM-izer" command-line tool that converts
4eea0dc5f071 documenting wsi
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 52
diff changeset
13 whole-slide images to DICOM series, following `Supplement 145
4eea0dc5f071 documenting wsi
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 52
diff changeset
14 <ftp://medical.nema.org/medical/dicom/final/sup145_ft.pdf>`__.
4eea0dc5f071 documenting wsi
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 52
diff changeset
15 2. A plugin that extends Orthanc with a Web viewer of whole-slide
4eea0dc5f071 documenting wsi
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 52
diff changeset
16 images for digital pathology.
4eea0dc5f071 documenting wsi
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 52
diff changeset
17 3. Another command-line tool that converts a DICOM series stored
82
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 81
diff changeset
18 inside Orthanc, to a standard hierarchical TIFF image.
52
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
19
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
20 For general information, check out the `official homepage of the
81
4eea0dc5f071 documenting wsi
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 52
diff changeset
21 framework <http://www.orthanc-server.com/static.php?page=wsi>`__.
4eea0dc5f071 documenting wsi
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 52
diff changeset
22
4eea0dc5f071 documenting wsi
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 52
diff changeset
23
4eea0dc5f071 documenting wsi
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 52
diff changeset
24 Compilation
4eea0dc5f071 documenting wsi
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 52
diff changeset
25 -----------
4eea0dc5f071 documenting wsi
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 52
diff changeset
26
129
61050d813d74 build wsi
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 87
diff changeset
27 Static linking
61050d813d74 build wsi
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 87
diff changeset
28 ^^^^^^^^^^^^^^
61050d813d74 build wsi
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 87
diff changeset
29
85
13dd3f20a00a wsi rest api
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 82
diff changeset
30 .. highlight:: text
81
4eea0dc5f071 documenting wsi
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 52
diff changeset
31
4eea0dc5f071 documenting wsi
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 52
diff changeset
32 The procedure to compile the WSI framework is similar of that for the
4eea0dc5f071 documenting wsi
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 52
diff changeset
33 :ref:`core of Orthanc <binaries>`. The following commands should work
4eea0dc5f071 documenting wsi
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 52
diff changeset
34 for every UNIX-like distribution (including GNU/Linux)::
4eea0dc5f071 documenting wsi
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 52
diff changeset
35
4eea0dc5f071 documenting wsi
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 52
diff changeset
36 # Firstly, compile the command-line tools
4eea0dc5f071 documenting wsi
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 52
diff changeset
37 $ mkdir Applications/Build
4eea0dc5f071 documenting wsi
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 52
diff changeset
38 $ cd Applications/Build
4eea0dc5f071 documenting wsi
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 52
diff changeset
39 $ cmake .. -DSTATIC_BUILD=ON -DCMAKE_BUILD_TYPE=Release
4eea0dc5f071 documenting wsi
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 52
diff changeset
40 $ make
129
61050d813d74 build wsi
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 87
diff changeset
41
85
13dd3f20a00a wsi rest api
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 82
diff changeset
42 # Secondly, compile the viewer plugin
81
4eea0dc5f071 documenting wsi
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 52
diff changeset
43 $ mkdir ../../ViewerPlugin/Build
4eea0dc5f071 documenting wsi
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 52
diff changeset
44 $ cd ../../ViewerPlugin/Build
4eea0dc5f071 documenting wsi
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 52
diff changeset
45 $ cmake .. -DSTATIC_BUILD=ON -DCMAKE_BUILD_TYPE=Release
4eea0dc5f071 documenting wsi
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 52
diff changeset
46 $ make
4eea0dc5f071 documenting wsi
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 52
diff changeset
47
4eea0dc5f071 documenting wsi
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 52
diff changeset
48 The compilation will produce 3 binaries:
4eea0dc5f071 documenting wsi
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 52
diff changeset
49
4eea0dc5f071 documenting wsi
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 52
diff changeset
50 * ``Applications/Build/OrthancWSIDicomizer``, which contains the DICOM-izer.
4eea0dc5f071 documenting wsi
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 52
diff changeset
51 * ``Applications/Build/OrthancWSIDicomToTiff``, which contains the DICOM-to-TIFF converter.
82
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 81
diff changeset
52 * ``ViewerPlugin/Build/OrthancWSI``, which is a shared library containing the viewer plugin for Orthanc.
81
4eea0dc5f071 documenting wsi
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 52
diff changeset
53
129
61050d813d74 build wsi
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 87
diff changeset
54 Microsoft Windows
61050d813d74 build wsi
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 87
diff changeset
55 ^^^^^^^^^^^^^^^^^
61050d813d74 build wsi
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 87
diff changeset
56
81
4eea0dc5f071 documenting wsi
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 52
diff changeset
57 Note that pre-compiled binaries for Microsoft Windows `are available
4eea0dc5f071 documenting wsi
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 52
diff changeset
58 <http://www.orthanc-server.com/browse.php?path=/whole-slide-imaging>`__.
4eea0dc5f071 documenting wsi
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 52
diff changeset
59
4eea0dc5f071 documenting wsi
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 52
diff changeset
60
129
61050d813d74 build wsi
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 87
diff changeset
61 Dynamic linking
61050d813d74 build wsi
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 87
diff changeset
62 ^^^^^^^^^^^^^^^
61050d813d74 build wsi
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 87
diff changeset
63
61050d813d74 build wsi
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 87
diff changeset
64 .. highlight:: text
61050d813d74 build wsi
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 87
diff changeset
65
61050d813d74 build wsi
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 87
diff changeset
66 If static linking is not desired, here are build instructions for
61050d813d74 build wsi
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 87
diff changeset
67 Ubuntu 16.04 (provided build dependencies for the :ref:`core of
61050d813d74 build wsi
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 87
diff changeset
68 Orthanc <compiling>` have already been installed)::
61050d813d74 build wsi
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 87
diff changeset
69
61050d813d74 build wsi
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 87
diff changeset
70 $ sudo apt-get install libopenjpeg-dev
61050d813d74 build wsi
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 87
diff changeset
71
61050d813d74 build wsi
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 87
diff changeset
72 # Firstly, compile the command-line tools
61050d813d74 build wsi
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 87
diff changeset
73 $ mkdir Applications/Build
61050d813d74 build wsi
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 87
diff changeset
74 $ cd Applications/Build
61050d813d74 build wsi
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 87
diff changeset
75 $ cmake .. -DCMAKE_BUILD_TYPE=Release -DUSE_SYSTEM_ORTHANC_SDK=OFF
61050d813d74 build wsi
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 87
diff changeset
76 $ make
61050d813d74 build wsi
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 87
diff changeset
77
61050d813d74 build wsi
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 87
diff changeset
78 # Secondly, compile the viewer plugin
61050d813d74 build wsi
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 87
diff changeset
79 $ mkdir ../../ViewerPlugin/Build
61050d813d74 build wsi
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 87
diff changeset
80 $ cd ../../ViewerPlugin/Build
61050d813d74 build wsi
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 87
diff changeset
81 $ cmake .. -DCMAKE_BUILD_TYPE=Release -DUSE_SYSTEM_ORTHANC_SDK=OFF -DALLOW_DOWNLOADS=ON
61050d813d74 build wsi
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 87
diff changeset
82 $ make
61050d813d74 build wsi
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 87
diff changeset
83
61050d813d74 build wsi
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 87
diff changeset
84
61050d813d74 build wsi
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 87
diff changeset
85
85
13dd3f20a00a wsi rest api
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 82
diff changeset
86 Usage of the plugin
13dd3f20a00a wsi rest api
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 82
diff changeset
87 -------------------
81
4eea0dc5f071 documenting wsi
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 52
diff changeset
88
4eea0dc5f071 documenting wsi
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 52
diff changeset
89 .. highlight:: json
4eea0dc5f071 documenting wsi
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 52
diff changeset
90
4eea0dc5f071 documenting wsi
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 52
diff changeset
91 You of course first have to :ref:`install Orthanc <compiling>`. Once
4eea0dc5f071 documenting wsi
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 52
diff changeset
92 Orthanc is installed, you must change the :ref:`configuration file
4eea0dc5f071 documenting wsi
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 52
diff changeset
93 <configuration>` to tell Orthanc where it can find the plugin: This is
85
13dd3f20a00a wsi rest api
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 82
diff changeset
94 done by properly modifying the ``Plugins`` configuration option. You
13dd3f20a00a wsi rest api
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 82
diff changeset
95 could for instance use the following configuration file under
13dd3f20a00a wsi rest api
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 82
diff changeset
96 GNU/Linux::
81
4eea0dc5f071 documenting wsi
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 52
diff changeset
97
4eea0dc5f071 documenting wsi
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 52
diff changeset
98 {
4eea0dc5f071 documenting wsi
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 52
diff changeset
99 "Name" : "MyOrthanc",
4eea0dc5f071 documenting wsi
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 52
diff changeset
100 [...]
4eea0dc5f071 documenting wsi
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 52
diff changeset
101 "Plugins" : [
4eea0dc5f071 documenting wsi
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 52
diff changeset
102 "/home/user/orthanc-wsi/ViewerPlugin/Build/libOrthancWSI.so"
4eea0dc5f071 documenting wsi
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 52
diff changeset
103 ]
4eea0dc5f071 documenting wsi
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 52
diff changeset
104 }
4eea0dc5f071 documenting wsi
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 52
diff changeset
105
4eea0dc5f071 documenting wsi
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 52
diff changeset
106 Orthanc must of course be restarted after the modification of its
4eea0dc5f071 documenting wsi
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 52
diff changeset
107 configuration file. The WSI plugin has no specific configuration
4eea0dc5f071 documenting wsi
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 52
diff changeset
108 option.
4eea0dc5f071 documenting wsi
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 52
diff changeset
109
85
13dd3f20a00a wsi rest api
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 82
diff changeset
110 Once a :ref:`DICOM series <model-world>` is opened using :ref:`Orthanc
13dd3f20a00a wsi rest api
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 82
diff changeset
111 Explorer <orthanc-explorer>`, a yellow button entitled ``Whole-Slide
13dd3f20a00a wsi rest api
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 82
diff changeset
112 Imaging Viewer`` will show up for series corresponding to whole-slide
13dd3f20a00a wsi rest api
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 82
diff changeset
113 images. This button will open the WSI viewer for that particular
13dd3f20a00a wsi rest api
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 82
diff changeset
114 series. This behavior can be seen on the Orthanc Explorer interface
13dd3f20a00a wsi rest api
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 82
diff changeset
115 running on our `WSI demonstration server
13dd3f20a00a wsi rest api
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 82
diff changeset
116 <http://wsi.orthanc-server.com/orthanc/app/explorer.html>`__.
81
4eea0dc5f071 documenting wsi
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 52
diff changeset
117
4eea0dc5f071 documenting wsi
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 52
diff changeset
118
4eea0dc5f071 documenting wsi
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 52
diff changeset
119
4eea0dc5f071 documenting wsi
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 52
diff changeset
120 Command-line tools
4eea0dc5f071 documenting wsi
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 52
diff changeset
121 ------------------
4eea0dc5f071 documenting wsi
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 52
diff changeset
122
85
13dd3f20a00a wsi rest api
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 82
diff changeset
123 .. highlight:: text
81
4eea0dc5f071 documenting wsi
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 52
diff changeset
124
4eea0dc5f071 documenting wsi
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 52
diff changeset
125 The command-line tools ``OrthancWSIDicomizer`` and
4eea0dc5f071 documenting wsi
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 52
diff changeset
126 ``OrthancWSIDicomToTiff`` provide documentation of all their options
4eea0dc5f071 documenting wsi
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 52
diff changeset
127 if started with the ``--help`` parameter::
4eea0dc5f071 documenting wsi
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 52
diff changeset
128
85
13dd3f20a00a wsi rest api
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 82
diff changeset
129 $ ./OrthancWSIDicomizer --help
13dd3f20a00a wsi rest api
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 82
diff changeset
130 $ ./OrthancWSIDicomToTiff --help
81
4eea0dc5f071 documenting wsi
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 52
diff changeset
131
4eea0dc5f071 documenting wsi
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 52
diff changeset
132 In this section, we review the most common usages of these tools.
4eea0dc5f071 documenting wsi
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 52
diff changeset
133
4eea0dc5f071 documenting wsi
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 52
diff changeset
134
4eea0dc5f071 documenting wsi
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 52
diff changeset
135 Transcoding a DICOM image
4eea0dc5f071 documenting wsi
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 52
diff changeset
136 ^^^^^^^^^^^^^^^^^^^^^^^^^
4eea0dc5f071 documenting wsi
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 52
diff changeset
137
4eea0dc5f071 documenting wsi
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 52
diff changeset
138 The most simple usage consists in converting some whole-slide image to
4eea0dc5f071 documenting wsi
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 52
diff changeset
139 DICOM, then uploading it to Orthanc::
4eea0dc5f071 documenting wsi
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 52
diff changeset
140
85
13dd3f20a00a wsi rest api
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 82
diff changeset
141 $ ./OrthancWSIDicomizer Source.tif
81
4eea0dc5f071 documenting wsi
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 52
diff changeset
142
4eea0dc5f071 documenting wsi
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 52
diff changeset
143 This command will transcode some `hierarchical, tiled TIFF
4eea0dc5f071 documenting wsi
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 52
diff changeset
144 <https://en.wikipedia.org/wiki/TIFF>`__ image called ``Source.tif``,
85
13dd3f20a00a wsi rest api
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 82
diff changeset
145 and push the generated DICOM files to the default Orthanc server
13dd3f20a00a wsi rest api
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 82
diff changeset
146 (running on ``localhost`` and listening to HTTP port ``8042``) using
13dd3f20a00a wsi rest api
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 82
diff changeset
147 its :ref:`REST API <rest>`. The log of the command will give you the
13dd3f20a00a wsi rest api
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 82
diff changeset
148 :ref:`identifier of the generated series <orthanc-ids>`, so that you
13dd3f20a00a wsi rest api
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 82
diff changeset
149 can locate it in Orthanc Explorer. This conversion is fast, as no
13dd3f20a00a wsi rest api
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 82
diff changeset
150 re-encoding takes place: If the source TIFF image contains JPEG tiles,
13dd3f20a00a wsi rest api
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 82
diff changeset
151 these tiles will be simply written as such.
81
4eea0dc5f071 documenting wsi
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 52
diff changeset
152
85
13dd3f20a00a wsi rest api
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 82
diff changeset
153 Obviously, you can specify the parameters of the REST API of your
13dd3f20a00a wsi rest api
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 82
diff changeset
154 target Orthanc server::
82
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 81
diff changeset
155
85
13dd3f20a00a wsi rest api
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 82
diff changeset
156 $ ./OrthancWSIDicomizer Source.tif --orthanc=http://localhost:8042/ --username=orthanc --password=orthanc
82
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 81
diff changeset
157
85
13dd3f20a00a wsi rest api
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 82
diff changeset
158 It is also possible to write the DICOM instances directly onto some
82
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 81
diff changeset
159 folder of the filesystem (the target folder must be existing)::
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 81
diff changeset
160
85
13dd3f20a00a wsi rest api
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 82
diff changeset
161 $ ./OrthancWSIDicomizer Source.tif --folder=/tmp/dicomized/
82
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 81
diff changeset
162
85
13dd3f20a00a wsi rest api
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 82
diff changeset
163 This command will create a set of files entitled like
13dd3f20a00a wsi rest api
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 82
diff changeset
164 ``/tmp/dicomized/wsi-XXXXXX.dcm``. You can modify this pattern using
13dd3f20a00a wsi rest api
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 82
diff changeset
165 the command-line option ``--folder-pattern``.
13dd3f20a00a wsi rest api
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 82
diff changeset
166
13dd3f20a00a wsi rest api
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 82
diff changeset
167 By default, the DICOM-izer will spread the output series as a set of
13dd3f20a00a wsi rest api
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 82
diff changeset
168 DICOM files whose size stays below 10MB. This prevents the appearance
13dd3f20a00a wsi rest api
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 82
diff changeset
169 of huge files, which speeds up further processing. This behavior can
13dd3f20a00a wsi rest api
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 82
diff changeset
170 be controlled using the ``--max-size`` command-line option.
82
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 81
diff changeset
171
81
4eea0dc5f071 documenting wsi
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 52
diff changeset
172
4eea0dc5f071 documenting wsi
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 52
diff changeset
173 Re-encoding a DICOM image
4eea0dc5f071 documenting wsi
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 52
diff changeset
174 ^^^^^^^^^^^^^^^^^^^^^^^^^
4eea0dc5f071 documenting wsi
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 52
diff changeset
175
85
13dd3f20a00a wsi rest api
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 82
diff changeset
176 The section above explained how to transcode whole-slide images,
13dd3f20a00a wsi rest api
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 82
diff changeset
177 without modifying the compression scheme of their individual tiles
13dd3f20a00a wsi rest api
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 82
diff changeset
178 (which is most commonly JPEG). You can instruct the DICOM-izer to
13dd3f20a00a wsi rest api
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 82
diff changeset
179 re-encode each and every individual tile as follows::
13dd3f20a00a wsi rest api
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 82
diff changeset
180
13dd3f20a00a wsi rest api
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 82
diff changeset
181 $ ./OrthancWSIDicomizer Source.tif --reencode=1 --compression=jpeg2000
13dd3f20a00a wsi rest api
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 82
diff changeset
182
13dd3f20a00a wsi rest api
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 82
diff changeset
183 This example would create a series of DICOM instances encoded using
13dd3f20a00a wsi rest api
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 82
diff changeset
184 the JPEG2k transfer syntax (whose UID is ``1.2.840.10008.1.2.4.90``).
13dd3f20a00a wsi rest api
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 82
diff changeset
185 As JPEG2k is not natively supported by many Web browsers, the Web
13dd3f20a00a wsi rest api
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 82
diff changeset
186 viewer plugin would transparently convert such JPEG2k-encoded tiles to
13dd3f20a00a wsi rest api
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 82
diff changeset
187 PNG images.
13dd3f20a00a wsi rest api
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 82
diff changeset
188
13dd3f20a00a wsi rest api
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 82
diff changeset
189 It is also possible to re-encode the image so as to reduce disk space
13dd3f20a00a wsi rest api
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 82
diff changeset
190 consumption by changing the JPEG quality::
13dd3f20a00a wsi rest api
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 82
diff changeset
191
13dd3f20a00a wsi rest api
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 82
diff changeset
192 $ ./OrthancWSIDicomizer Source.tif --reencode=1 --compression=jpeg --jpeg-quality=10
13dd3f20a00a wsi rest api
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 82
diff changeset
193
13dd3f20a00a wsi rest api
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 82
diff changeset
194 The DICOM-izer also allows to re-generate all the multi-resolution
13dd3f20a00a wsi rest api
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 82
diff changeset
195 pyramid. This is extremely importantly to enhance the user experience
13dd3f20a00a wsi rest api
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 82
diff changeset
196 of the Web interface, if the source image only features the finest
13dd3f20a00a wsi rest api
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 82
diff changeset
197 zoom level of the whole-slide image::
13dd3f20a00a wsi rest api
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 82
diff changeset
198
13dd3f20a00a wsi rest api
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 82
diff changeset
199 $ ./OrthancWSIDicomizer Source.tif --pyramid=1 --smooth=1
13dd3f20a00a wsi rest api
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 82
diff changeset
200
13dd3f20a00a wsi rest api
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 82
diff changeset
201 The number of levels in the pyramid can be controlled using the
13dd3f20a00a wsi rest api
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 82
diff changeset
202 ``--levels`` command-line option. The ``--smooth=1`` option tells the
13dd3f20a00a wsi rest api
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 82
diff changeset
203 DICOM-izer to apply `Gaussian smoothing
13dd3f20a00a wsi rest api
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 82
diff changeset
204 <https://en.wikipedia.org/wiki/Gaussian_blur>`__ when re-scaling the
13dd3f20a00a wsi rest api
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 82
diff changeset
205 image, in order to avoid the appearance of aliasing in the
13dd3f20a00a wsi rest api
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 82
diff changeset
206 multi-resolution pyramid. This produces nicer images, at the price of
13dd3f20a00a wsi rest api
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 82
diff changeset
207 higher computation time.
13dd3f20a00a wsi rest api
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 82
diff changeset
208
13dd3f20a00a wsi rest api
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 82
diff changeset
209 All the examples described in this section are obviously much more
13dd3f20a00a wsi rest api
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 82
diff changeset
210 CPU-intensive than simple transcoding. The DICOM-izer takes advantage
13dd3f20a00a wsi rest api
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 82
diff changeset
211 in multi-threading to reduce the computation time. By default, it will
13dd3f20a00a wsi rest api
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 82
diff changeset
212 use half the number of logical CPU cores that are available. This
13dd3f20a00a wsi rest api
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 82
diff changeset
213 behavior can be fine-tuned using command-line option ``--threads``.
81
4eea0dc5f071 documenting wsi
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 52
diff changeset
214
4eea0dc5f071 documenting wsi
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 52
diff changeset
215
4eea0dc5f071 documenting wsi
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 52
diff changeset
216
4eea0dc5f071 documenting wsi
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 52
diff changeset
217 Proprietary file formats
4eea0dc5f071 documenting wsi
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 52
diff changeset
218 ^^^^^^^^^^^^^^^^^^^^^^^^
4eea0dc5f071 documenting wsi
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 52
diff changeset
219
4eea0dc5f071 documenting wsi
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 52
diff changeset
220 Out-of-the-box, the DICOM-izer supports standard hierarchical TIFF
4eea0dc5f071 documenting wsi
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 52
diff changeset
221 images. Some commonplace image formats (PNG and JPEG) can be
4eea0dc5f071 documenting wsi
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 52
diff changeset
222 DICOM-ized as well. However, whole-slide images can come in many
85
13dd3f20a00a wsi rest api
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 82
diff changeset
223 proprietary file formats. To re-encode such images, the DICOM-izer
13dd3f20a00a wsi rest api
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 82
diff changeset
224 relies upon the `OpenSlide toolbox <http://openslide.org/>`__.
81
4eea0dc5f071 documenting wsi
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 52
diff changeset
225
4eea0dc5f071 documenting wsi
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 52
diff changeset
226 For this feature to work, you have to tell the command-line tool where
4eea0dc5f071 documenting wsi
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 52
diff changeset
227 it can find the OpenSlide shared library. GNU/Linux distributions
4eea0dc5f071 documenting wsi
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 52
diff changeset
228 generally provide packages containing the OpenSlide shared library
85
13dd3f20a00a wsi rest api
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 82
diff changeset
229 (e.g. under Debian/Ubuntu, simply install the ``libopenslide0``
13dd3f20a00a wsi rest api
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 82
diff changeset
230 package)::
81
4eea0dc5f071 documenting wsi
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 52
diff changeset
231
85
13dd3f20a00a wsi rest api
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 82
diff changeset
232 $ ./OrthancWSIDicomizer --openslide=libopenslide.so CMU-1-JP2K-33005.svs
81
4eea0dc5f071 documenting wsi
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 52
diff changeset
233
85
13dd3f20a00a wsi rest api
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 82
diff changeset
234 Pre-compiled Microsoft Windows binaries of this shared library can be
87
f8aa67501041 extra info for libOpenSlide Windows package
Alain Mazy <alain@mazy.be>
parents: 85
diff changeset
235 found on the `OpenSlide homepage <http://openslide.org/download/>`__ (Note that
f8aa67501041 extra info for libOpenSlide Windows package
Alain Mazy <alain@mazy.be>
parents: 85
diff changeset
236 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
237 executable)::
81
4eea0dc5f071 documenting wsi
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 52
diff changeset
238
85
13dd3f20a00a wsi rest api
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 82
diff changeset
239 $ ./OrthancWSIDicomizer --openslide=libopenslide-0.dll CMU-1-JP2K-33005.svs
81
4eea0dc5f071 documenting wsi
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 52
diff changeset
240
4eea0dc5f071 documenting wsi
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 52
diff changeset
241 Note that this operation implies the re-encoding of the source image
4eea0dc5f071 documenting wsi
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 52
diff changeset
242 from the proprietary file format, which is much more time-consuming
4eea0dc5f071 documenting wsi
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 52
diff changeset
243 than simply transcoding a TIFF image.
4eea0dc5f071 documenting wsi
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 52
diff changeset
244
4eea0dc5f071 documenting wsi
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 52
diff changeset
245
4eea0dc5f071 documenting wsi
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 52
diff changeset
246 Specifying a DICOM dataset
4eea0dc5f071 documenting wsi
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 52
diff changeset
247 ^^^^^^^^^^^^^^^^^^^^^^^^^^
4eea0dc5f071 documenting wsi
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 52
diff changeset
248
85
13dd3f20a00a wsi rest api
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 82
diff changeset
249 So far, we have only been discussing the whole-slide image by itself,
13dd3f20a00a wsi rest api
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 82
diff changeset
250 and not the :ref:`medical information <dicom-tags>` that is associated
13dd3f20a00a wsi rest api
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 82
diff changeset
251 with each DICOM file. The DICOM tags that must be embedded inside the
13dd3f20a00a wsi rest api
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 82
diff changeset
252 generated DICOM series can be specified using the user-friendly JSON
13dd3f20a00a wsi rest api
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 82
diff changeset
253 file format. You would first generate a minimal, sample JSON dataset
13dd3f20a00a wsi rest api
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 82
diff changeset
254 as follows::
13dd3f20a00a wsi rest api
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 82
diff changeset
255
13dd3f20a00a wsi rest api
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 82
diff changeset
256 $ ./OrthancWSIDicomizer --sample-dataset > dataset.json
13dd3f20a00a wsi rest api
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 82
diff changeset
257
13dd3f20a00a wsi rest api
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 82
diff changeset
258 Secondly, you would edit the just-generated ``dataset.json`` file
13dd3f20a00a wsi rest api
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 82
diff changeset
259 using any text editor (or any script interfaced with your RIS), so as
13dd3f20a00a wsi rest api
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 82
diff changeset
260 to encode medical information associated with the image
13dd3f20a00a wsi rest api
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 82
diff changeset
261 acquisition. Finally, tell the DICOM-izer where it can find the
13dd3f20a00a wsi rest api
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 82
diff changeset
262 dataset when re-encoding or transcoding the image::
13dd3f20a00a wsi rest api
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 82
diff changeset
263
13dd3f20a00a wsi rest api
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 82
diff changeset
264 $ ./OrthancWSIDicomizer Source.tif --dataset=dataset.json
13dd3f20a00a wsi rest api
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 82
diff changeset
265
13dd3f20a00a wsi rest api
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 82
diff changeset
266 Note that it is always a good idea to check whether all the required
13dd3f20a00a wsi rest api
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 82
diff changeset
267 DICOM tags have been properly provided, e.g. by running the
13dd3f20a00a wsi rest api
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 82
diff changeset
268 ``dciodvfy`` command-line tool provided by `David Clunie
13dd3f20a00a wsi rest api
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 82
diff changeset
269 <http://www.dclunie.com/dicom3tools.html>`__ that checks the
13dd3f20a00a wsi rest api
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 82
diff changeset
270 compliance of DICOM files.
13dd3f20a00a wsi rest api
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 82
diff changeset
271
81
4eea0dc5f071 documenting wsi
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 52
diff changeset
272
4eea0dc5f071 documenting wsi
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 52
diff changeset
273 Converting DICOM to TIFF
4eea0dc5f071 documenting wsi
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 52
diff changeset
274 ^^^^^^^^^^^^^^^^^^^^^^^^
4eea0dc5f071 documenting wsi
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 52
diff changeset
275
85
13dd3f20a00a wsi rest api
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 82
diff changeset
276 The whole-slide imaging framework for Orthanc also provides a
13dd3f20a00a wsi rest api
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 82
diff changeset
277 command-line tool that converts some DICOM series, as a standard
13dd3f20a00a wsi rest api
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 82
diff changeset
278 hierarchical, tiled TIFF image. This is important if you wish to
13dd3f20a00a wsi rest api
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 82
diff changeset
279 export some DICOM file to a framework that does not support DICOM
13dd3f20a00a wsi rest api
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 82
diff changeset
280 Supplement 145.
13dd3f20a00a wsi rest api
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 82
diff changeset
281
13dd3f20a00a wsi rest api
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 82
diff changeset
282 Here is how you would convert a whole-slide image stored in the
13dd3f20a00a wsi rest api
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 82
diff changeset
283 default Orthanc server::
13dd3f20a00a wsi rest api
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 82
diff changeset
284
13dd3f20a00a wsi rest api
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 82
diff changeset
285 $ ./OrthancWSIDicomToTiff fdf53e42-06d7377a-c24c59fd-3704e72d-f4c75b68 Target.tif
13dd3f20a00a wsi rest api
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 82
diff changeset
286
13dd3f20a00a wsi rest api
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 82
diff changeset
287 You just have to provide the :ref:`Orthanc identifier <orthanc-ids>`
13dd3f20a00a wsi rest api
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 82
diff changeset
288 of the series of interest (that can be retrieved using :ref:`Orthanc
13dd3f20a00a wsi rest api
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 82
diff changeset
289 Explorer <orthanc-explorer>` or the :ref:`REST API <rest>`), and the
13dd3f20a00a wsi rest api
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 82
diff changeset
290 path to the target TIFF file.
13dd3f20a00a wsi rest api
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 82
diff changeset
291
13dd3f20a00a wsi rest api
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 82
diff changeset
292 Similarly to the DICOM-izer, the command-line options ``--orthanc``,
13dd3f20a00a wsi rest api
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 82
diff changeset
293 ``--username`` and ``--password`` can be used to specify the
13dd3f20a00a wsi rest api
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 82
diff changeset
294 parameters of your Orthanc server.
13dd3f20a00a wsi rest api
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 82
diff changeset
295
81
4eea0dc5f071 documenting wsi
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 52
diff changeset
296
4eea0dc5f071 documenting wsi
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 52
diff changeset
297 REST API
4eea0dc5f071 documenting wsi
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 52
diff changeset
298 --------
4eea0dc5f071 documenting wsi
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 52
diff changeset
299
85
13dd3f20a00a wsi rest api
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 82
diff changeset
300 Besides providing an user interface, the plugin for whole-slide
13dd3f20a00a wsi rest api
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 82
diff changeset
301 imaging also enrich the :ref:`REST API <rest>` of Orthanc with some
13dd3f20a00a wsi rest api
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 82
diff changeset
302 new URIs, that are described in this section.
13dd3f20a00a wsi rest api
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 82
diff changeset
303
13dd3f20a00a wsi rest api
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 82
diff changeset
304 Note that the Web interface of the plugin exclusively relies upon this
13dd3f20a00a wsi rest api
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 82
diff changeset
305 enriched REST API in order to display whole-slide images using the
13dd3f20a00a wsi rest api
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 82
diff changeset
306 `OpenLayers 3 <https://openlayers.org/>`__ JavaScript library.
13dd3f20a00a wsi rest api
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 82
diff changeset
307
13dd3f20a00a wsi rest api
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 82
diff changeset
308
13dd3f20a00a wsi rest api
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 82
diff changeset
309 Information about a whole-slide image
13dd3f20a00a wsi rest api
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 82
diff changeset
310 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
13dd3f20a00a wsi rest api
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 82
diff changeset
311
13dd3f20a00a wsi rest api
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 82
diff changeset
312 You can check whether a DICOM series associated with some known
13dd3f20a00a wsi rest api
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 82
diff changeset
313 :ref:`Orthanc ID <orthanc-ids>` ``id`` corresponds to a whole-slide
13dd3f20a00a wsi rest api
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 82
diff changeset
314 image by calling the ``/wsi/pyramids/{id}`` URI. A HTTP status code
13dd3f20a00a wsi rest api
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 82
diff changeset
315 404 is returned if the series is *not* a whole-slide image::
13dd3f20a00a wsi rest api
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 82
diff changeset
316
13dd3f20a00a wsi rest api
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 82
diff changeset
317 $ curl -v http://localhost:8042/wsi/pyramids/ca2cc2ef-2dd8be12-0a4506ae-d565b7e1-a4ca9068
13dd3f20a00a wsi rest api
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 82
diff changeset
318 [...]
13dd3f20a00a wsi rest api
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 82
diff changeset
319 < HTTP/1.1 404 Not Found
13dd3f20a00a wsi rest api
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 82
diff changeset
320
13dd3f20a00a wsi rest api
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 82
diff changeset
321 However, if the identifier corresponds to a valid whole-slide image,
13dd3f20a00a wsi rest api
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 82
diff changeset
322 you will get information about its multi-resolution pyramid, formatted
13dd3f20a00a wsi rest api
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 82
diff changeset
323 using JSON::
13dd3f20a00a wsi rest api
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 82
diff changeset
324
13dd3f20a00a wsi rest api
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 82
diff changeset
325 $ curl http://localhost:8042/wsi/pyramids/f0ed5846-2ce36a70-d27bb5d3-6ed9dac2-ee638d85
13dd3f20a00a wsi rest api
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 82
diff changeset
326 {
13dd3f20a00a wsi rest api
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 82
diff changeset
327 "ID" : "f0ed5846-2ce36a70-d27bb5d3-6ed9dac2-ee638d85",
13dd3f20a00a wsi rest api
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 82
diff changeset
328 "Resolutions" : [ 1, 2, 4, 8, 16 ],
13dd3f20a00a wsi rest api
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 82
diff changeset
329 "Sizes" : [
13dd3f20a00a wsi rest api
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 82
diff changeset
330 [ 10800, 5400 ],
13dd3f20a00a wsi rest api
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 82
diff changeset
331 [ 5400, 2700 ],
13dd3f20a00a wsi rest api
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 82
diff changeset
332 [ 2700, 1350 ],
13dd3f20a00a wsi rest api
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 82
diff changeset
333 [ 1350, 675 ],
13dd3f20a00a wsi rest api
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 82
diff changeset
334 [ 675, 338 ]
13dd3f20a00a wsi rest api
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 82
diff changeset
335 ],
13dd3f20a00a wsi rest api
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 82
diff changeset
336 "TileHeight" : 512,
13dd3f20a00a wsi rest api
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 82
diff changeset
337 "TileWidth" : 512,
13dd3f20a00a wsi rest api
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 82
diff changeset
338 "TilesCount" : [
13dd3f20a00a wsi rest api
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 82
diff changeset
339 [ 22, 11 ],
13dd3f20a00a wsi rest api
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 82
diff changeset
340 [ 11, 6 ],
13dd3f20a00a wsi rest api
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 82
diff changeset
341 [ 6, 3 ],
13dd3f20a00a wsi rest api
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 82
diff changeset
342 [ 3, 2 ],
13dd3f20a00a wsi rest api
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 82
diff changeset
343 [ 2, 1 ]
13dd3f20a00a wsi rest api
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 82
diff changeset
344 ],
13dd3f20a00a wsi rest api
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 82
diff changeset
345 "TotalHeight" : 5400,
13dd3f20a00a wsi rest api
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 82
diff changeset
346 "TotalWidth" : 10800
13dd3f20a00a wsi rest api
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 82
diff changeset
347 }
13dd3f20a00a wsi rest api
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 82
diff changeset
348
13dd3f20a00a wsi rest api
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 82
diff changeset
349 The size of the finest level of the pyramid is verbatim available from
13dd3f20a00a wsi rest api
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 82
diff changeset
350 this output (in the example above, ``10,800 x 5,400`` pixels), as well
13dd3f20a00a wsi rest api
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 82
diff changeset
351 as the size of each individual tile (``512 x 512`` pixels). The
13dd3f20a00a wsi rest api
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 82
diff changeset
352 ``TilesCount`` gives, for each level of the pyramid (sorted in
13dd3f20a00a wsi rest api
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 82
diff changeset
353 decreasing resolutions), the number of tiles along each dimension: In
13dd3f20a00a wsi rest api
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 82
diff changeset
354 the example above, the coarsest level contains 2 tiles along the X
13dd3f20a00a wsi rest api
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 82
diff changeset
355 axis, and 1 tile along the Y.
13dd3f20a00a wsi rest api
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 82
diff changeset
356
13dd3f20a00a wsi rest api
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 82
diff changeset
357 Note that the interpretation of the whole-slide image is done
13dd3f20a00a wsi rest api
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 82
diff changeset
358 transparently by the plugin, which frees the user from parsing each
13dd3f20a00a wsi rest api
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 82
diff changeset
359 and every DICOM instance in the series.
13dd3f20a00a wsi rest api
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 82
diff changeset
360
13dd3f20a00a wsi rest api
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 82
diff changeset
361 The medical information associated with the series or its instances
13dd3f20a00a wsi rest api
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 82
diff changeset
362 can as usual be retrieved using the core :ref:`REST API <rest>` of
13dd3f20a00a wsi rest api
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 82
diff changeset
363 Orthanc.
13dd3f20a00a wsi rest api
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 82
diff changeset
364
13dd3f20a00a wsi rest api
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 82
diff changeset
365
13dd3f20a00a wsi rest api
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 82
diff changeset
366 Decoding the individual tiles
13dd3f20a00a wsi rest api
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 82
diff changeset
367 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
13dd3f20a00a wsi rest api
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 82
diff changeset
368
13dd3f20a00a wsi rest api
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 82
diff changeset
369 As discussed above, the ``/wsi/pyramids/{id}`` gives information about
13dd3f20a00a wsi rest api
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 82
diff changeset
370 the number of tiles in each level of the multi-resolution pyramid
13dd3f20a00a wsi rest api
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 82
diff changeset
371 associated with series ``id``.
13dd3f20a00a wsi rest api
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 82
diff changeset
372
13dd3f20a00a wsi rest api
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 82
diff changeset
373 You can then retrieve the individual tiles of each level using the
13dd3f20a00a wsi rest api
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 82
diff changeset
374 ``/wsi/tiles/{id}/{z}/{x}/{y}`` URI, where ``z`` corresponds to the
13dd3f20a00a wsi rest api
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 82
diff changeset
375 level of interest, and (``x``, ``y``) the index of the tile of
13dd3f20a00a wsi rest api
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 82
diff changeset
376 interest at this level. All of these indices start at zero, the level
13dd3f20a00a wsi rest api
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 82
diff changeset
377 ``z=0`` corresponding to the finest level.
13dd3f20a00a wsi rest api
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 82
diff changeset
378
13dd3f20a00a wsi rest api
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 82
diff changeset
379 For instance, here is how to retrieve the central tile of the finest
13dd3f20a00a wsi rest api
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 82
diff changeset
380 level of the pyramid (that contains ``22 x 11`` tiles in our example)::
13dd3f20a00a wsi rest api
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 82
diff changeset
381
13dd3f20a00a wsi rest api
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 82
diff changeset
382 $ curl http://localhost:8042/wsi/tiles/f0ed5846-2ce36a70-d27bb5d3-6ed9dac2-ee638d85/0/11/5 > tile.jpg
13dd3f20a00a wsi rest api
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 82
diff changeset
383 $ identify ./tile.jpg
13dd3f20a00a wsi rest api
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 82
diff changeset
384 ./tile.jpg JPEG 512x512 512x512+0+0 8-bit DirectClass 88.5KB 0.000u 0:00.000
13dd3f20a00a wsi rest api
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 82
diff changeset
385
13dd3f20a00a wsi rest api
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 82
diff changeset
386 As can be seen, the plugin has returned a JPEG image of size ``512 x
13dd3f20a00a wsi rest api
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 82
diff changeset
387 512``, which corresponds to the size of the tiles in this sample
13dd3f20a00a wsi rest api
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 82
diff changeset
388 image. If trying to access a tile outside the image, the plugin will
13dd3f20a00a wsi rest api
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 82
diff changeset
389 return with an HTTP status code that is not ``200 OK``. Similarly,
13dd3f20a00a wsi rest api
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 82
diff changeset
390 here is how to retrieve a tile at the coarsest level (the pyramid has
13dd3f20a00a wsi rest api
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 82
diff changeset
391 5 levels in our example)::
13dd3f20a00a wsi rest api
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 82
diff changeset
392
13dd3f20a00a wsi rest api
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 82
diff changeset
393 $ curl http://localhost:8042/wsi/tiles/f0ed5846-2ce36a70-d27bb5d3-6ed9dac2-ee638d85/4/0/0 > tile.jpg
13dd3f20a00a wsi rest api
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 82
diff changeset
394
13dd3f20a00a wsi rest api
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 82
diff changeset
395 Depending upon the transfer syntax of the DICOM instances, the tile
13dd3f20a00a wsi rest api
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 82
diff changeset
396 might not be encoded using JPEG. Indeed, if the transfer syntax is
13dd3f20a00a wsi rest api
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 82
diff changeset
397 uncompressed (UID ``1.2.840.10008.1.2`` and friends) or JPEG2k
13dd3f20a00a wsi rest api
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 82
diff changeset
398 lossless (UID ``1.2.840.10008.1.2.4.90``), the plugin will
13dd3f20a00a wsi rest api
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 82
diff changeset
399 transparently re-encode the tile to PNG in order to avoid any
13dd3f20a00a wsi rest api
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 82
diff changeset
400 destructive compression.