changeset 96:627b8a19fb9f

orthanc.RegisterIncomingCStoreInstanceFilter()
author Alain Mazy <am@osimis.io>
date Fri, 15 Oct 2021 18:36:24 +0200
parents c17cdaf687e3
children e37ed36541be
files .hgignore CMakeLists.txt CodeAnalysis/ParseOrthancSDK.py CodeAnalysis/README.txt NEWS Resources/SyncOrthancFolder.py Sources/Autogenerated/sdk_OrthancPluginContentType.impl.h Sources/Autogenerated/sdk_OrthancPluginDicomToJsonFlags.impl.h Sources/Autogenerated/sdk_OrthancPluginErrorCode.impl.h Sources/OnStoredInstanceCallback.cpp Sources/Plugin.cpp
diffstat 11 files changed, 37 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/.hgignore	Wed Sep 15 11:52:30 2021 +0200
+++ b/.hgignore	Fri Oct 15 18:36:24 2021 +0200
@@ -1,3 +1,4 @@
 syntax: glob
 ThirdPartyDownloads/
 *~
+.vscode/
--- a/CMakeLists.txt	Wed Sep 15 11:52:30 2021 +0200
+++ b/CMakeLists.txt	Fri Oct 15 18:36:24 2021 +0200
@@ -152,7 +152,7 @@
 
 
 include_directories(
-  ${CMAKE_SOURCE_DIR}/Resources/Orthanc/Sdk-1.8.1
+  ${CMAKE_SOURCE_DIR}/Resources/Orthanc/Sdk-1.9.8
   )
 
 add_definitions(
@@ -168,6 +168,7 @@
   Sources/DicomScpCallbacks.cpp
   Sources/ICallbackRegistration.cpp
   Sources/IncomingHttpRequestFilter.cpp
+  Sources/IncomingInstanceFilter.cpp
   Sources/OnChangeCallback.cpp
   Sources/OnStoredInstanceCallback.cpp
   Sources/Plugin.cpp
--- a/CodeAnalysis/ParseOrthancSDK.py	Wed Sep 15 11:52:30 2021 +0200
+++ b/CodeAnalysis/ParseOrthancSDK.py	Fri Oct 15 18:36:24 2021 +0200
@@ -50,6 +50,7 @@
     'OrthancPluginRegisterRestCallback',               # Implemented using OrthancPlugins::RegisterRestCallback
     'OrthancPluginRegisterRestCallbackNoLock',         # Implemented using OrthancPlugins::RegisterRestCallback
     'OrthancPluginRegisterWorklistCallback',
+    'OrthancPluginRegisterIncomingCStoreInstanceFilter',
 ])
 
 CUSTOM_METHODS = [
@@ -99,7 +100,7 @@
                     help = 'manually provides the path to the libclang shared library')
 parser.add_argument('--source',
                     default = os.path.join(os.path.dirname(__file__),
-                                           '../Resources/Orthanc/Sdk-1.8.1/orthanc/OrthancCPlugin.h'),
+                                           '../Resources/Orthanc/Sdk-1.9.8/orthanc/OrthancCPlugin.h'),
                     help = 'Input C++ file')
 parser.add_argument('--target', 
                     default = os.path.join(os.path.dirname(__file__),
--- a/CodeAnalysis/README.txt	Wed Sep 15 11:52:30 2021 +0200
+++ b/CodeAnalysis/README.txt	Fri Oct 15 18:36:24 2021 +0200
@@ -13,5 +13,11 @@
 
 $ sudo apt-get install python-clang-4.0
 $ python2 ./ParseOrthancSDK.py --libclang=libclang-4.0.so.1 \
-          --source ../Resources/Orthanc/Sdk-1.8.1/orthanc/OrthancCPlugin.h \
+          --source ../Resources/Orthanc/Sdk-1.9.8/orthanc/OrthancCPlugin.h \
           --target ../Sources/Autogenerated
+
+
+Run through docker
+==================
+
+$ docker-compose up --build
--- a/NEWS	Wed Sep 15 11:52:30 2021 +0200
+++ b/NEWS	Fri Oct 15 18:36:24 2021 +0200
@@ -1,6 +1,10 @@
 Pending changes in the mainline
 ===============================
 
+=> Minimum SDK version: 1.9.8 <=  That has not been released yet !!!
+
+* New functions from the SDK wrapped in Python:
+  - orthanc.RegisterIncomingCStoreInstanceFilter()
 
 Version 3.4 (2021-08-31)
 ========================
--- a/Resources/SyncOrthancFolder.py	Wed Sep 15 11:52:30 2021 +0200
+++ b/Resources/SyncOrthancFolder.py	Fri Oct 15 18:36:24 2021 +0200
@@ -12,7 +12,7 @@
 import subprocess
 
 TARGET = os.path.join(os.path.dirname(__file__), 'Orthanc')
-PLUGIN_SDK_VERSION = '1.8.1'
+PLUGIN_SDK_VERSION = '1.9.8'
 REPOSITORY = 'https://hg.orthanc-server.com/orthanc/raw-file'
 
 FILES = [
--- a/Sources/Autogenerated/sdk_OrthancPluginContentType.impl.h	Wed Sep 15 11:52:30 2021 +0200
+++ b/Sources/Autogenerated/sdk_OrthancPluginContentType.impl.h	Fri Oct 15 18:36:24 2021 +0200
@@ -66,6 +66,7 @@
   PyDict_SetItemString(sdk_OrthancPluginContentType_Type.tp_dict, "UNKNOWN", PyLong_FromLong(0));
   PyDict_SetItemString(sdk_OrthancPluginContentType_Type.tp_dict, "DICOM", PyLong_FromLong(1));
   PyDict_SetItemString(sdk_OrthancPluginContentType_Type.tp_dict, "DICOM_AS_JSON", PyLong_FromLong(2));
+  PyDict_SetItemString(sdk_OrthancPluginContentType_Type.tp_dict, "DICOM_UNTIL_PIXEL_DATA", PyLong_FromLong(3));
 
   Py_INCREF(&sdk_OrthancPluginContentType_Type);
   if (PyModule_AddObject(module, "ContentType", (PyObject *)&sdk_OrthancPluginContentType_Type) < 0)
--- a/Sources/Autogenerated/sdk_OrthancPluginDicomToJsonFlags.impl.h	Wed Sep 15 11:52:30 2021 +0200
+++ b/Sources/Autogenerated/sdk_OrthancPluginDicomToJsonFlags.impl.h	Fri Oct 15 18:36:24 2021 +0200
@@ -70,6 +70,8 @@
   PyDict_SetItemString(sdk_OrthancPluginDicomToJsonFlags_Type.tp_dict, "INCLUDE_PIXEL_DATA", PyLong_FromLong(8));
   PyDict_SetItemString(sdk_OrthancPluginDicomToJsonFlags_Type.tp_dict, "CONVERT_BINARY_TO_ASCII", PyLong_FromLong(16));
   PyDict_SetItemString(sdk_OrthancPluginDicomToJsonFlags_Type.tp_dict, "CONVERT_BINARY_TO_NULL", PyLong_FromLong(32));
+  PyDict_SetItemString(sdk_OrthancPluginDicomToJsonFlags_Type.tp_dict, "STOP_AFTER_PIXEL_DATA", PyLong_FromLong(64));
+  PyDict_SetItemString(sdk_OrthancPluginDicomToJsonFlags_Type.tp_dict, "SKIP_GROUP_LENGTHS", PyLong_FromLong(128));
 
   Py_INCREF(&sdk_OrthancPluginDicomToJsonFlags_Type);
   if (PyModule_AddObject(module, "DicomToJsonFlags", (PyObject *)&sdk_OrthancPluginDicomToJsonFlags_Type) < 0)
--- a/Sources/Autogenerated/sdk_OrthancPluginErrorCode.impl.h	Wed Sep 15 11:52:30 2021 +0200
+++ b/Sources/Autogenerated/sdk_OrthancPluginErrorCode.impl.h	Fri Oct 15 18:36:24 2021 +0200
@@ -105,6 +105,9 @@
   PyDict_SetItemString(sdk_OrthancPluginErrorCode_Type.tp_dict, "BAD_GEOMETRY", PyLong_FromLong(38));
   PyDict_SetItemString(sdk_OrthancPluginErrorCode_Type.tp_dict, "SSL_INITIALIZATION", PyLong_FromLong(39));
   PyDict_SetItemString(sdk_OrthancPluginErrorCode_Type.tp_dict, "DISCONTINUED_ABI", PyLong_FromLong(40));
+  PyDict_SetItemString(sdk_OrthancPluginErrorCode_Type.tp_dict, "BAD_RANGE", PyLong_FromLong(41));
+  PyDict_SetItemString(sdk_OrthancPluginErrorCode_Type.tp_dict, "DATABASE_CANNOT_SERIALIZE", PyLong_FromLong(42));
+  PyDict_SetItemString(sdk_OrthancPluginErrorCode_Type.tp_dict, "REVISION", PyLong_FromLong(43));
   PyDict_SetItemString(sdk_OrthancPluginErrorCode_Type.tp_dict, "SQLITE_NOT_OPENED", PyLong_FromLong(1000));
   PyDict_SetItemString(sdk_OrthancPluginErrorCode_Type.tp_dict, "SQLITE_ALREADY_OPENED", PyLong_FromLong(1001));
   PyDict_SetItemString(sdk_OrthancPluginErrorCode_Type.tp_dict, "SQLITE_CANNOT_OPEN", PyLong_FromLong(1002));
--- a/Sources/OnStoredInstanceCallback.cpp	Wed Sep 15 11:52:30 2021 +0200
+++ b/Sources/OnStoredInstanceCallback.cpp	Fri Oct 15 18:36:24 2021 +0200
@@ -36,9 +36,9 @@
     PythonLock lock;
 
     /**
-     * Construct an instance object of the "orthanc.RestOutput"
+     * Construct an instance object of the "orthanc.DicomInstance"
      * class. This is done by calling the constructor function
-     * "sdk_OrthancPluginRestOutput_Type".
+     * "sdk_OrthancPluginDicomInstance_Type".
      **/
     PythonObject args(lock, PyTuple_New(2));
     PyTuple_SetItem(args.GetPyObject(), 0, PyLong_FromSsize_t((intptr_t) instance));
@@ -46,7 +46,7 @@
     PyObject *pInst = PyObject_CallObject((PyObject*) GetOrthancPluginDicomInstanceType(), args.GetPyObject());
     
     /**
-     * Construct the arguments tuple (output, uri)
+     * Construct the arguments tuple (instance, instanceId)
      **/
     PythonString str(lock, instanceId);
     
@@ -59,7 +59,7 @@
     std::string traceback;
     if (lock.HasErrorOccurred(traceback))
     {
-      OrthancPlugins::LogError("Error in the Python on-change callback, "
+      OrthancPlugins::LogError("Error in the Python on-stored-instance callback, "
                                "traceback:\n" + traceback);
       return OrthancPluginErrorCode_Plugin;
     }
--- a/Sources/Plugin.cpp	Wed Sep 15 11:52:30 2021 +0200
+++ b/Sources/Plugin.cpp	Fri Oct 15 18:36:24 2021 +0200
@@ -28,6 +28,7 @@
 #include "IncomingHttpRequestFilter.h"
 #include "OnChangeCallback.h"
 #include "OnStoredInstanceCallback.h"
+#include "IncomingInstanceFilter.h"
 #include "StorageArea.h"
 
 #include "RestCallbacks.h"
@@ -374,6 +375,15 @@
 
 
   /**
+   * New in release 3.5
+   **/
+  
+  {
+    PyMethodDef f = { "RegisterIncomingCStoreInstanceFilter", RegisterIncomingCStoreInstanceFilter, METH_VARARGS, "" };
+    functions.push_back(f);
+  }
+
+  /**
    * Append all the global functions that were automatically generated
    **/