annotate Sphinx/source/developers/implementation-notes.rst @ 73:c742c8f9ffa3

encodings
author Sebastien Jodogne <s.jodogne@gmail.com>
date Wed, 14 Dec 2016 09:43:08 +0100
parents
children a976607e46f7
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
c742c8f9ffa3 encodings
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
15 <https://en.wikipedia.org/wiki/UTF-8>`__.
c742c8f9ffa3 encodings
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
16
c742c8f9ffa3 encodings
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
17 In particular, :ref:`plugins <creating-plugins>` must assume that any
c742c8f9ffa3 encodings
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
18 string or JSON file coming from the Orthanc core is encoded using
c742c8f9ffa3 encodings
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
19 UTF-8. Similarly, plugins must use UTF-8 when calling services
c742c8f9ffa3 encodings
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
20 provided by the Orthanc core. The conversion to/from UTF-8 is done
c742c8f9ffa3 encodings
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
21 transparently by the plugin engine.
c742c8f9ffa3 encodings
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
22
c742c8f9ffa3 encodings
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
23 The :ref:`configuration option <configuration>` ``DefaultEncoding``
c742c8f9ffa3 encodings
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
24 plays an important role. It is used in three cases:
c742c8f9ffa3 encodings
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
25
c742c8f9ffa3 encodings
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
26 1. If receiving a DICOM instance without the ``SpecificCharacterSet
c742c8f9ffa3 encodings
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
27 (0008,0005)`` tag, Orthanc will interpret strings within this
c742c8f9ffa3 encodings
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
28 instance using this default encoding. This is important in
c742c8f9ffa3 encodings
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
29 practice, as many DICOM modalities are not properly configured with
c742c8f9ffa3 encodings
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
30 respect to encodings.
c742c8f9ffa3 encodings
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
31
c742c8f9ffa3 encodings
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
32 2. When answering a :ref:`C-Find query <dicom-find>` (including for
c742c8f9ffa3 encodings
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
33 worklists), Orthanc will use its default encoding. If one single
c742c8f9ffa3 encodings
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
34 answer uses a different encoding, it will be transcoded.
c742c8f9ffa3 encodings
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
35
c742c8f9ffa3 encodings
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
36 3. If creating a new instance (e.g. through the
c742c8f9ffa3 encodings
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
37 ``/tools/create-dicom`` URI of the :ref:`REST API <rest>`, or
c742c8f9ffa3 encodings
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
38 through the ``OrthancPluginCreateDicom()`` primitive of the plugin
c742c8f9ffa3 encodings
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
39 SDK) and if ``SpecificCharacterSet (0008,0005)`` is not provided
c742c8f9ffa3 encodings
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
40 for this instance, Orthanc will use its default encoding. Note
c742c8f9ffa3 encodings
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
41 however that if ``SpecificCharacterSet`` is set, Orthanc will
c742c8f9ffa3 encodings
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
42 transcode the incoming UTF-8 strings to the codepage specified in
c742c8f9ffa3 encodings
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
43 this tag, and not to the default encoding.