# HG changeset patch # User Sebastien Jodogne # Date 1719504126 -7200 # Node ID e9be3c9294d4519a8b5fda7cae38b6310611a52c # Parent 3c72d1f4c2a5af2e570c28338d7e09975f2d4600 [IMPORTANT] replaced old auto-generated code with Java code model diff -r 3c72d1f4c2a5 -r e9be3c9294d4 CodeAnalysis/GenerateOrthancSDK.py --- a/CodeAnalysis/GenerateOrthancSDK.py Thu Jun 27 17:50:51 2024 +0200 +++ b/CodeAnalysis/GenerateOrthancSDK.py Thu Jun 27 18:02:06 2024 +0200 @@ -81,14 +81,6 @@ }, ], - 'OrthancPluginWorklistAnswers' : [ - { - 'method_name' : 'WorklistAddAnswer', - 'implementation' : 'WorklistAddAnswer', - 'sdk_function' : 'OrthancPluginWorklistAddAnswer', - }, - ], - 'OrthancPluginDicomInstance' : [ { 'method_name' : 'GetInstanceData', diff -r 3c72d1f4c2a5 -r e9be3c9294d4 Sources/Autogenerated/sdk_GlobalFunctions.impl.h --- a/Sources/Autogenerated/sdk_GlobalFunctions.impl.h Thu Jun 27 17:50:51 2024 +0200 +++ b/Sources/Autogenerated/sdk_GlobalFunctions.impl.h Thu Jun 27 18:02:06 2024 +0200 @@ -30,6 +30,7 @@ PyErr_SetString(PyExc_TypeError, "Bad types for the arguments (1 arguments expected)"); return NULL; } + const char* s = OrthancPluginAutodetectMimeType(OrthancPlugins::GetGlobalContext(), arg0); if (s == NULL) @@ -56,6 +57,7 @@ PyErr_SetString(PyExc_TypeError, "Bad types for the arguments (3 arguments expected)"); return NULL; } + OrthancPlugins::MemoryBuffer buffer; OrthancPluginErrorCode code = OrthancPluginBufferCompression(OrthancPlugins::GetGlobalContext(), *buffer, arg0.buf, arg0.len, static_cast(arg2), arg3); PyBuffer_Release(&arg0); @@ -75,6 +77,7 @@ PythonLock::LogCall("Calling Python global function: OrthancPluginCheckVersion()"); + long value = OrthancPluginCheckVersion(OrthancPlugins::GetGlobalContext()); return PyLong_FromLong(value); @@ -84,15 +87,16 @@ { PythonLock::LogCall("Calling Python global function: OrthancPluginCheckVersionAdvanced()"); - int arg0 = 0; - int arg1 = 0; - int arg2 = 0; + long int arg0 = 0; + long int arg1 = 0; + long int arg2 = 0; - if (!PyArg_ParseTuple(args, "iii", &arg0, &arg1, &arg2)) + if (!PyArg_ParseTuple(args, "lll", &arg0, &arg1, &arg2)) { PyErr_SetString(PyExc_TypeError, "Bad types for the arguments (3 arguments expected)"); return NULL; } + long value = OrthancPluginCheckVersionAdvanced(OrthancPlugins::GetGlobalContext(), arg0, arg1, arg2); return PyLong_FromLong(value); @@ -114,6 +118,7 @@ PyErr_SetString(PyExc_TypeError, "Bad types for the arguments (6 arguments expected)"); return NULL; } + OrthancPlugins::MemoryBuffer buffer; OrthancPluginErrorCode code = OrthancPluginCompressJpegImage(OrthancPlugins::GetGlobalContext(), *buffer, static_cast(arg0), arg1, arg2, arg3, arg4.buf, arg5); PyBuffer_Release(&arg4); @@ -143,6 +148,7 @@ PyErr_SetString(PyExc_TypeError, "Bad types for the arguments (5 arguments expected)"); return NULL; } + OrthancPlugins::MemoryBuffer buffer; OrthancPluginErrorCode code = OrthancPluginCompressPngImage(OrthancPlugins::GetGlobalContext(), *buffer, static_cast(arg0), arg1, arg2, arg3, arg4.buf); PyBuffer_Release(&arg4); @@ -168,6 +174,7 @@ PyErr_SetString(PyExc_TypeError, "Bad types for the arguments (1 arguments expected)"); return NULL; } + OrthancPlugins::OrthancString s; s.Assign(OrthancPluginComputeMd5(OrthancPlugins::GetGlobalContext(), arg0.buf, arg0.len)); PyBuffer_Release(&arg0); @@ -193,6 +200,7 @@ PyErr_SetString(PyExc_TypeError, "Bad types for the arguments (1 arguments expected)"); return NULL; } + OrthancPlugins::OrthancString s; s.Assign(OrthancPluginComputeSha1(OrthancPlugins::GetGlobalContext(), arg0.buf, arg0.len)); PyBuffer_Release(&arg0); @@ -207,6 +215,75 @@ } } +static PyObject* sdk_OrthancPluginCreateDicom(PyObject* module, PyObject* args) +{ + PythonLock::LogCall("Calling Python global function: OrthancPluginCreateDicom()"); + + const char* arg0 = NULL; + PyObject* arg1 = NULL; + long int arg2 = 0; + + if (!PyArg_ParseTuple(args, "sOl", &arg0, &arg1, &arg2)) + { + PyErr_SetString(PyExc_TypeError, "Bad types for the arguments (3 arguments expected)"); + return NULL; + } + + if (arg1 != Py_None && Py_TYPE(arg1) != GetOrthancPluginImageType()) + { + PyErr_SetString(PyExc_TypeError, "Invalid orthanc.OrthancPluginImage object"); + return NULL; + } + + OrthancPlugins::MemoryBuffer buffer; + OrthancPluginErrorCode code = OrthancPluginCreateDicom(OrthancPlugins::GetGlobalContext(), *buffer, arg0, arg1 == Py_None ? NULL : reinterpret_cast(arg1)->object_, static_cast(arg2)); + + if (code == OrthancPluginErrorCode_Success) + { + return PyBytes_FromStringAndSize(buffer.GetData(), buffer.GetSize()); + } + else + { + PythonLock::RaiseException(code); + return NULL; + } +} + +static PyObject* sdk_OrthancPluginCreateDicom2(PyObject* module, PyObject* args) +{ + PythonLock::LogCall("Calling Python global function: OrthancPluginCreateDicom2()"); + + const char* arg0 = NULL; + PyObject* arg1 = NULL; + long int arg2 = 0; + const char* arg3 = NULL; + + if (!PyArg_ParseTuple(args, "sOls", &arg0, &arg1, &arg2, &arg3)) + { + PyErr_SetString(PyExc_TypeError, "Bad types for the arguments (4 arguments expected)"); + return NULL; + } + + if (arg1 != Py_None && Py_TYPE(arg1) != GetOrthancPluginImageType()) + { + PyErr_SetString(PyExc_TypeError, "Invalid orthanc.OrthancPluginImage object"); + return NULL; + } + + OrthancPlugins::MemoryBuffer buffer; + OrthancPluginErrorCode code = OrthancPluginCreateDicom2(OrthancPlugins::GetGlobalContext(), *buffer, arg0, arg1 == Py_None ? NULL : reinterpret_cast(arg1)->object_, static_cast(arg2), arg3); + + if (code == OrthancPluginErrorCode_Success) + { + return PyBytes_FromStringAndSize(buffer.GetData(), buffer.GetSize()); + } + else + { + PythonLock::RaiseException(code); + return NULL; + } +} + static PyObject* sdk_OrthancPluginCreateDicomInstance(PyObject* module, PyObject* args) { PythonLock::LogCall("Calling Python global function: OrthancPluginCreateDicomInstance()"); @@ -218,6 +295,7 @@ PyErr_SetString(PyExc_TypeError, "Bad types for the arguments (1 arguments expected)"); return NULL; } + // This is the case of a constructor OrthancPluginDicomInstance* obj = OrthancPluginCreateDicomInstance(OrthancPlugins::GetGlobalContext(), arg0.buf, arg0.len); PyBuffer_Release(&arg0); @@ -246,6 +324,7 @@ PyErr_SetString(PyExc_TypeError, "Bad types for the arguments (1 arguments expected)"); return NULL; } + // This is the case of a constructor OrthancPluginFindMatcher* obj = OrthancPluginCreateFindMatcher(OrthancPlugins::GetGlobalContext(), arg0.buf, arg0.len); PyBuffer_Release(&arg0); @@ -276,6 +355,7 @@ PyErr_SetString(PyExc_TypeError, "Bad types for the arguments (3 arguments expected)"); return NULL; } + // This is the case of a constructor OrthancPluginImage* obj = OrthancPluginCreateImage(OrthancPlugins::GetGlobalContext(), static_cast(arg0), arg1, arg2); @@ -304,6 +384,7 @@ PyErr_SetString(PyExc_TypeError, "Bad types for the arguments (1 arguments expected)"); return NULL; } + OrthancPlugins::MemoryBuffer buffer; OrthancPluginErrorCode code = OrthancPluginCreateMemoryBuffer(OrthancPlugins::GetGlobalContext(), *buffer, arg0); @@ -330,6 +411,7 @@ PyErr_SetString(PyExc_TypeError, "Bad types for the arguments (2 arguments expected)"); return NULL; } + // This is the case of a constructor OrthancPluginImage* obj = OrthancPluginDecodeDicomImage(OrthancPlugins::GetGlobalContext(), arg0.buf, arg0.len, arg2); PyBuffer_Release(&arg0); @@ -361,6 +443,7 @@ PyErr_SetString(PyExc_TypeError, "Bad types for the arguments (4 arguments expected)"); return NULL; } + OrthancPlugins::OrthancString s; s.Assign(OrthancPluginDicomBufferToJson(OrthancPlugins::GetGlobalContext(), arg0.buf, arg0.len, static_cast(arg2), static_cast(arg3), arg4)); PyBuffer_Release(&arg0); @@ -389,6 +472,7 @@ PyErr_SetString(PyExc_TypeError, "Bad types for the arguments (4 arguments expected)"); return NULL; } + OrthancPlugins::OrthancString s; s.Assign(OrthancPluginDicomInstanceToJson(OrthancPlugins::GetGlobalContext(), arg0, static_cast(arg1), static_cast(arg2), arg3)); @@ -414,6 +498,7 @@ PyErr_SetString(PyExc_TypeError, "Bad types for the arguments (1 arguments expected)"); return NULL; } + OrthancPluginExtendOrthancExplorer(OrthancPlugins::GetGlobalContext(), arg0); @@ -426,6 +511,7 @@ PythonLock::LogCall("Calling Python global function: OrthancPluginGenerateRestApiAuthorizationToken()"); + OrthancPlugins::OrthancString s; s.Assign(OrthancPluginGenerateRestApiAuthorizationToken(OrthancPlugins::GetGlobalContext())); @@ -445,6 +531,7 @@ PythonLock::LogCall("Calling Python global function: OrthancPluginGenerateUuid()"); + OrthancPlugins::OrthancString s; s.Assign(OrthancPluginGenerateUuid(OrthancPlugins::GetGlobalContext())); @@ -470,6 +557,7 @@ PyErr_SetString(PyExc_TypeError, "Bad types for the arguments (1 arguments expected)"); return NULL; } + OrthancPlugins::OrthancString s; s.Assign(OrthancPluginGetCommandLineArgument(OrthancPlugins::GetGlobalContext(), arg0)); @@ -489,6 +577,7 @@ PythonLock::LogCall("Calling Python global function: OrthancPluginGetCommandLineArgumentsCount()"); + long value = OrthancPluginGetCommandLineArgumentsCount(OrthancPlugins::GetGlobalContext()); return PyLong_FromLong(value); @@ -499,6 +588,7 @@ PythonLock::LogCall("Calling Python global function: OrthancPluginGetConfiguration()"); + OrthancPlugins::OrthancString s; s.Assign(OrthancPluginGetConfiguration(OrthancPlugins::GetGlobalContext())); @@ -518,6 +608,7 @@ PythonLock::LogCall("Calling Python global function: OrthancPluginGetConfigurationPath()"); + OrthancPlugins::OrthancString s; s.Assign(OrthancPluginGetConfigurationPath(OrthancPlugins::GetGlobalContext())); @@ -543,6 +634,7 @@ PyErr_SetString(PyExc_TypeError, "Bad types for the arguments (1 arguments expected)"); return NULL; } + OrthancPlugins::MemoryBuffer buffer; OrthancPluginErrorCode code = OrthancPluginGetDicomForInstance(OrthancPlugins::GetGlobalContext(), *buffer, arg0); @@ -568,6 +660,7 @@ PyErr_SetString(PyExc_TypeError, "Bad types for the arguments (1 arguments expected)"); return NULL; } + const char* s = OrthancPluginGetErrorDescription(OrthancPlugins::GetGlobalContext(), static_cast(arg0)); if (s == NULL) @@ -586,6 +679,7 @@ PythonLock::LogCall("Calling Python global function: OrthancPluginGetExpectedDatabaseVersion()"); + long value = OrthancPluginGetExpectedDatabaseVersion(OrthancPlugins::GetGlobalContext()); return PyLong_FromLong(value); @@ -602,6 +696,7 @@ PyErr_SetString(PyExc_TypeError, "Bad types for the arguments (1 arguments expected)"); return NULL; } + const char* s = OrthancPluginGetFontName(OrthancPlugins::GetGlobalContext(), arg0); if (s == NULL) @@ -626,6 +721,7 @@ PyErr_SetString(PyExc_TypeError, "Bad types for the arguments (1 arguments expected)"); return NULL; } + long value = OrthancPluginGetFontSize(OrthancPlugins::GetGlobalContext(), arg0); return PyLong_FromLong(value); @@ -636,6 +732,7 @@ PythonLock::LogCall("Calling Python global function: OrthancPluginGetFontsCount()"); + long value = OrthancPluginGetFontsCount(OrthancPlugins::GetGlobalContext()); return PyLong_FromLong(value); @@ -653,6 +750,7 @@ PyErr_SetString(PyExc_TypeError, "Bad types for the arguments (2 arguments expected)"); return NULL; } + OrthancPlugins::OrthancString s; s.Assign(OrthancPluginGetGlobalProperty(OrthancPlugins::GetGlobalContext(), arg0, arg1)); @@ -672,6 +770,7 @@ PythonLock::LogCall("Calling Python global function: OrthancPluginGetOrthancDirectory()"); + OrthancPlugins::OrthancString s; s.Assign(OrthancPluginGetOrthancDirectory(OrthancPlugins::GetGlobalContext())); @@ -691,6 +790,7 @@ PythonLock::LogCall("Calling Python global function: OrthancPluginGetOrthancPath()"); + OrthancPlugins::OrthancString s; s.Assign(OrthancPluginGetOrthancPath(OrthancPlugins::GetGlobalContext())); @@ -710,6 +810,7 @@ PythonLock::LogCall("Calling Python global function: OrthancPluginGetPeers()"); + // This is the case of a constructor OrthancPluginPeers* obj = OrthancPluginGetPeers(OrthancPlugins::GetGlobalContext()); @@ -740,6 +841,7 @@ PyErr_SetString(PyExc_TypeError, "Bad types for the arguments (3 arguments expected)"); return NULL; } + OrthancPlugins::OrthancString s; s.Assign(OrthancPluginGetTagName(OrthancPlugins::GetGlobalContext(), arg0, arg1, arg2)); @@ -767,6 +869,7 @@ PyErr_SetString(PyExc_TypeError, "Bad types for the arguments (3 arguments expected)"); return NULL; } + OrthancPluginErrorCode code = OrthancPluginHttpDelete(OrthancPlugins::GetGlobalContext(), arg0, arg1, arg2); @@ -795,6 +898,7 @@ PyErr_SetString(PyExc_TypeError, "Bad types for the arguments (3 arguments expected)"); return NULL; } + OrthancPlugins::MemoryBuffer buffer; OrthancPluginErrorCode code = OrthancPluginHttpGet(OrthancPlugins::GetGlobalContext(), *buffer, arg0, arg1, arg2); @@ -823,6 +927,7 @@ PyErr_SetString(PyExc_TypeError, "Bad types for the arguments (4 arguments expected)"); return NULL; } + OrthancPlugins::MemoryBuffer buffer; OrthancPluginErrorCode code = OrthancPluginHttpPost(OrthancPlugins::GetGlobalContext(), *buffer, arg0, arg1.buf, arg1.len, arg3, arg4); PyBuffer_Release(&arg1); @@ -851,6 +956,7 @@ PyErr_SetString(PyExc_TypeError, "Bad types for the arguments (4 arguments expected)"); return NULL; } + OrthancPlugins::MemoryBuffer buffer; OrthancPluginErrorCode code = OrthancPluginHttpPut(OrthancPlugins::GetGlobalContext(), *buffer, arg0, arg1.buf, arg1.len, arg3, arg4); PyBuffer_Release(&arg1); @@ -876,6 +982,7 @@ PyErr_SetString(PyExc_TypeError, "Bad types for the arguments (1 arguments expected)"); return NULL; } + OrthancPluginLogError(OrthancPlugins::GetGlobalContext(), arg0); @@ -894,6 +1001,7 @@ PyErr_SetString(PyExc_TypeError, "Bad types for the arguments (1 arguments expected)"); return NULL; } + OrthancPluginLogInfo(OrthancPlugins::GetGlobalContext(), arg0); @@ -912,6 +1020,7 @@ PyErr_SetString(PyExc_TypeError, "Bad types for the arguments (1 arguments expected)"); return NULL; } + OrthancPluginLogWarning(OrthancPlugins::GetGlobalContext(), arg0); @@ -930,6 +1039,7 @@ PyErr_SetString(PyExc_TypeError, "Bad types for the arguments (1 arguments expected)"); return NULL; } + OrthancPlugins::OrthancString s; s.Assign(OrthancPluginLookupInstance(OrthancPlugins::GetGlobalContext(), arg0)); @@ -955,6 +1065,7 @@ PyErr_SetString(PyExc_TypeError, "Bad types for the arguments (1 arguments expected)"); return NULL; } + OrthancPlugins::OrthancString s; s.Assign(OrthancPluginLookupPatient(OrthancPlugins::GetGlobalContext(), arg0)); @@ -980,6 +1091,7 @@ PyErr_SetString(PyExc_TypeError, "Bad types for the arguments (1 arguments expected)"); return NULL; } + OrthancPlugins::OrthancString s; s.Assign(OrthancPluginLookupSeries(OrthancPlugins::GetGlobalContext(), arg0)); @@ -1005,6 +1117,7 @@ PyErr_SetString(PyExc_TypeError, "Bad types for the arguments (1 arguments expected)"); return NULL; } + OrthancPlugins::OrthancString s; s.Assign(OrthancPluginLookupStudy(OrthancPlugins::GetGlobalContext(), arg0)); @@ -1030,6 +1143,7 @@ PyErr_SetString(PyExc_TypeError, "Bad types for the arguments (1 arguments expected)"); return NULL; } + OrthancPlugins::OrthancString s; s.Assign(OrthancPluginLookupStudyWithAccessionNumber(OrthancPlugins::GetGlobalContext(), arg0)); @@ -1055,6 +1169,7 @@ PyErr_SetString(PyExc_TypeError, "Bad types for the arguments (1 arguments expected)"); return NULL; } + OrthancPlugins::MemoryBuffer buffer; OrthancPluginErrorCode code = OrthancPluginReadFile(OrthancPlugins::GetGlobalContext(), *buffer, arg0); @@ -1085,6 +1200,7 @@ PyErr_SetString(PyExc_TypeError, "Bad types for the arguments (6 arguments expected)"); return NULL; } + OrthancPluginErrorCode code = OrthancPluginRegisterDictionaryTag(OrthancPlugins::GetGlobalContext(), arg0, arg1, static_cast(arg2), arg3, arg4, arg5); @@ -1113,6 +1229,7 @@ PyErr_SetString(PyExc_TypeError, "Bad types for the arguments (3 arguments expected)"); return NULL; } + OrthancPluginErrorCode code = OrthancPluginRegisterErrorCode(OrthancPlugins::GetGlobalContext(), arg0, arg1, arg2); @@ -1145,6 +1262,7 @@ PyErr_SetString(PyExc_TypeError, "Bad types for the arguments (7 arguments expected)"); return NULL; } + OrthancPluginErrorCode code = OrthancPluginRegisterPrivateDictionaryTag(OrthancPlugins::GetGlobalContext(), arg0, arg1, static_cast(arg2), arg3, arg4, arg5, arg6); @@ -1171,6 +1289,7 @@ PyErr_SetString(PyExc_TypeError, "Bad types for the arguments (1 arguments expected)"); return NULL; } + OrthancPluginErrorCode code = OrthancPluginRestApiDelete(OrthancPlugins::GetGlobalContext(), arg0); @@ -1197,6 +1316,7 @@ PyErr_SetString(PyExc_TypeError, "Bad types for the arguments (1 arguments expected)"); return NULL; } + OrthancPluginErrorCode code = OrthancPluginRestApiDeleteAfterPlugins(OrthancPlugins::GetGlobalContext(), arg0); @@ -1223,6 +1343,7 @@ PyErr_SetString(PyExc_TypeError, "Bad types for the arguments (1 arguments expected)"); return NULL; } + OrthancPlugins::MemoryBuffer buffer; OrthancPluginErrorCode code = OrthancPluginRestApiGet(OrthancPlugins::GetGlobalContext(), *buffer, arg0); @@ -1248,6 +1369,7 @@ PyErr_SetString(PyExc_TypeError, "Bad types for the arguments (1 arguments expected)"); return NULL; } + OrthancPlugins::MemoryBuffer buffer; OrthancPluginErrorCode code = OrthancPluginRestApiGetAfterPlugins(OrthancPlugins::GetGlobalContext(), *buffer, arg0); @@ -1274,6 +1396,7 @@ PyErr_SetString(PyExc_TypeError, "Bad types for the arguments (2 arguments expected)"); return NULL; } + OrthancPlugins::MemoryBuffer buffer; OrthancPluginErrorCode code = OrthancPluginRestApiPost(OrthancPlugins::GetGlobalContext(), *buffer, arg0, arg1.buf, arg1.len); PyBuffer_Release(&arg1); @@ -1300,6 +1423,7 @@ PyErr_SetString(PyExc_TypeError, "Bad types for the arguments (2 arguments expected)"); return NULL; } + OrthancPlugins::MemoryBuffer buffer; OrthancPluginErrorCode code = OrthancPluginRestApiPostAfterPlugins(OrthancPlugins::GetGlobalContext(), *buffer, arg0, arg1.buf, arg1.len); PyBuffer_Release(&arg1); @@ -1326,6 +1450,7 @@ PyErr_SetString(PyExc_TypeError, "Bad types for the arguments (2 arguments expected)"); return NULL; } + OrthancPlugins::MemoryBuffer buffer; OrthancPluginErrorCode code = OrthancPluginRestApiPut(OrthancPlugins::GetGlobalContext(), *buffer, arg0, arg1.buf, arg1.len); PyBuffer_Release(&arg1); @@ -1352,6 +1477,7 @@ PyErr_SetString(PyExc_TypeError, "Bad types for the arguments (2 arguments expected)"); return NULL; } + OrthancPlugins::MemoryBuffer buffer; OrthancPluginErrorCode code = OrthancPluginRestApiPutAfterPlugins(OrthancPlugins::GetGlobalContext(), *buffer, arg0, arg1.buf, arg1.len); PyBuffer_Release(&arg1); @@ -1377,6 +1503,7 @@ PyErr_SetString(PyExc_TypeError, "Bad types for the arguments (1 arguments expected)"); return NULL; } + OrthancPluginSetDescription(OrthancPlugins::GetGlobalContext(), arg0); @@ -1396,6 +1523,7 @@ PyErr_SetString(PyExc_TypeError, "Bad types for the arguments (2 arguments expected)"); return NULL; } + OrthancPluginErrorCode code = OrthancPluginSetGlobalProperty(OrthancPlugins::GetGlobalContext(), arg0, arg1); @@ -1424,6 +1552,7 @@ PyErr_SetString(PyExc_TypeError, "Bad types for the arguments (3 arguments expected)"); return NULL; } + OrthancPluginSetMetricsValue(OrthancPlugins::GetGlobalContext(), arg0, arg1, static_cast(arg2)); @@ -1442,6 +1571,7 @@ PyErr_SetString(PyExc_TypeError, "Bad types for the arguments (1 arguments expected)"); return NULL; } + OrthancPluginSetRootUri(OrthancPlugins::GetGlobalContext(), arg0); @@ -1461,6 +1591,7 @@ PyErr_SetString(PyExc_TypeError, "Bad types for the arguments (2 arguments expected)"); return NULL; } + // This is the case of a constructor OrthancPluginDicomInstance* obj = OrthancPluginTranscodeDicomInstance(OrthancPlugins::GetGlobalContext(), arg0.buf, arg0.len, arg2); PyBuffer_Release(&arg0); @@ -1490,6 +1621,7 @@ PyErr_SetString(PyExc_TypeError, "Bad types for the arguments (2 arguments expected)"); return NULL; } + // This is the case of a constructor OrthancPluginImage* obj = OrthancPluginUncompressImage(OrthancPlugins::GetGlobalContext(), arg0.buf, arg0.len, static_cast(arg2)); PyBuffer_Release(&arg0); @@ -1519,6 +1651,7 @@ PyErr_SetString(PyExc_TypeError, "Bad types for the arguments (2 arguments expected)"); return NULL; } + OrthancPluginErrorCode code = OrthancPluginWriteFile(OrthancPlugins::GetGlobalContext(), arg0, arg1.buf, arg1.len); PyBuffer_Release(&arg1); @@ -1553,6 +1686,10 @@ "Generated from C function OrthancPluginComputeMd5()" }, { "ComputeSha1", sdk_OrthancPluginComputeSha1, METH_VARARGS, "Generated from C function OrthancPluginComputeSha1()" }, + { "CreateDicom", sdk_OrthancPluginCreateDicom, METH_VARARGS, + "Generated from C function OrthancPluginCreateDicom()" }, + { "CreateDicom2", sdk_OrthancPluginCreateDicom2, METH_VARARGS, + "Generated from C function OrthancPluginCreateDicom2()" }, { "CreateDicomInstance", sdk_OrthancPluginCreateDicomInstance, METH_VARARGS, "Generated from C function OrthancPluginCreateDicomInstance()" }, { "CreateFindMatcher", sdk_OrthancPluginCreateFindMatcher, METH_VARARGS, diff -r 3c72d1f4c2a5 -r e9be3c9294d4 Sources/Autogenerated/sdk_OrthancPluginDicomInstance.methods.h --- a/Sources/Autogenerated/sdk_OrthancPluginDicomInstance.methods.h Thu Jun 27 17:50:51 2024 +0200 +++ b/Sources/Autogenerated/sdk_OrthancPluginDicomInstance.methods.h Thu Jun 27 18:02:06 2024 +0200 @@ -11,6 +11,7 @@ } + const char* s = OrthancPluginGetInstanceRemoteAet(OrthancPlugins::GetGlobalContext(), self->object_); if (s == NULL) @@ -36,6 +37,7 @@ } + long value = OrthancPluginGetInstanceSize(OrthancPlugins::GetGlobalContext(), self->object_); return PyLong_FromLong(value); @@ -53,6 +55,7 @@ } + OrthancPlugins::OrthancString s; s.Assign(OrthancPluginGetInstanceJson(OrthancPlugins::GetGlobalContext(), self->object_)); @@ -79,6 +82,7 @@ } + OrthancPlugins::OrthancString s; s.Assign(OrthancPluginGetInstanceSimplifiedJson(OrthancPlugins::GetGlobalContext(), self->object_)); @@ -111,6 +115,7 @@ PyErr_SetString(PyExc_TypeError, "Bad types for the arguments (1 arguments expected)"); return NULL; } + long value = OrthancPluginHasInstanceMetadata(OrthancPlugins::GetGlobalContext(), self->object_, arg0); return PyLong_FromLong(value); @@ -134,6 +139,7 @@ PyErr_SetString(PyExc_TypeError, "Bad types for the arguments (1 arguments expected)"); return NULL; } + const char* s = OrthancPluginGetInstanceMetadata(OrthancPlugins::GetGlobalContext(), self->object_, arg0); if (s == NULL) @@ -159,6 +165,7 @@ } + OrthancPluginInstanceOrigin value = OrthancPluginGetInstanceOrigin(OrthancPlugins::GetGlobalContext(), self->object_); return PyLong_FromLong(value); @@ -176,6 +183,7 @@ } + OrthancPlugins::OrthancString s; s.Assign(OrthancPluginGetInstanceTransferSyntaxUid(OrthancPlugins::GetGlobalContext(), self->object_)); @@ -202,6 +210,7 @@ } + long value = OrthancPluginHasInstancePixelData(OrthancPlugins::GetGlobalContext(), self->object_); return PyLong_FromLong(value); @@ -219,6 +228,7 @@ } + long value = OrthancPluginGetInstanceFramesCount(OrthancPlugins::GetGlobalContext(), self->object_); return PyLong_FromLong(value); @@ -242,6 +252,7 @@ PyErr_SetString(PyExc_TypeError, "Bad types for the arguments (1 arguments expected)"); return NULL; } + OrthancPlugins::MemoryBuffer buffer; OrthancPluginErrorCode code = OrthancPluginGetInstanceRawFrame(OrthancPlugins::GetGlobalContext(), *buffer, self->object_, arg0); @@ -274,6 +285,7 @@ PyErr_SetString(PyExc_TypeError, "Bad types for the arguments (1 arguments expected)"); return NULL; } + // This is the case of a constructor OrthancPluginImage* obj = OrthancPluginGetInstanceDecodedFrame(OrthancPlugins::GetGlobalContext(), self->object_, arg0); @@ -303,6 +315,7 @@ } + OrthancPlugins::MemoryBuffer buffer; OrthancPluginErrorCode code = OrthancPluginSerializeDicomInstance(OrthancPlugins::GetGlobalContext(), *buffer, self->object_); @@ -337,6 +350,7 @@ PyErr_SetString(PyExc_TypeError, "Bad types for the arguments (3 arguments expected)"); return NULL; } + OrthancPlugins::OrthancString s; s.Assign(OrthancPluginGetInstanceAdvancedJson(OrthancPlugins::GetGlobalContext(), self->object_, static_cast(arg0), static_cast(arg1), arg2)); diff -r 3c72d1f4c2a5 -r e9be3c9294d4 Sources/Autogenerated/sdk_OrthancPluginFindAnswers.methods.h --- a/Sources/Autogenerated/sdk_OrthancPluginFindAnswers.methods.h Thu Jun 27 17:50:51 2024 +0200 +++ b/Sources/Autogenerated/sdk_OrthancPluginFindAnswers.methods.h Thu Jun 27 18:02:06 2024 +0200 @@ -17,6 +17,7 @@ PyErr_SetString(PyExc_TypeError, "Bad types for the arguments (1 arguments expected)"); return NULL; } + OrthancPluginErrorCode code = OrthancPluginFindAddAnswer(OrthancPlugins::GetGlobalContext(), self->object_, arg0.buf, arg0.len); PyBuffer_Release(&arg0); @@ -44,6 +45,7 @@ } + OrthancPluginErrorCode code = OrthancPluginFindMarkIncomplete(OrthancPlugins::GetGlobalContext(), self->object_); diff -r 3c72d1f4c2a5 -r e9be3c9294d4 Sources/Autogenerated/sdk_OrthancPluginFindMatcher.methods.h --- a/Sources/Autogenerated/sdk_OrthancPluginFindMatcher.methods.h Thu Jun 27 17:50:51 2024 +0200 +++ b/Sources/Autogenerated/sdk_OrthancPluginFindMatcher.methods.h Thu Jun 27 18:02:06 2024 +0200 @@ -17,6 +17,7 @@ PyErr_SetString(PyExc_TypeError, "Bad types for the arguments (1 arguments expected)"); return NULL; } + long value = OrthancPluginFindMatcherIsMatch(OrthancPlugins::GetGlobalContext(), self->object_, arg0.buf, arg0.len); PyBuffer_Release(&arg0); return PyLong_FromLong(value); diff -r 3c72d1f4c2a5 -r e9be3c9294d4 Sources/Autogenerated/sdk_OrthancPluginFindQuery.methods.h --- a/Sources/Autogenerated/sdk_OrthancPluginFindQuery.methods.h Thu Jun 27 17:50:51 2024 +0200 +++ b/Sources/Autogenerated/sdk_OrthancPluginFindQuery.methods.h Thu Jun 27 18:02:06 2024 +0200 @@ -11,6 +11,7 @@ } + long value = OrthancPluginGetFindQuerySize(OrthancPlugins::GetGlobalContext(), self->object_); return PyLong_FromLong(value); @@ -34,6 +35,7 @@ PyErr_SetString(PyExc_TypeError, "Bad types for the arguments (1 arguments expected)"); return NULL; } + OrthancPlugins::OrthancString s; s.Assign(OrthancPluginGetFindQueryTagName(OrthancPlugins::GetGlobalContext(), self->object_, arg0)); @@ -66,6 +68,7 @@ PyErr_SetString(PyExc_TypeError, "Bad types for the arguments (1 arguments expected)"); return NULL; } + OrthancPlugins::OrthancString s; s.Assign(OrthancPluginGetFindQueryValue(OrthancPlugins::GetGlobalContext(), self->object_, arg0)); diff -r 3c72d1f4c2a5 -r e9be3c9294d4 Sources/Autogenerated/sdk_OrthancPluginImage.methods.h --- a/Sources/Autogenerated/sdk_OrthancPluginImage.methods.h Thu Jun 27 17:50:51 2024 +0200 +++ b/Sources/Autogenerated/sdk_OrthancPluginImage.methods.h Thu Jun 27 18:02:06 2024 +0200 @@ -11,6 +11,7 @@ } + OrthancPluginPixelFormat value = OrthancPluginGetImagePixelFormat(OrthancPlugins::GetGlobalContext(), self->object_); return PyLong_FromLong(value); @@ -28,6 +29,7 @@ } + long value = OrthancPluginGetImageWidth(OrthancPlugins::GetGlobalContext(), self->object_); return PyLong_FromLong(value); @@ -45,6 +47,7 @@ } + long value = OrthancPluginGetImageHeight(OrthancPlugins::GetGlobalContext(), self->object_); return PyLong_FromLong(value); @@ -62,6 +65,7 @@ } + long value = OrthancPluginGetImagePitch(OrthancPlugins::GetGlobalContext(), self->object_); return PyLong_FromLong(value); @@ -85,6 +89,7 @@ PyErr_SetString(PyExc_TypeError, "Bad types for the arguments (1 arguments expected)"); return NULL; } + // This is the case of a constructor OrthancPluginImage* obj = OrthancPluginConvertPixelFormat(OrthancPlugins::GetGlobalContext(), self->object_, static_cast(arg0)); @@ -126,6 +131,7 @@ PyErr_SetString(PyExc_TypeError, "Bad types for the arguments (7 arguments expected)"); return NULL; } + OrthancPluginErrorCode code = OrthancPluginDrawText(OrthancPlugins::GetGlobalContext(), self->object_, arg0, arg1, arg2, arg3, arg4, arg5, arg6); diff -r 3c72d1f4c2a5 -r e9be3c9294d4 Sources/Autogenerated/sdk_OrthancPluginJob.methods.h --- a/Sources/Autogenerated/sdk_OrthancPluginJob.methods.h Thu Jun 27 17:50:51 2024 +0200 +++ b/Sources/Autogenerated/sdk_OrthancPluginJob.methods.h Thu Jun 27 18:02:06 2024 +0200 @@ -10,13 +10,14 @@ return NULL; } - int arg0 = 0; + long int arg0 = 0; - if (!PyArg_ParseTuple(args, "i", &arg0)) + if (!PyArg_ParseTuple(args, "l", &arg0)) { PyErr_SetString(PyExc_TypeError, "Bad types for the arguments (1 arguments expected)"); return NULL; } + OrthancPlugins::OrthancString s; s.Assign(OrthancPluginSubmitJob(OrthancPlugins::GetGlobalContext(), self->object_, arg0)); diff -r 3c72d1f4c2a5 -r e9be3c9294d4 Sources/Autogenerated/sdk_OrthancPluginPeers.methods.h --- a/Sources/Autogenerated/sdk_OrthancPluginPeers.methods.h Thu Jun 27 17:50:51 2024 +0200 +++ b/Sources/Autogenerated/sdk_OrthancPluginPeers.methods.h Thu Jun 27 18:02:06 2024 +0200 @@ -11,6 +11,7 @@ } + long value = OrthancPluginGetPeersCount(OrthancPlugins::GetGlobalContext(), self->object_); return PyLong_FromLong(value); @@ -34,6 +35,7 @@ PyErr_SetString(PyExc_TypeError, "Bad types for the arguments (1 arguments expected)"); return NULL; } + const char* s = OrthancPluginGetPeerName(OrthancPlugins::GetGlobalContext(), self->object_, arg0); if (s == NULL) @@ -65,6 +67,7 @@ PyErr_SetString(PyExc_TypeError, "Bad types for the arguments (1 arguments expected)"); return NULL; } + const char* s = OrthancPluginGetPeerUrl(OrthancPlugins::GetGlobalContext(), self->object_, arg0); if (s == NULL) @@ -97,6 +100,7 @@ PyErr_SetString(PyExc_TypeError, "Bad types for the arguments (2 arguments expected)"); return NULL; } + const char* s = OrthancPluginGetPeerUserProperty(OrthancPlugins::GetGlobalContext(), self->object_, arg0, arg1); if (s == NULL) diff -r 3c72d1f4c2a5 -r e9be3c9294d4 Sources/Autogenerated/sdk_OrthancPluginRestOutput.methods.h --- a/Sources/Autogenerated/sdk_OrthancPluginRestOutput.methods.h Thu Jun 27 17:50:51 2024 +0200 +++ b/Sources/Autogenerated/sdk_OrthancPluginRestOutput.methods.h Thu Jun 27 18:02:06 2024 +0200 @@ -18,6 +18,7 @@ PyErr_SetString(PyExc_TypeError, "Bad types for the arguments (2 arguments expected)"); return NULL; } + OrthancPluginAnswerBuffer(OrthancPlugins::GetGlobalContext(), self->object_, arg0.buf, arg0.len, arg2); PyBuffer_Release(&arg0); @@ -47,6 +48,7 @@ PyErr_SetString(PyExc_TypeError, "Bad types for the arguments (5 arguments expected)"); return NULL; } + OrthancPluginCompressAndAnswerPngImage(OrthancPlugins::GetGlobalContext(), self->object_, static_cast(arg0), arg1, arg2, arg3, arg4.buf); PyBuffer_Release(&arg4); @@ -72,6 +74,7 @@ PyErr_SetString(PyExc_TypeError, "Bad types for the arguments (1 arguments expected)"); return NULL; } + OrthancPluginRedirect(OrthancPlugins::GetGlobalContext(), self->object_, arg0); @@ -97,6 +100,7 @@ PyErr_SetString(PyExc_TypeError, "Bad types for the arguments (1 arguments expected)"); return NULL; } + OrthancPluginSendHttpStatusCode(OrthancPlugins::GetGlobalContext(), self->object_, arg0); @@ -122,6 +126,7 @@ PyErr_SetString(PyExc_TypeError, "Bad types for the arguments (1 arguments expected)"); return NULL; } + OrthancPluginSendUnauthorized(OrthancPlugins::GetGlobalContext(), self->object_, arg0); @@ -147,6 +152,7 @@ PyErr_SetString(PyExc_TypeError, "Bad types for the arguments (1 arguments expected)"); return NULL; } + OrthancPluginSendMethodNotAllowed(OrthancPlugins::GetGlobalContext(), self->object_, arg0); @@ -173,6 +179,7 @@ PyErr_SetString(PyExc_TypeError, "Bad types for the arguments (2 arguments expected)"); return NULL; } + OrthancPluginSetCookie(OrthancPlugins::GetGlobalContext(), self->object_, arg0, arg1); @@ -199,6 +206,7 @@ PyErr_SetString(PyExc_TypeError, "Bad types for the arguments (2 arguments expected)"); return NULL; } + OrthancPluginSetHttpHeader(OrthancPlugins::GetGlobalContext(), self->object_, arg0, arg1); @@ -225,6 +233,7 @@ PyErr_SetString(PyExc_TypeError, "Bad types for the arguments (2 arguments expected)"); return NULL; } + OrthancPluginErrorCode code = OrthancPluginStartMultipartAnswer(OrthancPlugins::GetGlobalContext(), self->object_, arg0, arg1); @@ -258,6 +267,7 @@ PyErr_SetString(PyExc_TypeError, "Bad types for the arguments (1 arguments expected)"); return NULL; } + OrthancPluginErrorCode code = OrthancPluginSendMultipartItem(OrthancPlugins::GetGlobalContext(), self->object_, arg0.buf, arg0.len); PyBuffer_Release(&arg0); @@ -285,16 +295,16 @@ } unsigned short arg0 = 0; - const char* arg1 = NULL; - unsigned long arg2 = 0; + Py_buffer arg1; - if (!PyArg_ParseTuple(args, "Hsk", &arg0, &arg1, &arg2)) + if (!PyArg_ParseTuple(args, "Hs*", &arg0, &arg1)) { - PyErr_SetString(PyExc_TypeError, "Bad types for the arguments (3 arguments expected)"); + PyErr_SetString(PyExc_TypeError, "Bad types for the arguments (2 arguments expected)"); return NULL; } - OrthancPluginSendHttpStatus(OrthancPlugins::GetGlobalContext(), self->object_, arg0, arg1, arg2); - + + OrthancPluginSendHttpStatus(OrthancPlugins::GetGlobalContext(), self->object_, arg0, arg1.buf, arg1.len); + PyBuffer_Release(&arg1); Py_INCREF(Py_None); return Py_None; @@ -323,6 +333,7 @@ PyErr_SetString(PyExc_TypeError, "Bad types for the arguments (6 arguments expected)"); return NULL; } + OrthancPluginCompressAndAnswerJpegImage(OrthancPlugins::GetGlobalContext(), self->object_, static_cast(arg0), arg1, arg2, arg3, arg4.buf, arg5); PyBuffer_Release(&arg4); @@ -349,6 +360,7 @@ PyErr_SetString(PyExc_TypeError, "Bad types for the arguments (2 arguments expected)"); return NULL; } + OrthancPluginSetHttpErrorDetails(OrthancPlugins::GetGlobalContext(), self->object_, arg0, arg1); diff -r 3c72d1f4c2a5 -r e9be3c9294d4 Sources/Autogenerated/sdk_OrthancPluginStorageArea.methods.h --- a/Sources/Autogenerated/sdk_OrthancPluginStorageArea.methods.h Thu Jun 27 17:50:51 2024 +0200 +++ b/Sources/Autogenerated/sdk_OrthancPluginStorageArea.methods.h Thu Jun 27 18:02:06 2024 +0200 @@ -20,6 +20,7 @@ PyErr_SetString(PyExc_TypeError, "Bad types for the arguments (4 arguments expected)"); return NULL; } + OrthancPluginErrorCode code = OrthancPluginStorageAreaCreate(OrthancPlugins::GetGlobalContext(), self->object_, arg0, arg1.buf, arg2, static_cast(arg3)); PyBuffer_Release(&arg1); @@ -54,6 +55,7 @@ PyErr_SetString(PyExc_TypeError, "Bad types for the arguments (2 arguments expected)"); return NULL; } + OrthancPlugins::MemoryBuffer buffer; OrthancPluginErrorCode code = OrthancPluginStorageAreaRead(OrthancPlugins::GetGlobalContext(), *buffer, self->object_, arg0, static_cast(arg1)); @@ -87,6 +89,7 @@ PyErr_SetString(PyExc_TypeError, "Bad types for the arguments (2 arguments expected)"); return NULL; } + OrthancPluginErrorCode code = OrthancPluginStorageAreaRemove(OrthancPlugins::GetGlobalContext(), self->object_, arg0, static_cast(arg1)); @@ -120,6 +123,7 @@ PyErr_SetString(PyExc_TypeError, "Bad types for the arguments (1 arguments expected)"); return NULL; } + OrthancPluginErrorCode code = OrthancPluginReconstructMainDicomTags(OrthancPlugins::GetGlobalContext(), self->object_, static_cast(arg0)); diff -r 3c72d1f4c2a5 -r e9be3c9294d4 Sources/Autogenerated/sdk_OrthancPluginWorklistAnswers.impl.h --- a/Sources/Autogenerated/sdk_OrthancPluginWorklistAnswers.impl.h Thu Jun 27 17:50:51 2024 +0200 +++ b/Sources/Autogenerated/sdk_OrthancPluginWorklistAnswers.impl.h Thu Jun 27 18:02:06 2024 +0200 @@ -20,24 +20,24 @@ // Forward declaration of the autogenerated methods +static PyObject *sdk_OrthancPluginWorklistAnswers_OrthancPluginWorklistAddAnswer( + sdk_OrthancPluginWorklistAnswers_Object* self, PyObject *args); static PyObject *sdk_OrthancPluginWorklistAnswers_OrthancPluginWorklistMarkIncomplete( sdk_OrthancPluginWorklistAnswers_Object* self, PyObject *args); // End of forward declarations // Forward declaration of the custom methods -extern PyObject *WorklistAddAnswer( - sdk_OrthancPluginWorklistAnswers_Object* self, PyObject *args); // End of forward declarations static PyMethodDef sdk_OrthancPluginWorklistAnswers_Methods[] = { + { "WorklistAddAnswer", + (PyCFunction) sdk_OrthancPluginWorklistAnswers_OrthancPluginWorklistAddAnswer, METH_VARARGS, + "Generated from C function OrthancPluginWorklistAddAnswer()" }, { "WorklistMarkIncomplete", (PyCFunction) sdk_OrthancPluginWorklistAnswers_OrthancPluginWorklistMarkIncomplete, METH_VARARGS, "Generated from C function OrthancPluginWorklistMarkIncomplete()" }, - { "WorklistAddAnswer", - (PyCFunction) WorklistAddAnswer, METH_VARARGS, - "Generated from C function OrthancPluginWorklistAddAnswer()" }, { NULL } /* Sentinel */ }; diff -r 3c72d1f4c2a5 -r e9be3c9294d4 Sources/Autogenerated/sdk_OrthancPluginWorklistAnswers.methods.h --- a/Sources/Autogenerated/sdk_OrthancPluginWorklistAnswers.methods.h Thu Jun 27 17:50:51 2024 +0200 +++ b/Sources/Autogenerated/sdk_OrthancPluginWorklistAnswers.methods.h Thu Jun 27 18:02:06 2024 +0200 @@ -1,4 +1,45 @@ // Actual implementation of the methods +static PyObject *sdk_OrthancPluginWorklistAnswers_OrthancPluginWorklistAddAnswer( + sdk_OrthancPluginWorklistAnswers_Object* self, PyObject *args) +{ + PythonLock::LogCall("Calling method OrthancPluginWorklistAddAnswer() on object of class OrthancPluginWorklistAnswers"); + + if (self->object_ == NULL) + { + PyErr_SetString(PyExc_ValueError, "Invalid object"); + return NULL; + } + + PyObject* arg0 = NULL; + Py_buffer arg1; + + if (!PyArg_ParseTuple(args, "Os*", &arg0, &arg1)) + { + PyErr_SetString(PyExc_TypeError, "Bad types for the arguments (2 arguments expected)"); + return NULL; + } + + if (arg0 != Py_None && Py_TYPE(arg0) != GetOrthancPluginWorklistQueryType()) + { + PyErr_SetString(PyExc_TypeError, "Invalid orthanc.OrthancPluginWorklistQuery object"); + return NULL; + } + + OrthancPluginErrorCode code = OrthancPluginWorklistAddAnswer(OrthancPlugins::GetGlobalContext(), self->object_, arg0 == Py_None ? NULL : reinterpret_cast(arg0)->object_, arg1.buf, arg1.len); + PyBuffer_Release(&arg1); + + if (code == OrthancPluginErrorCode_Success) + { + Py_INCREF(Py_None); + return Py_None; + } + else + { + PythonLock::RaiseException(code); + return NULL; + } +} + static PyObject *sdk_OrthancPluginWorklistAnswers_OrthancPluginWorklistMarkIncomplete( sdk_OrthancPluginWorklistAnswers_Object* self, PyObject *args) { @@ -11,6 +52,7 @@ } + OrthancPluginErrorCode code = OrthancPluginWorklistMarkIncomplete(OrthancPlugins::GetGlobalContext(), self->object_); diff -r 3c72d1f4c2a5 -r e9be3c9294d4 Sources/Autogenerated/sdk_OrthancPluginWorklistQuery.methods.h --- a/Sources/Autogenerated/sdk_OrthancPluginWorklistQuery.methods.h Thu Jun 27 17:50:51 2024 +0200 +++ b/Sources/Autogenerated/sdk_OrthancPluginWorklistQuery.methods.h Thu Jun 27 18:02:06 2024 +0200 @@ -17,6 +17,7 @@ PyErr_SetString(PyExc_TypeError, "Bad types for the arguments (1 arguments expected)"); return NULL; } + long value = OrthancPluginWorklistIsMatch(OrthancPlugins::GetGlobalContext(), self->object_, arg0.buf, arg0.len); PyBuffer_Release(&arg0); return PyLong_FromLong(value); @@ -34,6 +35,7 @@ } + OrthancPlugins::MemoryBuffer buffer; OrthancPluginErrorCode code = OrthancPluginWorklistGetDicomQuery(OrthancPlugins::GetGlobalContext(), *buffer, self->object_); diff -r 3c72d1f4c2a5 -r e9be3c9294d4 Sources/DicomScpCallbacks.cpp --- a/Sources/DicomScpCallbacks.cpp Thu Jun 27 17:50:51 2024 +0200 +++ b/Sources/DicomScpCallbacks.cpp Thu Jun 27 18:02:06 2024 +0200 @@ -83,49 +83,6 @@ { return GetFindQueryTag(self, args, false); } - -PyObject *WorklistAddAnswer(sdk_OrthancPluginWorklistAnswers_Object* self, PyObject *args) -{ - PyObject* query = NULL; - Py_buffer dicom; - - if (self->object_ == NULL) - { - PyErr_SetString(PyExc_ValueError, "Invalid object"); - return NULL; - } - else if (!PyArg_ParseTuple(args, "Os*", &query, &dicom)) - { - PyErr_SetString(PyExc_TypeError, "Please provide a orthanc.WorklistQuery object, and a DICOM buffer"); - return NULL; - } - else if (query == Py_None || - Py_TYPE(query) != GetOrthancPluginWorklistQueryType()) - { - PyErr_SetString(PyExc_TypeError, "Invalid orthanc.WorklistQuery object"); - return NULL; - } - else - { - OrthancPluginErrorCode code = OrthancPluginWorklistAddAnswer( - OrthancPlugins::GetGlobalContext(), self->object_, - reinterpret_cast(query)->object_, - dicom.buf, dicom.len); - - PyBuffer_Release(&dicom); - - if (code == OrthancPluginErrorCode_Success) - { - Py_INCREF(Py_None); - return Py_None; - } - else - { - PyErr_SetString(PyExc_ValueError, "Internal error"); - return NULL; - } - } -} // End of "CUSTOM_METHODS" diff -r 3c72d1f4c2a5 -r e9be3c9294d4 Sources/Plugin.cpp --- a/Sources/Plugin.cpp Thu Jun 27 17:50:51 2024 +0200 +++ b/Sources/Plugin.cpp Thu Jun 27 18:02:06 2024 +0200 @@ -121,53 +121,6 @@ } -PyObject* CreateDicom(PyObject* module, PyObject* args) -{ - // The GIL is locked at this point (no need to create "PythonLock") - const char* json = NULL; - PyObject* pixelData = NULL; - long int flags = 0; - - if (!PyArg_ParseTuple(args, "sOl", &json, &pixelData, &flags)) - { - PyErr_SetString(PyExc_TypeError, "Please provide a JSON string, an orthanc.Image object, and a set of orthanc.CreateDicomFlags"); - return NULL; - } - else - { - OrthancPluginImage* image = NULL; - - if (pixelData == Py_None) - { - // No pixel data - } - else if (Py_TYPE(pixelData) == GetOrthancPluginImageType()) - { - image = reinterpret_cast(pixelData)->object_; - } - else - { - PyErr_SetString(PyExc_TypeError, "Second parameter is not a valid orthanc.Image object"); - return NULL; - } - - OrthancPlugins::MemoryBuffer buffer; - OrthancPluginErrorCode code = OrthancPluginCreateDicom(OrthancPlugins::GetGlobalContext(), *buffer, json, image, - static_cast(flags)); - - if (code == OrthancPluginErrorCode_Success) - { - return PyBytes_FromStringAndSize(buffer.GetData(), buffer.GetSize()); - } - else - { - PyErr_SetString(PyExc_ValueError, "Cannot create the DICOM instance"); - return NULL; - } - } -} - - PyObject* GetInstanceData(sdk_OrthancPluginDicomInstance_Object* self, PyObject *args) { // The GIL is locked at this point (no need to create "PythonLock") @@ -367,11 +320,6 @@ } { - PyMethodDef f = { "CreateDicom", CreateDicom, METH_VARARGS, "" }; - functions.push_back(f); - } - - { PyMethodDef f = { "CreateImageFromBuffer", CreateImageFromBuffer, METH_VARARGS, "" }; functions.push_back(f); }