annotate Sphinx/source/developers/implementation-notes.rst @ 884:6316d139b4a9

typos
author Alain Mazy <am@osimis.io>
date Fri, 21 Oct 2022 16:35:56 +0200
parents a976607e46f7
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
73
c742c8f9ffa3 encodings
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1 .. _implementation-notes:
c742c8f9ffa3 encodings
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2
c742c8f9ffa3 encodings
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3 Implementation notes
c742c8f9ffa3 encodings
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4 ====================
c742c8f9ffa3 encodings
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5
c742c8f9ffa3 encodings
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6 Encodings
c742c8f9ffa3 encodings
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7 ---------
c742c8f9ffa3 encodings
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8
c742c8f9ffa3 encodings
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
9 DICOM supports many codepages to encode strings. DICOM instances using
c742c8f9ffa3 encodings
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
10 special characters should contain the ``SpecificCharacterSet
c742c8f9ffa3 encodings
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
11 (0008,0005)`` tag. The latter tag `specifies which codepage
c742c8f9ffa3 encodings
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
12 <http://dicom.nema.org/dicom/2013/output/chtml/part03/sect_C.12.html#sect_C.12.1.1.2>`__
c742c8f9ffa3 encodings
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
13 is used by the DICOM instance. Internally, Orthanc converts all these
c742c8f9ffa3 encodings
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
14 codepages to the `UTF-8 encoding
74
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 73
diff changeset
15 <https://en.wikipedia.org/wiki/UTF-8>`__ (cf. the
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 73
diff changeset
16 ``Orthanc::ParsedDicomFile`` class).
73
c742c8f9ffa3 encodings
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
17
c742c8f9ffa3 encodings
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
18 In particular, :ref:`plugins <creating-plugins>` must assume that any
c742c8f9ffa3 encodings
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
19 string or JSON file coming from the Orthanc core is encoded using
c742c8f9ffa3 encodings
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
20 UTF-8. Similarly, plugins must use UTF-8 when calling services
c742c8f9ffa3 encodings
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
21 provided by the Orthanc core. The conversion to/from UTF-8 is done
c742c8f9ffa3 encodings
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
22 transparently by the plugin engine.
c742c8f9ffa3 encodings
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
23
c742c8f9ffa3 encodings
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
24 The :ref:`configuration option <configuration>` ``DefaultEncoding``
c742c8f9ffa3 encodings
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
25 plays an important role. It is used in three cases:
c742c8f9ffa3 encodings
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
26
c742c8f9ffa3 encodings
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
27 1. If receiving a DICOM instance without the ``SpecificCharacterSet
c742c8f9ffa3 encodings
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
28 (0008,0005)`` tag, Orthanc will interpret strings within this
c742c8f9ffa3 encodings
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
29 instance using this default encoding. This is important in
c742c8f9ffa3 encodings
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
30 practice, as many DICOM modalities are not properly configured with
c742c8f9ffa3 encodings
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
31 respect to encodings.
c742c8f9ffa3 encodings
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
32
c742c8f9ffa3 encodings
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
33 2. When answering a :ref:`C-Find query <dicom-find>` (including for
c742c8f9ffa3 encodings
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
34 worklists), Orthanc will use its default encoding. If one single
c742c8f9ffa3 encodings
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
35 answer uses a different encoding, it will be transcoded.
c742c8f9ffa3 encodings
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
36
c742c8f9ffa3 encodings
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
37 3. If creating a new instance (e.g. through the
c742c8f9ffa3 encodings
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
38 ``/tools/create-dicom`` URI of the :ref:`REST API <rest>`, or
c742c8f9ffa3 encodings
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
39 through the ``OrthancPluginCreateDicom()`` primitive of the plugin
c742c8f9ffa3 encodings
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
40 SDK) and if ``SpecificCharacterSet (0008,0005)`` is not provided
c742c8f9ffa3 encodings
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
41 for this instance, Orthanc will use its default encoding. Note
c742c8f9ffa3 encodings
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
42 however that if ``SpecificCharacterSet`` is set, Orthanc will
c742c8f9ffa3 encodings
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
43 transcode the incoming UTF-8 strings to the codepage specified in
c742c8f9ffa3 encodings
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
44 this tag, and not to the default encoding.