changeset 1095:5b6f8a2b012a

merge
author Alain Mazy <am@orthanc.team>
date Wed, 24 Jul 2024 10:12:54 +0200
parents 7c43797528b4 (current diff) ad86e352fce1 (diff)
children c825cf4672f2
files
diffstat 4 files changed, 52 insertions(+), 13 deletions(-) [+]
line wrap: on
line diff
--- a/Sphinx/source/plugins/java.rst	Wed Jul 24 10:12:19 2024 +0200
+++ b/Sphinx/source/plugins/java.rst	Wed Jul 24 10:12:54 2024 +0200
@@ -22,9 +22,9 @@
 using the `Clang <https://en.wikipedia.org/wiki/Clang>`__ compiler
 front-end.
 
-As of release 1.0 of the plugin, the coverage of the C SDK is about
-76% (122 functions are automatically wrapped in Java out of a total of
-160 functions from the Orthanc SDK 1.10.0).
+As of release 1.0 of the plugin, **the coverage of the C SDK is about
+74%** (122 functions are automatically wrapped in Java out of a total
+of 165 functions from the Orthanc SDK 1.10.0).
 
 **For researchers**: `Please cite this paper
 <https://doi.org/10.5220/0012384600003657>`__.
--- a/Sphinx/source/plugins/orthanc-explorer-2.rst	Wed Jul 24 10:12:19 2024 +0200
+++ b/Sphinx/source/plugins/orthanc-explorer-2.rst	Wed Jul 24 10:12:54 2024 +0200
@@ -34,10 +34,13 @@
 
 Binaries are included in:
 
-- The `orthancteam/orthanc Docker image <https://hub.docker.com/r/orthancteam/orthanc>`__
-- The `Windows Installer <https://orthanc.uclouvain.be/downloads/windows-64/installers/index.html>`__
-- The `macOS packages <https://orthanc.uclouvain.be/downloads/macos/packages/index.html>`__
+- The :ref:`orthancteam/orthanc Docker image <docker-orthancteam>`,
+- The :ref:`jodogne/orthanc-plugins Docker image <docker>`,
+- The `Windows installers <https://orthanc.uclouvain.be/downloads/windows-64/installers/index.html>`__,
+- The `macOS packages <https://orthanc.uclouvain.be/downloads/macos/packages/index.html>`__.
 
+Precompiled binaries of the plugin alone are also available for multiple platforms on the `official download site <https://orthanc.uclouvain.be/downloads/index.html>`__.
+  
 Release notes are available `here <https://github.com/orthanc-server/orthanc-explorer-2/blob/master/release-notes.md>`__.
 
 Depending on the configuration, the plugin can replace the default Orthanc UI you are redirected to when accessing orthanc at `http://localhost:8042/ <http://localhost:8042/>`__.
--- a/Sphinx/source/plugins/python.rst	Wed Jul 24 10:12:19 2024 +0200
+++ b/Sphinx/source/plugins/python.rst	Wed Jul 24 10:12:54 2024 +0200
@@ -22,9 +22,11 @@
 using the `Clang <https://en.wikipedia.org/wiki/Clang>`__ compiler
 front-end.
 
-As of release 3.2 of the plugin, the coverage of the C SDK is about
-87% (138 functions are automatically wrapped in Python out of a total
-of 158 functions from the Orthanc SDK 1.8.1).
+As of release 4.3 of the plugin, **the coverage of the C SDK is about
+85%** (140 functions are automatically wrapped in Python out of a
+total of 165 functions from the Orthanc SDK 1.10.0). Starting with
+release 4.3, the code model that is used to generate the Python
+wrapper is shared with the :ref:`Java wrapper <java-plugin>`.
 
 
 Source code
@@ -36,6 +38,11 @@
 * Link to the `code repository
   <https://orthanc.uclouvain.be/hg/orthanc-python/>`__.
 
+* Link to the `Python interface
+  <https://orthanc.uclouvain.be/downloads/cross-platform/orthanc-python/index.html>`__
+  (cf. :ref:`below <python-code-completion>` for more information
+  about the ``orthanc.pyi`` file).
+
   
 Licensing
 ---------
@@ -241,7 +248,8 @@
     "Python" : {
       "Path" : "my-plugin.py",  // Alias for the global "PythonScript" option
       "Verbose" : false,        // Alias for the global "PythonVerbose" option
-      "DisplayMemoryUsage" : false
+      "DisplayMemoryUsage" : false,
+      "AllowThreads" : false
     }
   }
 
@@ -249,12 +257,42 @@
 of the plugin. If set to ``true``, Orthanc will display the memory
 usage of the Python interpreter every second.
   
+The option ``Python.AllowThreads`` was introduced in release 4.3 of
+the plugin. If set to ``true``, the Python GIL (`Global Interpreter
+Lock <https://en.wikipedia.org/wiki/Global_interpreter_lock>`__) is
+released during the calls to the native SDK. **This allows multiple
+Python threads to simultaneously access the Orthanc core.**
+Internally, this corresponds to the ``Py_BEGIN_ALLOW_THREADS``
+`construction of Python
+<https://docs.python.org/3/c-api/init.html#releasing-the-gil-from-extension-code>`__. However,
+this could possibly introduce concurrency issues: Make sure that your
+Python code is **thread-safe** before enabling this option! Indeed,
+different threads must not modify the Python objects that are used
+during a call to the SDK of Orthanc.
+
 
 .. warning::
    Never call your Python plugin ``orthanc.py``! Otherwise, your plugin will
    conflict with the ``orthanc`` module that is installed at runtime.
 
 
+.. _python-code-completion:
+
+Documentation and code completion
+---------------------------------
+
+Starting with release 4.3 of the Python plugin for Orthanc, a `Python
+interface (cf. PEP 484 - Type Hints)
+<https://peps.python.org/pep-0484/>`__ is available. By downloading
+the file ``orthanc.pyi`` `from this location
+<https://orthanc.uclouvain.be/downloads/cross-platform/orthanc-python/index.html>`__
+and putting it in the same folder as your Python script, your IDE will
+provide you code completion, as well as full documentation of the
+Orthanc SDK in the Python language. This file is notably known to work
+with Visual Studio Code and PyCharm.
+
+
+
 Samples
 -------
 
--- a/Sphinx/source/plugins/python/incoming-cstore-filter.py	Wed Jul 24 10:12:19 2024 +0200
+++ b/Sphinx/source/plugins/python/incoming-cstore-filter.py	Wed Jul 24 10:12:54 2024 +0200
@@ -1,13 +1,11 @@
-import json
 import orthanc
 
-
 # this script accepts 3 instances from STORESCU and then, rejects the next ones
 
 storeScuInstanceCounter = 0
 
 def FilterIncomingCStoreInstance(receivedDicom):
-    # The list ofvalid status codes for DIMSE C-STORE can be found:
+    # The list of valid status codes for DIMSE C-STORE can be found:
     # https://dicom.nema.org/medical/Dicom/2021e/output/chtml/part04/sect_B.2.3.html
 
     global storeScuInstanceCounter