annotate Sphinx/source/plugins/stl.rst @ 1057:5a3c238575f8

documentation of stl
author Sebastien Jodogne <s.jodogne@gmail.com>
date Tue, 09 Apr 2024 16:29:42 +0200
parents 89bb195dfbc0
children 30c90ac3e3d6
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
1052
ed64444eb542 preparing stl
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1 .. _stl-plugin:
ed64444eb542 preparing stl
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2
ed64444eb542 preparing stl
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3
1053
600547006d14 added STL_PLUGIN_ENABLED
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1052
diff changeset
4 STL plugin for Orthanc
600547006d14 added STL_PLUGIN_ENABLED
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1052
diff changeset
5 ======================
1052
ed64444eb542 preparing stl
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6
ed64444eb542 preparing stl
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7 .. contents::
ed64444eb542 preparing stl
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8
ed64444eb542 preparing stl
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
9
ed64444eb542 preparing stl
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
10 Overview
ed64444eb542 preparing stl
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
11 --------
ed64444eb542 preparing stl
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
12
1056
89bb195dfbc0 starting stl documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1055
diff changeset
13 This **official** plugin by the `ICTEAM institute of UCLouvain
89bb195dfbc0 starting stl documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1055
diff changeset
14 <https://orthanc.uclouvain.be/>`__ extends Orthanc with support for
89bb195dfbc0 starting stl documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1055
diff changeset
15 `Encapsulated 3D Manufacturing Model IODs
1057
5a3c238575f8 documentation of stl
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1056
diff changeset
16 <https://dicom.nema.org/medical/dicom/current/output/chtml/part03/sect_A.85.html>`_.
5a3c238575f8 documentation of stl
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1056
diff changeset
17 As of release 1.0 of the plugin, this support is limited to `STL files
1056
89bb195dfbc0 starting stl documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1055
diff changeset
18 <https://en.wikipedia.org/wiki/STL_(file_format)>`__.
89bb195dfbc0 starting stl documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1055
diff changeset
19
89bb195dfbc0 starting stl documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1055
diff changeset
20 The plugin allows to attach STL files to existing DICOM studies and to
89bb195dfbc0 starting stl documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1055
diff changeset
21 generate a STL mesh from structure sets (i.e., DICOM RT-STRUCT) or
89bb195dfbc0 starting stl documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1055
diff changeset
22 from `NIfTI binary volumes
89bb195dfbc0 starting stl documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1055
diff changeset
23 <https://en.wikipedia.org/wiki/Neuroimaging_Informatics_Technology_Initiative>`__.
1057
5a3c238575f8 documentation of stl
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1056
diff changeset
24 A high-level description of these features is `available as a paper
1056
89bb195dfbc0 starting stl documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1055
diff changeset
25 <https://doi.org/10.1145/3632047.3632051>`__.
1055
ebe3214f3ab0 added citation instructions
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1053
diff changeset
26
1057
5a3c238575f8 documentation of stl
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1056
diff changeset
27 Importantly, any creation of a STL file requires the version of
5a3c238575f8 documentation of stl
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1056
diff changeset
28 Orthanc to be above or equal to 1.12.1.
5a3c238575f8 documentation of stl
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1056
diff changeset
29
1055
ebe3214f3ab0 added citation instructions
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1053
diff changeset
30 **For researchers**: `Please cite this paper
ebe3214f3ab0 added citation instructions
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1053
diff changeset
31 <https://doi.org/10.1145/3632047.3632051>`__.
1056
89bb195dfbc0 starting stl documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1055
diff changeset
32
89bb195dfbc0 starting stl documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1055
diff changeset
33
1057
5a3c238575f8 documentation of stl
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1056
diff changeset
34 Compilation
5a3c238575f8 documentation of stl
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1056
diff changeset
35 -----------
5a3c238575f8 documentation of stl
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1056
diff changeset
36
5a3c238575f8 documentation of stl
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1056
diff changeset
37 .. highlight:: bash
5a3c238575f8 documentation of stl
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1056
diff changeset
38
5a3c238575f8 documentation of stl
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1056
diff changeset
39 Official releases can be `downloaded from the Orthanc homepage
5a3c238575f8 documentation of stl
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1056
diff changeset
40 <https://orthanc.uclouvain.be/downloads/sources/orthanc-stl/index.html>`__. As
5a3c238575f8 documentation of stl
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1056
diff changeset
41 an alternative, the `repository containing the source code
5a3c238575f8 documentation of stl
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1056
diff changeset
42 <https://orthanc.uclouvain.be/hg/orthanc-stl/>`__ can be accessed
5a3c238575f8 documentation of stl
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1056
diff changeset
43 using Mercurial.
5a3c238575f8 documentation of stl
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1056
diff changeset
44
5a3c238575f8 documentation of stl
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1056
diff changeset
45 The procedure to compile this plugin is similar of that for the
5a3c238575f8 documentation of stl
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1056
diff changeset
46 :ref:`core of Orthanc <binaries>`. The following commands should work
5a3c238575f8 documentation of stl
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1056
diff changeset
47 on most GNU/Linux distributions, provided Docker is installed::
5a3c238575f8 documentation of stl
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1056
diff changeset
48
5a3c238575f8 documentation of stl
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1056
diff changeset
49 $ mkdir Build
5a3c238575f8 documentation of stl
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1056
diff changeset
50 $ cd Build
5a3c238575f8 documentation of stl
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1056
diff changeset
51 $ ../Resources/CreateJavaScriptLibraries.sh
5a3c238575f8 documentation of stl
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1056
diff changeset
52 $ cmake .. -DSTATIC_BUILD=ON -DCMAKE_BUILD_TYPE=Release
5a3c238575f8 documentation of stl
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1056
diff changeset
53 $ make
5a3c238575f8 documentation of stl
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1056
diff changeset
54
5a3c238575f8 documentation of stl
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1056
diff changeset
55 The compilation will produce a shared library ``libOrthancSTL.so``
5a3c238575f8 documentation of stl
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1056
diff changeset
56 that contains the STL plugin for Orthanc.
5a3c238575f8 documentation of stl
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1056
diff changeset
57
5a3c238575f8 documentation of stl
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1056
diff changeset
58 Pre-compiled Linux Standard Base (LSB) binaries `are available for
5a3c238575f8 documentation of stl
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1056
diff changeset
59 download <https://orthanc.uclouvain.be/downloads/linux-standard-base/orthanc-stl/index.html>`__.
5a3c238575f8 documentation of stl
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1056
diff changeset
60
5a3c238575f8 documentation of stl
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1056
diff changeset
61 Pre-compiled binaries for `Microsoft Windows <https://orthanc.uclouvain.be/downloads/windows-32/orthanc-stl/index.html>`__
5a3c238575f8 documentation of stl
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1056
diff changeset
62 and `macOS <https://orthanc.uclouvain.be/downloads/macos/orthanc-stl/index.html>`__ are available as well.
5a3c238575f8 documentation of stl
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1056
diff changeset
63
5a3c238575f8 documentation of stl
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1056
diff changeset
64 Furthermore, the :ref:`Docker images <docker>`
5a3c238575f8 documentation of stl
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1056
diff changeset
65 ``jodogne/orthanc-plugins`` and ``orthancteam/orthanc`` also contain the
5a3c238575f8 documentation of stl
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1056
diff changeset
66 plugin. Debian and Ubuntu packages can be found in the
5a3c238575f8 documentation of stl
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1056
diff changeset
67 :ref:`standalone repository <binaries>`
5a3c238575f8 documentation of stl
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1056
diff changeset
68 ``https://debian.orthanc-labs.com/``.
5a3c238575f8 documentation of stl
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1056
diff changeset
69
5a3c238575f8 documentation of stl
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1056
diff changeset
70
5a3c238575f8 documentation of stl
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1056
diff changeset
71 .. _stl_orthanc_explorer:
5a3c238575f8 documentation of stl
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1056
diff changeset
72
5a3c238575f8 documentation of stl
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1056
diff changeset
73 Usage using Orthanc Explorer
5a3c238575f8 documentation of stl
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1056
diff changeset
74 ----------------------------
5a3c238575f8 documentation of stl
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1056
diff changeset
75
5a3c238575f8 documentation of stl
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1056
diff changeset
76 The plugin extends the default :ref:`Orthanc Explorer
5a3c238575f8 documentation of stl
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1056
diff changeset
77 <orthanc-explorer>` Web interface with some new features.
5a3c238575f8 documentation of stl
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1056
diff changeset
78
5a3c238575f8 documentation of stl
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1056
diff changeset
79
5a3c238575f8 documentation of stl
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1056
diff changeset
80 .. _stl_attach:
5a3c238575f8 documentation of stl
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1056
diff changeset
81
5a3c238575f8 documentation of stl
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1056
diff changeset
82 Attach STL file
5a3c238575f8 documentation of stl
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1056
diff changeset
83 ^^^^^^^^^^^^^^^
5a3c238575f8 documentation of stl
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1056
diff changeset
84
5a3c238575f8 documentation of stl
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1056
diff changeset
85 An existing STL file can be attached to an existing DICOM study by
5a3c238575f8 documentation of stl
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1056
diff changeset
86 clicking on the "*Attach STL model*" yellow button:
5a3c238575f8 documentation of stl
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1056
diff changeset
87
5a3c238575f8 documentation of stl
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1056
diff changeset
88 .. image:: stl/attach.png
5a3c238575f8 documentation of stl
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1056
diff changeset
89 :align: center
5a3c238575f8 documentation of stl
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1056
diff changeset
90 :width: 480
5a3c238575f8 documentation of stl
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1056
diff changeset
91
5a3c238575f8 documentation of stl
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1056
diff changeset
92 After selecting the STL file, entering a series description, and
5a3c238575f8 documentation of stl
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1056
diff changeset
93 clicking on the "*Import*" button, Orthanc creates a new DICOM
5a3c238575f8 documentation of stl
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1056
diff changeset
94 instance that embeds the STL file. Orthanc Explorer then automatically
5a3c238575f8 documentation of stl
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1056
diff changeset
95 opens the parent DICOM series containing the newly created DICOM STL
5a3c238575f8 documentation of stl
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1056
diff changeset
96 instance. A button entitled "*STL viewer*" can then be used to render
5a3c238575f8 documentation of stl
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1056
diff changeset
97 the STL:
5a3c238575f8 documentation of stl
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1056
diff changeset
98
5a3c238575f8 documentation of stl
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1056
diff changeset
99 .. image:: stl/viewers.png
5a3c238575f8 documentation of stl
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1056
diff changeset
100 :align: center
5a3c238575f8 documentation of stl
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1056
diff changeset
101 :width: 480
5a3c238575f8 documentation of stl
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1056
diff changeset
102
5a3c238575f8 documentation of stl
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1056
diff changeset
103 Note how the STL plugin provides two viewers:
5a3c238575f8 documentation of stl
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1056
diff changeset
104
5a3c238575f8 documentation of stl
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1056
diff changeset
105 * One `very basic custom viewer
5a3c238575f8 documentation of stl
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1056
diff changeset
106 <https://orthanc.uclouvain.be/hg/orthanc-stl/file/OrthancSTL-1.0/WebApplications/three.js>`__
5a3c238575f8 documentation of stl
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1056
diff changeset
107 with a small footprint that is directly built using the well-known
5a3c238575f8 documentation of stl
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1056
diff changeset
108 `Three.js library <https://en.wikipedia.org/wiki/Three.js>`__.
5a3c238575f8 documentation of stl
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1056
diff changeset
109
5a3c238575f8 documentation of stl
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1056
diff changeset
110 * One slightly more advanced Web viewer that corresponds to
5a3c238575f8 documentation of stl
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1056
diff changeset
111 `Online3DViewer <https://3dviewer.net/>`__ running in `engine mode
5a3c238575f8 documentation of stl
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1056
diff changeset
112 <https://kovacsv.github.io/Online3DViewer/Page_Usage.html>`__.
5a3c238575f8 documentation of stl
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1056
diff changeset
113
5a3c238575f8 documentation of stl
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1056
diff changeset
114 Here is a screenshot of a rendering using the Online3DViewer embedded
5a3c238575f8 documentation of stl
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1056
diff changeset
115 viewer:
5a3c238575f8 documentation of stl
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1056
diff changeset
116
5a3c238575f8 documentation of stl
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1056
diff changeset
117 .. image:: stl/o3dv.png
5a3c238575f8 documentation of stl
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1056
diff changeset
118 :align: center
5a3c238575f8 documentation of stl
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1056
diff changeset
119 :width: 480
5a3c238575f8 documentation of stl
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1056
diff changeset
120
5a3c238575f8 documentation of stl
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1056
diff changeset
121
5a3c238575f8 documentation of stl
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1056
diff changeset
122 .. _stl_rt_struct:
5a3c238575f8 documentation of stl
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1056
diff changeset
123
5a3c238575f8 documentation of stl
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1056
diff changeset
124 Create STL from RT-STRUCT
5a3c238575f8 documentation of stl
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1056
diff changeset
125 ^^^^^^^^^^^^^^^^^^^^^^^^^
5a3c238575f8 documentation of stl
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1056
diff changeset
126
5a3c238575f8 documentation of stl
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1056
diff changeset
127 The plugin can also be used to create a STL model from DICOM structure
5a3c238575f8 documentation of stl
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1056
diff changeset
128 sets (RT-STRUCT) that are routinely used in the context of
5a3c238575f8 documentation of stl
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1056
diff changeset
129 radiotherapy and nuclear medicine. To this end, open a DICOM RT-STRUCT
5a3c238575f8 documentation of stl
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1056
diff changeset
130 series using Orthanc Explorer:
5a3c238575f8 documentation of stl
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1056
diff changeset
131
5a3c238575f8 documentation of stl
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1056
diff changeset
132 .. image:: stl/rt-struct.png
5a3c238575f8 documentation of stl
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1056
diff changeset
133 :align: center
5a3c238575f8 documentation of stl
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1056
diff changeset
134 :width: 480
5a3c238575f8 documentation of stl
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1056
diff changeset
135
5a3c238575f8 documentation of stl
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1056
diff changeset
136 As can be seen in this screenshot, an interface opens to choose the
5a3c238575f8 documentation of stl
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1056
diff changeset
137 structure set of interest, as well as the resolution of the
5a3c238575f8 documentation of stl
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1056
diff changeset
138 intermediate 3D bitmap that will be used to create the STL mesh. After
5a3c238575f8 documentation of stl
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1056
diff changeset
139 clicking on the "*Generate*" button, just like if :ref:`attaching an
5a3c238575f8 documentation of stl
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1056
diff changeset
140 existing STL file <stl_attach>`, Orthanc Explorer will open the newly
5a3c238575f8 documentation of stl
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1056
diff changeset
141 created DICOM series and will propose to open a STL viewer.
5a3c238575f8 documentation of stl
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1056
diff changeset
142
5a3c238575f8 documentation of stl
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1056
diff changeset
143 Internally, the 3D model is generated using the well-known `marching
5a3c238575f8 documentation of stl
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1056
diff changeset
144 cubes algorithm <https://en.wikipedia.org/wiki/Marching_cubes>`__, as
5a3c238575f8 documentation of stl
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1056
diff changeset
145 implemented by the `VTK library <https://en.wikipedia.org/wiki/VTK>`__
5a3c238575f8 documentation of stl
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1056
diff changeset
146 by Kitware. Additional technical details can be found in the
5a3c238575f8 documentation of stl
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1056
diff changeset
147 `reference paper <https://doi.org/10.1145/3632047.3632051>`__.
5a3c238575f8 documentation of stl
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1056
diff changeset
148
1056
89bb195dfbc0 starting stl documentation
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1055
diff changeset
149
1057
5a3c238575f8 documentation of stl
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1056
diff changeset
150 Create STL from binary NIfTI
5a3c238575f8 documentation of stl
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1056
diff changeset
151 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
5a3c238575f8 documentation of stl
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1056
diff changeset
152
5a3c238575f8 documentation of stl
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1056
diff changeset
153 .. highlight:: json
5a3c238575f8 documentation of stl
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1056
diff changeset
154
5a3c238575f8 documentation of stl
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1056
diff changeset
155 Besides converting :ref:`RT-STRUCT to STL <stl_rt_struct>`, it is also
5a3c238575f8 documentation of stl
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1056
diff changeset
156 possible to convert a `NIfTI
5a3c238575f8 documentation of stl
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1056
diff changeset
157 <https://en.wikipedia.org/wiki/Neuroimaging_Informatics_Technology_Initiative>`__
5a3c238575f8 documentation of stl
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1056
diff changeset
158 3D binary bitmap into a STL mesh. As this use case is very specific,
5a3c238575f8 documentation of stl
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1056
diff changeset
159 it must be explicitly enabled in the :ref:`configuration file of
5a3c238575f8 documentation of stl
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1056
diff changeset
160 Orthanc <configuration>` as follows::
5a3c238575f8 documentation of stl
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1056
diff changeset
161
5a3c238575f8 documentation of stl
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1056
diff changeset
162 {
5a3c238575f8 documentation of stl
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1056
diff changeset
163 "Plugins" : [ "libOrthancSTL.so" ],
5a3c238575f8 documentation of stl
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1056
diff changeset
164 "STL" : {
5a3c238575f8 documentation of stl
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1056
diff changeset
165 "EnableNIfTI" : true
5a3c238575f8 documentation of stl
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1056
diff changeset
166 }
5a3c238575f8 documentation of stl
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1056
diff changeset
167 }
5a3c238575f8 documentation of stl
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1056
diff changeset
168
5a3c238575f8 documentation of stl
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1056
diff changeset
169 If the ``EnableNIfTI`` option is present, a new button entitled
5a3c238575f8 documentation of stl
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1056
diff changeset
170 "*Attach NIfTI 3D model*" appears if opening an existing DICOM study:
5a3c238575f8 documentation of stl
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1056
diff changeset
171
5a3c238575f8 documentation of stl
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1056
diff changeset
172 .. image:: stl/nifti.png
5a3c238575f8 documentation of stl
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1056
diff changeset
173 :align: center
5a3c238575f8 documentation of stl
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1056
diff changeset
174 :width: 480
5a3c238575f8 documentation of stl
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1056
diff changeset
175
5a3c238575f8 documentation of stl
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1056
diff changeset
176 This dialog box can be used to upload a NIfTI volume, and to generate
5a3c238575f8 documentation of stl
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1056
diff changeset
177 a 3D mesh with a specific resolution through the marching cubes
5a3c238575f8 documentation of stl
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1056
diff changeset
178 algorithm.
5a3c238575f8 documentation of stl
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1056
diff changeset
179
5a3c238575f8 documentation of stl
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1056
diff changeset
180
5a3c238575f8 documentation of stl
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1056
diff changeset
181 REST API
5a3c238575f8 documentation of stl
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1056
diff changeset
182 --------
5a3c238575f8 documentation of stl
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1056
diff changeset
183
5a3c238575f8 documentation of stl
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1056
diff changeset
184 Besides :ref:`extending the Orthanc Explorer user interface
5a3c238575f8 documentation of stl
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1056
diff changeset
185 <stl_orthanc_explorer>`, the STL plugin adds dedicated routes to the
5a3c238575f8 documentation of stl
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1056
diff changeset
186 REST API of Orthanc.
5a3c238575f8 documentation of stl
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1056
diff changeset
187
5a3c238575f8 documentation of stl
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1056
diff changeset
188
5a3c238575f8 documentation of stl
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1056
diff changeset
189 DICOM-ization of STL files
5a3c238575f8 documentation of stl
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1056
diff changeset
190 ^^^^^^^^^^^^^^^^^^^^^^^^^^
5a3c238575f8 documentation of stl
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1056
diff changeset
191
5a3c238575f8 documentation of stl
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1056
diff changeset
192 The creation of a DICOM instance that embeds an existing STL file can
5a3c238575f8 documentation of stl
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1056
diff changeset
193 be done using the ``/tools/create-dicom`` `route
5a3c238575f8 documentation of stl
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1056
diff changeset
194 <https://orthanc.uclouvain.be/api/#tag/System/paths/~1tools~1create-dicom/post>`__
5a3c238575f8 documentation of stl
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1056
diff changeset
195 in the built-in REST API of Orthanc (starting with version
5a3c238575f8 documentation of stl
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1056
diff changeset
196 1.12.1). This route can be used similarly to the :ref:`DICOM-ization
5a3c238575f8 documentation of stl
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1056
diff changeset
197 of PDF files <pdf>`, with the `data URI scheme
5a3c238575f8 documentation of stl
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1056
diff changeset
198 <https://en.wikipedia.org/wiki/Data_URI_scheme>`__ using ``model/stl``
5a3c238575f8 documentation of stl
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1056
diff changeset
199 instead of ``application/pdf``. Here is a working example in Python 3:
5a3c238575f8 documentation of stl
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1056
diff changeset
200
5a3c238575f8 documentation of stl
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1056
diff changeset
201 .. literalinclude:: stl/dicomize.py
5a3c238575f8 documentation of stl
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1056
diff changeset
202 :language: python
5a3c238575f8 documentation of stl
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1056
diff changeset
203
5a3c238575f8 documentation of stl
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1056
diff changeset
204 Note that if the ``Parent`` field is not provided, a new DICOM study
5a3c238575f8 documentation of stl
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1056
diff changeset
205 will be created.
5a3c238575f8 documentation of stl
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1056
diff changeset
206
5a3c238575f8 documentation of stl
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1056
diff changeset
207
5a3c238575f8 documentation of stl
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1056
diff changeset
208 Extraction of STL from DICOM
5a3c238575f8 documentation of stl
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1056
diff changeset
209 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
5a3c238575f8 documentation of stl
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1056
diff changeset
210
5a3c238575f8 documentation of stl
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1056
diff changeset
211 .. highlight:: txt
5a3c238575f8 documentation of stl
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1056
diff changeset
212
5a3c238575f8 documentation of stl
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1056
diff changeset
213 The route ``/instances/{id}/stl`` can be used to extract a STL from a
5a3c238575f8 documentation of stl
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1056
diff changeset
214 DICOM instance embedding a STL file, where ``id`` is the :ref:`Orthanc
5a3c238575f8 documentation of stl
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1056
diff changeset
215 identifier <orthanc-ids>` of the DICOM instance. For instance::
5a3c238575f8 documentation of stl
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1056
diff changeset
216
5a3c238575f8 documentation of stl
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1056
diff changeset
217 $ curl http://localhost:8042/instances/a88c4c3f-8f2bd6fd-02080bed-92ab6817-2cb3c26e/stl > /tmp/liver.stl
5a3c238575f8 documentation of stl
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1056
diff changeset
218 $ meshlab /tmp/liver.stl
5a3c238575f8 documentation of stl
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1056
diff changeset
219
5a3c238575f8 documentation of stl
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1056
diff changeset
220 Evidently, an error is generated for DICOM instances that do not embed
5a3c238575f8 documentation of stl
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1056
diff changeset
221 a STL file. Note that ``meshlab`` is a well-known desktop application
5a3c238575f8 documentation of stl
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1056
diff changeset
222 to display STL file.
5a3c238575f8 documentation of stl
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1056
diff changeset
223
5a3c238575f8 documentation of stl
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1056
diff changeset
224
5a3c238575f8 documentation of stl
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1056
diff changeset
225 Listing structures of a DICOM RT-STRUCT
5a3c238575f8 documentation of stl
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1056
diff changeset
226 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
5a3c238575f8 documentation of stl
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1056
diff changeset
227
5a3c238575f8 documentation of stl
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1056
diff changeset
228 .. highlight:: txt
5a3c238575f8 documentation of stl
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1056
diff changeset
229
5a3c238575f8 documentation of stl
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1056
diff changeset
230 The STL plugin provides the list of the names of the structures that
5a3c238575f8 documentation of stl
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1056
diff changeset
231 are part of a DICOM RT-STRUCT instance with :ref:`Orthanc identifier
5a3c238575f8 documentation of stl
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1056
diff changeset
232 <orthanc-ids>` ``id`` at route ``/stl/rt-struct/{id}``. For instance::
5a3c238575f8 documentation of stl
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1056
diff changeset
233
5a3c238575f8 documentation of stl
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1056
diff changeset
234 $ curl http://localhost:8042/stl/rt-struct/f0dc2345-8f627774-f66083ae-a14d781e-1187b513
5a3c238575f8 documentation of stl
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1056
diff changeset
235 [
5a3c238575f8 documentation of stl
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1056
diff changeset
236 "Esophagus",
5a3c238575f8 documentation of stl
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1056
diff changeset
237 "Heart",
5a3c238575f8 documentation of stl
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1056
diff changeset
238 "Lung_L",
5a3c238575f8 documentation of stl
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1056
diff changeset
239 "Lung_R",
5a3c238575f8 documentation of stl
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1056
diff changeset
240 "SpinalCord"
5a3c238575f8 documentation of stl
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1056
diff changeset
241 ]
5a3c238575f8 documentation of stl
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1056
diff changeset
242
5a3c238575f8 documentation of stl
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1056
diff changeset
243
5a3c238575f8 documentation of stl
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1056
diff changeset
244 Generating a STL mesh from RT-STRUCT
5a3c238575f8 documentation of stl
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1056
diff changeset
245 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
5a3c238575f8 documentation of stl
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1056
diff changeset
246
5a3c238575f8 documentation of stl
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1056
diff changeset
247 A DICOM RT-STRUCT instance can be converted into a DICOM STL instance
5a3c238575f8 documentation of stl
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1056
diff changeset
248 using the ``/stl/encode-rtstruct`` route provided by the STL plugin.
5a3c238575f8 documentation of stl
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1056
diff changeset
249 Here is a sample Python script:
5a3c238575f8 documentation of stl
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1056
diff changeset
250
5a3c238575f8 documentation of stl
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1056
diff changeset
251 .. literalinclude:: stl/rt-struct.py
5a3c238575f8 documentation of stl
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1056
diff changeset
252 :language: python
5a3c238575f8 documentation of stl
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1056
diff changeset
253
5a3c238575f8 documentation of stl
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1056
diff changeset
254 Note that contrarily to :ref:`the default user interface
5a3c238575f8 documentation of stl
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1056
diff changeset
255 <stl_rt_struct>`, this route can be used to encode multiple structure
5a3c238575f8 documentation of stl
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1056
diff changeset
256 sets as a single STL model.
5a3c238575f8 documentation of stl
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1056
diff changeset
257
5a3c238575f8 documentation of stl
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1056
diff changeset
258
5a3c238575f8 documentation of stl
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1056
diff changeset
259 Generating a STL mesh from NIfTI
5a3c238575f8 documentation of stl
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1056
diff changeset
260 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
5a3c238575f8 documentation of stl
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1056
diff changeset
261
5a3c238575f8 documentation of stl
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1056
diff changeset
262 Here is a sample Python 3 script to convert a NIfTI file as a DICOM
5a3c238575f8 documentation of stl
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1056
diff changeset
263 STL instance:
5a3c238575f8 documentation of stl
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1056
diff changeset
264
5a3c238575f8 documentation of stl
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1056
diff changeset
265 .. literalinclude:: stl/nifti.py
5a3c238575f8 documentation of stl
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1056
diff changeset
266 :language: python