changeset 213:f8dc8dd2da76

documented orthanc.RegisterIncomingCStoreInstanceFilter() and orthanc.RegisterReceivedInstanceCallback()
author Sebastien Jodogne <s.jodogne@gmail.com>
date Wed, 03 Jul 2024 14:56:51 +0200
parents 2db6c1f6417f
children d74ed3e6423e
files CodeAnalysis/CustomFunctions.json Sources/Autogenerated/orthanc.pyi Sources/Autogenerated/sdk_GlobalFunctions.impl.h Sources/IncomingInstanceFilter.cpp Sources/IncomingInstanceFilter.h Sources/Plugin.cpp Sources/ReceivedInstanceCallback.cpp Sources/ReceivedInstanceCallback.h
diffstat 8 files changed, 82 insertions(+), 22 deletions(-) [+]
line wrap: on
line diff
--- a/CodeAnalysis/CustomFunctions.json	Wed Jul 03 14:39:25 2024 +0200
+++ b/CodeAnalysis/CustomFunctions.json	Wed Jul 03 14:56:51 2024 +0200
@@ -299,5 +299,49 @@
       }
     ],
     "return_sdk_type" : "void"
+  },
+
+  {
+    "comment" : "New in release 4.0",
+    "short_name" : "RegisterIncomingCStoreInstanceFilter",
+    "implementation" : "RegisterIncomingCStoreInstanceFilter",
+    "documentation" : {
+      "description" : [ "Register a callback to filter incoming DICOM instances received by Orthanc through C-STORE." ],
+      "args" : {
+        "callback" : "The callback function."
+      }
+    },
+    "args" : [
+      {
+        "sdk_name" : "callback",
+        "sdk_type" : "Callable",
+        "callable_type" : "IncomingCStoreInstanceFilter",
+        "callable_protocol_args" : "received_dicom: DicomInstance",
+        "callable_protocol_return" : "int"
+      }
+    ],
+    "return_sdk_type" : "void"
+  },
+
+  {
+    "comment" : "New in release 4.0",
+    "short_name" : "RegisterReceivedInstanceCallback",
+    "implementation" : "RegisterReceivedInstanceCallback",
+    "documentation" : {
+      "description" : [ "Register a callback to keep/discard/modify a DICOM instance received by Orthanc from any source (C-STORE or REST API)." ],
+      "args" : {
+        "callback" : "The callback function."
+      }
+    },
+    "args" : [
+      {
+        "sdk_name" : "callback",
+        "sdk_type" : "Callable",
+        "callable_type" : "ReceivedInstanceCallback",
+        "callable_protocol_args" : "received_dicom: bytes, origin: InstanceOrigin",
+        "callable_protocol_return" : "tuple(ReceivedInstanceAction, bytes)"
+      }
+    ],
+    "return_sdk_type" : "void"
   }
 ]
--- a/Sources/Autogenerated/orthanc.pyi	Wed Jul 03 14:39:25 2024 +0200
+++ b/Sources/Autogenerated/orthanc.pyi	Wed Jul 03 14:56:51 2024 +0200
@@ -2200,6 +2200,20 @@
     """
     ...
 
+class IncomingCStoreInstanceFilter(typing.Protocol):
+    def __call__(self, received_dicom: DicomInstance) -> int:
+        ...
+
+# Register a callback to filter incoming DICOM instances received by Orthanc through C-STORE
+def RegisterIncomingCStoreInstanceFilter(callback: IncomingCStoreInstanceFilter) -> None:
+    """
+    Register a callback to filter incoming DICOM instances received by Orthanc through C-STORE.
+
+    Args:
+      callback (IncomingCStoreInstanceFilter): The callback function.
+    """
+    ...
+
 class IncomingHttpRequestFilter(typing.Protocol):
     def __call__(self, uri: str, method: HttpMethod, ip: str, headers: dict, get: dict) -> bool:
         ...
@@ -2285,6 +2299,20 @@
     """
     ...
 
+class ReceivedInstanceCallback(typing.Protocol):
+    def __call__(self, received_dicom: bytes, origin: InstanceOrigin) -> tuple(ReceivedInstanceAction, bytes):
+        ...
+
+# Register a callback to keep/discard/modify a DICOM instance received by Orthanc from any source (C-STORE or REST API)
+def RegisterReceivedInstanceCallback(callback: ReceivedInstanceCallback) -> None:
+    """
+    Register a callback to keep/discard/modify a DICOM instance received by Orthanc from any source (C-STORE or REST API).
+
+    Args:
+      callback (ReceivedInstanceCallback): The callback function.
+    """
+    ...
+
 class RestCallback(typing.Protocol):
     def __call__(self, output: RestOutput, url: str, method: HttpMethod, groups: dict, get: dict, headers: dict, body: bytes=None) -> None:
         ...
--- a/Sources/Autogenerated/sdk_GlobalFunctions.impl.h	Wed Jul 03 14:39:25 2024 +0200
+++ b/Sources/Autogenerated/sdk_GlobalFunctions.impl.h	Wed Jul 03 14:56:51 2024 +0200
@@ -26,11 +26,13 @@
 extern PyObject *CreateImageFromBuffer(PyObject* module, PyObject *args);
 extern PyObject *LookupDictionary(PyObject* module, PyObject *args);
 extern PyObject *RegisterFindCallback(PyObject* module, PyObject *args);
+extern PyObject *RegisterIncomingCStoreInstanceFilter(PyObject* module, PyObject *args);
 extern PyObject *RegisterIncomingHttpRequestFilter(PyObject* module, PyObject *args);
 extern PyObject *RegisterMoveCallback(PyObject* module, PyObject *args);
 extern PyObject *RegisterMoveCallback2(PyObject* module, PyObject *args);
 extern PyObject *RegisterOnChangeCallback(PyObject* module, PyObject *args);
 extern PyObject *RegisterOnStoredInstanceCallback(PyObject* module, PyObject *args);
+extern PyObject *RegisterReceivedInstanceCallback(PyObject* module, PyObject *args);
 extern PyObject *RegisterRestCallback(PyObject* module, PyObject *args);
 extern PyObject *RegisterStorageArea(PyObject* module, PyObject *args);
 extern PyObject *RegisterWorklistCallback(PyObject* module, PyObject *args);
@@ -2033,6 +2035,8 @@
     "Implemented in C++ function LookupDictionary()" },
   { "RegisterFindCallback", RegisterFindCallback, METH_VARARGS,
     "Implemented in C++ function RegisterFindCallback()" },
+  { "RegisterIncomingCStoreInstanceFilter", RegisterIncomingCStoreInstanceFilter, METH_VARARGS,
+    "Implemented in C++ function RegisterIncomingCStoreInstanceFilter()" },
   { "RegisterIncomingHttpRequestFilter", RegisterIncomingHttpRequestFilter, METH_VARARGS,
     "Implemented in C++ function RegisterIncomingHttpRequestFilter()" },
   { "RegisterMoveCallback", RegisterMoveCallback, METH_VARARGS,
@@ -2043,6 +2047,8 @@
     "Implemented in C++ function RegisterOnChangeCallback()" },
   { "RegisterOnStoredInstanceCallback", RegisterOnStoredInstanceCallback, METH_VARARGS,
     "Implemented in C++ function RegisterOnStoredInstanceCallback()" },
+  { "RegisterReceivedInstanceCallback", RegisterReceivedInstanceCallback, METH_VARARGS,
+    "Implemented in C++ function RegisterReceivedInstanceCallback()" },
   { "RegisterRestCallback", RegisterRestCallback, METH_VARARGS,
     "Implemented in C++ function RegisterRestCallback()" },
   { "RegisterStorageArea", RegisterStorageArea, METH_VARARGS,
--- a/Sources/IncomingInstanceFilter.cpp	Wed Jul 03 14:39:25 2024 +0200
+++ b/Sources/IncomingInstanceFilter.cpp	Wed Jul 03 14:56:51 2024 +0200
@@ -21,6 +21,8 @@
 
 #include "IncomingInstanceFilter.h"
 
+#include "PythonHeaderWrapper.h"
+
 #include "../Resources/Orthanc/Plugins/OrthancPluginCppWrapper.h"
 #include "Autogenerated/sdk.h"
 #include "ICallbackRegistration.h"
--- a/Sources/IncomingInstanceFilter.h	Wed Jul 03 14:39:25 2024 +0200
+++ b/Sources/IncomingInstanceFilter.h	Wed Jul 03 14:56:51 2024 +0200
@@ -21,8 +21,4 @@
 
 #pragma once
 
-#include "PythonHeaderWrapper.h"
-
-PyObject* RegisterIncomingCStoreInstanceFilter(PyObject* module, PyObject* args);
-
 void FinalizeIncomingCStoreInstanceFilter();
--- a/Sources/Plugin.cpp	Wed Jul 03 14:39:25 2024 +0200
+++ b/Sources/Plugin.cpp	Wed Jul 03 14:56:51 2024 +0200
@@ -277,20 +277,6 @@
 
   std::list<PyMethodDef> functions;
 
-  
-  /**
-   * New in release 4.0
-   **/
-  
-  {
-    PyMethodDef f = { "RegisterIncomingCStoreInstanceFilter", RegisterIncomingCStoreInstanceFilter, METH_VARARGS, "" };
-    functions.push_back(f);
-  }
-
-  {
-    PyMethodDef f = { "RegisterReceivedInstanceCallback", RegisterReceivedInstanceCallback, METH_VARARGS, "" };
-    functions.push_back(f);
-  }
 
   /**
    * New in release 4.1
--- a/Sources/ReceivedInstanceCallback.cpp	Wed Jul 03 14:39:25 2024 +0200
+++ b/Sources/ReceivedInstanceCallback.cpp	Wed Jul 03 14:56:51 2024 +0200
@@ -21,6 +21,8 @@
 
 #include "ReceivedInstanceCallback.h"
 
+#include "PythonHeaderWrapper.h"
+
 #include "../Resources/Orthanc/Plugins/OrthancPluginCppWrapper.h"
 #include "ICallbackRegistration.h"
 #include "PythonString.h"
--- a/Sources/ReceivedInstanceCallback.h	Wed Jul 03 14:39:25 2024 +0200
+++ b/Sources/ReceivedInstanceCallback.h	Wed Jul 03 14:56:51 2024 +0200
@@ -21,8 +21,4 @@
 
 #pragma once
 
-#include "PythonHeaderWrapper.h"
-
 void FinalizeReceivedInstanceCallback();
-
-PyObject* RegisterReceivedInstanceCallback(PyObject* module, PyObject* args);