annotate Sources/DicomScpCallbacks.cpp @ 170:b49eeb36cd0d

removed generation of code model, now part of orthanc-java
author Sebastien Jodogne <s.jodogne@gmail.com>
date Thu, 27 Jun 2024 14:26:59 +0200
parents 6fada29b6759
children e9be3c9294d4
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
63
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1 /**
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2 * Python plugin for Orthanc
166
6fada29b6759 updated copyright, as Orthanc Team now replaces Osimis
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 157
diff changeset
3 * Copyright (C) 2020-2023 Osimis S.A., Belgium
6fada29b6759 updated copyright, as Orthanc Team now replaces Osimis
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 157
diff changeset
4 * Copyright (C) 2024-2024 Orthanc Team SRL, Belgium
155
71d305c29cfa updated year to 2024
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 131
diff changeset
5 * Copyright (C) 2021-2024 Sebastien Jodogne, ICTEAM UCLouvain, Belgium
63
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6 *
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7 * This program is free software: you can redistribute it and/or
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8 * modify it under the terms of the GNU Affero General Public License
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
9 * as published by the Free Software Foundation, either version 3 of
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
10 * the License, or (at your option) any later version.
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
11 *
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
12 * This program is distributed in the hope that it will be useful, but
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
13 * WITHOUT ANY WARRANTY; without even the implied warranty of
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
15 * Affero General Public License for more details.
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
16 *
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
17 * You should have received a copy of the GNU Affero General Public License
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
18 * along with this program. If not, see <http://www.gnu.org/licenses/>.
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
19 **/
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
20
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
21
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
22 #include "DicomScpCallbacks.h"
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
23
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
24 #include "../Resources/Orthanc/Plugins/OrthancPluginCppWrapper.h"
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
25 #include "Autogenerated/sdk.h"
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
26 #include "ICallbackRegistration.h"
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
27 #include "PythonString.h"
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
28
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
29
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
30 static PyObject* findScpCallback_ = NULL;
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
31 static PyObject* moveScpCallback_ = NULL;
64
091fb1903bfc new wrapped function: orthanc.RegisterWorklistCallback() and orthanc.WorklistAnswers.WorklistAddAnswer()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 63
diff changeset
32 static PyObject* worklistScpCallback_ = NULL;
63
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
33
151
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
34 // version 2 of Move callbacks
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
35 static PyObject* createMoveScpDriverCallback_ = NULL;
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
36 static PyObject* getMoveSizeCallback_ = NULL;
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
37 static PyObject* applyMoveCallback_ = NULL;
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
38 static PyObject* freeMoveCallback_ = NULL;
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
39
63
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
40
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
41 static PyObject *GetFindQueryTag(sdk_OrthancPluginFindQuery_Object* self,
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
42 PyObject *args,
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
43 bool isGroup)
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
44 {
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
45 unsigned long index;
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
46 uint16_t group, element;
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
47
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
48 if (self->object_ == NULL)
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
49 {
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
50 PyErr_SetString(PyExc_ValueError, "Invalid object");
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
51 return NULL;
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
52 }
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
53 else if (!PyArg_ParseTuple(args, "k", &index))
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
54 {
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
55 PyErr_SetString(PyExc_TypeError, "Index is missing");
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
56 return NULL;
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
57 }
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
58 else if (OrthancPluginGetFindQueryTag(OrthancPlugins::GetGlobalContext(), &group, &element, self->object_, index) !=
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
59 OrthancPluginErrorCode_Success)
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
60 {
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
61 PyErr_SetString(PyExc_ValueError, "Index is out of range");
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
62 return NULL;
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
63 }
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
64 else if (isGroup)
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
65 {
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
66 return PyLong_FromUnsignedLong(group);
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
67 }
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
68 else
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
69 {
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
70 return PyLong_FromUnsignedLong(element);
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
71 }
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
72 }
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
73
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
74
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
75
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
76 // Check out "CUSTOM_METHODS" in "../CodeAnalysis/ParseOrthancSDK.py"
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
77 PyObject *GetFindQueryTagGroup(sdk_OrthancPluginFindQuery_Object* self, PyObject *args)
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
78 {
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
79 return GetFindQueryTag(self, args, true);
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
80 }
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
81
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
82 PyObject *GetFindQueryTagElement(sdk_OrthancPluginFindQuery_Object* self, PyObject *args)
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
83 {
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
84 return GetFindQueryTag(self, args, false);
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
85 }
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
86
64
091fb1903bfc new wrapped function: orthanc.RegisterWorklistCallback() and orthanc.WorklistAnswers.WorklistAddAnswer()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 63
diff changeset
87 PyObject *WorklistAddAnswer(sdk_OrthancPluginWorklistAnswers_Object* self, PyObject *args)
091fb1903bfc new wrapped function: orthanc.RegisterWorklistCallback() and orthanc.WorklistAnswers.WorklistAddAnswer()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 63
diff changeset
88 {
091fb1903bfc new wrapped function: orthanc.RegisterWorklistCallback() and orthanc.WorklistAnswers.WorklistAddAnswer()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 63
diff changeset
89 PyObject* query = NULL;
091fb1903bfc new wrapped function: orthanc.RegisterWorklistCallback() and orthanc.WorklistAnswers.WorklistAddAnswer()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 63
diff changeset
90 Py_buffer dicom;
091fb1903bfc new wrapped function: orthanc.RegisterWorklistCallback() and orthanc.WorklistAnswers.WorklistAddAnswer()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 63
diff changeset
91
091fb1903bfc new wrapped function: orthanc.RegisterWorklistCallback() and orthanc.WorklistAnswers.WorklistAddAnswer()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 63
diff changeset
92 if (self->object_ == NULL)
091fb1903bfc new wrapped function: orthanc.RegisterWorklistCallback() and orthanc.WorklistAnswers.WorklistAddAnswer()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 63
diff changeset
93 {
091fb1903bfc new wrapped function: orthanc.RegisterWorklistCallback() and orthanc.WorklistAnswers.WorklistAddAnswer()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 63
diff changeset
94 PyErr_SetString(PyExc_ValueError, "Invalid object");
091fb1903bfc new wrapped function: orthanc.RegisterWorklistCallback() and orthanc.WorklistAnswers.WorklistAddAnswer()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 63
diff changeset
95 return NULL;
091fb1903bfc new wrapped function: orthanc.RegisterWorklistCallback() and orthanc.WorklistAnswers.WorklistAddAnswer()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 63
diff changeset
96 }
091fb1903bfc new wrapped function: orthanc.RegisterWorklistCallback() and orthanc.WorklistAnswers.WorklistAddAnswer()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 63
diff changeset
97 else if (!PyArg_ParseTuple(args, "Os*", &query, &dicom))
091fb1903bfc new wrapped function: orthanc.RegisterWorklistCallback() and orthanc.WorklistAnswers.WorklistAddAnswer()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 63
diff changeset
98 {
091fb1903bfc new wrapped function: orthanc.RegisterWorklistCallback() and orthanc.WorklistAnswers.WorklistAddAnswer()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 63
diff changeset
99 PyErr_SetString(PyExc_TypeError, "Please provide a orthanc.WorklistQuery object, and a DICOM buffer");
091fb1903bfc new wrapped function: orthanc.RegisterWorklistCallback() and orthanc.WorklistAnswers.WorklistAddAnswer()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 63
diff changeset
100 return NULL;
091fb1903bfc new wrapped function: orthanc.RegisterWorklistCallback() and orthanc.WorklistAnswers.WorklistAddAnswer()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 63
diff changeset
101 }
091fb1903bfc new wrapped function: orthanc.RegisterWorklistCallback() and orthanc.WorklistAnswers.WorklistAddAnswer()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 63
diff changeset
102 else if (query == Py_None ||
091fb1903bfc new wrapped function: orthanc.RegisterWorklistCallback() and orthanc.WorklistAnswers.WorklistAddAnswer()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 63
diff changeset
103 Py_TYPE(query) != GetOrthancPluginWorklistQueryType())
091fb1903bfc new wrapped function: orthanc.RegisterWorklistCallback() and orthanc.WorklistAnswers.WorklistAddAnswer()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 63
diff changeset
104 {
091fb1903bfc new wrapped function: orthanc.RegisterWorklistCallback() and orthanc.WorklistAnswers.WorklistAddAnswer()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 63
diff changeset
105 PyErr_SetString(PyExc_TypeError, "Invalid orthanc.WorklistQuery object");
091fb1903bfc new wrapped function: orthanc.RegisterWorklistCallback() and orthanc.WorklistAnswers.WorklistAddAnswer()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 63
diff changeset
106 return NULL;
091fb1903bfc new wrapped function: orthanc.RegisterWorklistCallback() and orthanc.WorklistAnswers.WorklistAddAnswer()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 63
diff changeset
107 }
091fb1903bfc new wrapped function: orthanc.RegisterWorklistCallback() and orthanc.WorklistAnswers.WorklistAddAnswer()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 63
diff changeset
108 else
091fb1903bfc new wrapped function: orthanc.RegisterWorklistCallback() and orthanc.WorklistAnswers.WorklistAddAnswer()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 63
diff changeset
109 {
091fb1903bfc new wrapped function: orthanc.RegisterWorklistCallback() and orthanc.WorklistAnswers.WorklistAddAnswer()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 63
diff changeset
110 OrthancPluginErrorCode code = OrthancPluginWorklistAddAnswer(
091fb1903bfc new wrapped function: orthanc.RegisterWorklistCallback() and orthanc.WorklistAnswers.WorklistAddAnswer()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 63
diff changeset
111 OrthancPlugins::GetGlobalContext(), self->object_,
091fb1903bfc new wrapped function: orthanc.RegisterWorklistCallback() and orthanc.WorklistAnswers.WorklistAddAnswer()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 63
diff changeset
112 reinterpret_cast<sdk_OrthancPluginWorklistQuery_Object*>(query)->object_,
091fb1903bfc new wrapped function: orthanc.RegisterWorklistCallback() and orthanc.WorklistAnswers.WorklistAddAnswer()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 63
diff changeset
113 dicom.buf, dicom.len);
091fb1903bfc new wrapped function: orthanc.RegisterWorklistCallback() and orthanc.WorklistAnswers.WorklistAddAnswer()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 63
diff changeset
114
091fb1903bfc new wrapped function: orthanc.RegisterWorklistCallback() and orthanc.WorklistAnswers.WorklistAddAnswer()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 63
diff changeset
115 PyBuffer_Release(&dicom);
091fb1903bfc new wrapped function: orthanc.RegisterWorklistCallback() and orthanc.WorklistAnswers.WorklistAddAnswer()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 63
diff changeset
116
091fb1903bfc new wrapped function: orthanc.RegisterWorklistCallback() and orthanc.WorklistAnswers.WorklistAddAnswer()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 63
diff changeset
117 if (code == OrthancPluginErrorCode_Success)
091fb1903bfc new wrapped function: orthanc.RegisterWorklistCallback() and orthanc.WorklistAnswers.WorklistAddAnswer()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 63
diff changeset
118 {
091fb1903bfc new wrapped function: orthanc.RegisterWorklistCallback() and orthanc.WorklistAnswers.WorklistAddAnswer()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 63
diff changeset
119 Py_INCREF(Py_None);
091fb1903bfc new wrapped function: orthanc.RegisterWorklistCallback() and orthanc.WorklistAnswers.WorklistAddAnswer()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 63
diff changeset
120 return Py_None;
091fb1903bfc new wrapped function: orthanc.RegisterWorklistCallback() and orthanc.WorklistAnswers.WorklistAddAnswer()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 63
diff changeset
121 }
091fb1903bfc new wrapped function: orthanc.RegisterWorklistCallback() and orthanc.WorklistAnswers.WorklistAddAnswer()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 63
diff changeset
122 else
091fb1903bfc new wrapped function: orthanc.RegisterWorklistCallback() and orthanc.WorklistAnswers.WorklistAddAnswer()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 63
diff changeset
123 {
091fb1903bfc new wrapped function: orthanc.RegisterWorklistCallback() and orthanc.WorklistAnswers.WorklistAddAnswer()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 63
diff changeset
124 PyErr_SetString(PyExc_ValueError, "Internal error");
091fb1903bfc new wrapped function: orthanc.RegisterWorklistCallback() and orthanc.WorklistAnswers.WorklistAddAnswer()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 63
diff changeset
125 return NULL;
091fb1903bfc new wrapped function: orthanc.RegisterWorklistCallback() and orthanc.WorklistAnswers.WorklistAddAnswer()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 63
diff changeset
126 }
091fb1903bfc new wrapped function: orthanc.RegisterWorklistCallback() and orthanc.WorklistAnswers.WorklistAddAnswer()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 63
diff changeset
127 }
091fb1903bfc new wrapped function: orthanc.RegisterWorklistCallback() and orthanc.WorklistAnswers.WorklistAddAnswer()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 63
diff changeset
128 }
091fb1903bfc new wrapped function: orthanc.RegisterWorklistCallback() and orthanc.WorklistAnswers.WorklistAddAnswer()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 63
diff changeset
129 // End of "CUSTOM_METHODS"
091fb1903bfc new wrapped function: orthanc.RegisterWorklistCallback() and orthanc.WorklistAnswers.WorklistAddAnswer()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 63
diff changeset
130
091fb1903bfc new wrapped function: orthanc.RegisterWorklistCallback() and orthanc.WorklistAnswers.WorklistAddAnswer()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 63
diff changeset
131
63
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
132
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
133 static OrthancPluginErrorCode FindCallback(OrthancPluginFindAnswers *answers,
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
134 const OrthancPluginFindQuery *query,
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
135 const char *issuerAet,
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
136 const char *calledAet)
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
137 {
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
138 try
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
139 {
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
140 PythonLock lock;
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
141
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
142 PyObject *pAnswers, *pQuery;
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
143
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
144 {
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
145 PythonObject args(lock, PyTuple_New(2));
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
146 PyTuple_SetItem(args.GetPyObject(), 0, PyLong_FromSsize_t((intptr_t) answers));
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
147 PyTuple_SetItem(args.GetPyObject(), 1, PyBool_FromLong(true /* borrowed, don't destruct */));
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
148 pAnswers = PyObject_CallObject((PyObject *) GetOrthancPluginFindAnswersType(), args.GetPyObject());
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
149 }
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
150
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
151 {
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
152 PythonObject args(lock, PyTuple_New(2));
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
153 PyTuple_SetItem(args.GetPyObject(), 0, PyLong_FromSsize_t((intptr_t) query));
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
154 PyTuple_SetItem(args.GetPyObject(), 1, PyBool_FromLong(true /* borrowed, don't destruct */));
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
155 pQuery = PyObject_CallObject((PyObject *) GetOrthancPluginFindQueryType(), args.GetPyObject());
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
156 }
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
157
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
158 PythonString pIssuerAet(lock, issuerAet);
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
159 PythonString pCalledAet(lock, calledAet);
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
160
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
161 {
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
162 PythonObject args(lock, PyTuple_New(4));
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
163 PyTuple_SetItem(args.GetPyObject(), 0, pAnswers);
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
164 PyTuple_SetItem(args.GetPyObject(), 1, pQuery);
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
165 PyTuple_SetItem(args.GetPyObject(), 2, pIssuerAet.Release());
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
166 PyTuple_SetItem(args.GetPyObject(), 3, pCalledAet.Release());
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
167
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
168 assert(findScpCallback_ != NULL);
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
169 PythonObject result(lock, PyObject_CallObject(findScpCallback_, args.GetPyObject()));
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
170 }
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
171
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
172 return lock.CheckCallbackSuccess("Python C-FIND SCP callback");
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
173 }
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
174 catch (OrthancPlugins::PluginException& e)
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
175 {
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
176 return e.GetErrorCode();
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
177 }
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
178 }
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
179
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
180
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
181
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
182 class IMoveDriver : public boost::noncopyable
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
183 {
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
184 public:
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
185 virtual ~IMoveDriver()
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
186 {
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
187 }
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
188
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
189 virtual void Apply() = 0;
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
190 };
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
191
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
192
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
193 static void* CreateMoveCallback(OrthancPluginResourceType resourceType,
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
194 const char *patientId,
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
195 const char *accessionNumber,
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
196 const char *studyInstanceUid,
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
197 const char *seriesInstanceUid,
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
198 const char *sopInstanceUid,
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
199 const char *originatorAet,
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
200 const char *sourceAet,
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
201 const char *targetAet,
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
202 uint16_t originatorId)
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
203 {
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
204 class Driver : public IMoveDriver
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
205 {
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
206 private:
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
207 OrthancPluginResourceType resourceType_;
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
208 std::string patientId_;
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
209 std::string accessionNumber_;
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
210 std::string studyInstanceUid_;
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
211 std::string seriesInstanceUid_;
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
212 std::string sopInstanceUid_;
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
213 std::string originatorAet_;
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
214 std::string sourceAet_;
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
215 std::string targetAet_;
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
216 uint16_t originatorId_;
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
217
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
218 public:
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
219 Driver(OrthancPluginResourceType resourceType,
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
220 const char *patientId,
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
221 const char *accessionNumber,
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
222 const char *studyInstanceUid,
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
223 const char *seriesInstanceUid,
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
224 const char *sopInstanceUid,
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
225 const char *originatorAet,
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
226 const char *sourceAet,
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
227 const char *targetAet,
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
228 uint16_t originatorId) :
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
229 resourceType_(resourceType),
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
230 originatorId_(originatorId)
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
231 {
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
232 if (patientId != NULL)
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
233 {
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
234 patientId_.assign(patientId);
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
235 }
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
236
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
237 if (accessionNumber != NULL)
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
238 {
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
239 accessionNumber_.assign(accessionNumber);
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
240 }
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
241
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
242 if (studyInstanceUid != NULL)
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
243 {
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
244 studyInstanceUid_.assign(studyInstanceUid);
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
245 }
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
246
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
247 if (seriesInstanceUid != NULL)
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
248 {
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
249 seriesInstanceUid_.assign(seriesInstanceUid);
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
250 }
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
251
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
252 if (sopInstanceUid != NULL)
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
253 {
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
254 sopInstanceUid_.assign(sopInstanceUid);
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
255 }
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
256
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
257 if (originatorAet != NULL)
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
258 {
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
259 originatorAet_.assign(originatorAet);
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
260 }
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
261
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
262 if (sourceAet != NULL)
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
263 {
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
264 sourceAet_.assign(sourceAet);
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
265 }
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
266
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
267 if (targetAet != NULL)
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
268 {
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
269 targetAet_.assign(targetAet);
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
270 }
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
271 }
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
272
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
273
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
274 virtual void Apply() ORTHANC_OVERRIDE
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
275 {
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
276 PythonLock lock;
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
277
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
278 PythonObject kw(lock, PyDict_New());
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
279
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
280 std::string level;
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
281 switch (resourceType_)
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
282 {
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
283 case OrthancPluginResourceType_Patient:
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
284 level = "PATIENT";
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
285 break;
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
286
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
287 case OrthancPluginResourceType_Study:
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
288 level = "STUDY";
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
289 break;
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
290
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
291 case OrthancPluginResourceType_Series:
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
292 level = "SERIES";
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
293 break;
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
294
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
295 case OrthancPluginResourceType_Instance:
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
296 level = "INSTANCE";
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
297 break;
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
298
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
299 default:
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
300 throw OrthancPlugins::PluginException(OrthancPluginErrorCode_ParameterOutOfRange);
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
301 }
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
302
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
303 {
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
304 PythonString tmp(lock, level);
126
9ffe8881f856 fixing more PyDict_SetItemString()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 101
diff changeset
305 PyDict_SetItemString(kw.GetPyObject(), "Level", tmp.GetPyObject());
63
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
306 }
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
307
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
308 {
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
309 PythonString tmp(lock, patientId_);
126
9ffe8881f856 fixing more PyDict_SetItemString()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 101
diff changeset
310 PyDict_SetItemString(kw.GetPyObject(), "PatientID", tmp.GetPyObject());
63
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
311 }
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
312
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
313 {
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
314 PythonString tmp(lock, accessionNumber_);
126
9ffe8881f856 fixing more PyDict_SetItemString()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 101
diff changeset
315 PyDict_SetItemString(kw.GetPyObject(), "AccessionNumber", tmp.GetPyObject());
63
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
316 }
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
317
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
318 {
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
319 PythonString tmp(lock, studyInstanceUid_);
126
9ffe8881f856 fixing more PyDict_SetItemString()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 101
diff changeset
320 PyDict_SetItemString(kw.GetPyObject(), "StudyInstanceUID", tmp.GetPyObject());
63
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
321 }
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
322
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
323 {
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
324 PythonString tmp(lock, seriesInstanceUid_);
126
9ffe8881f856 fixing more PyDict_SetItemString()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 101
diff changeset
325 PyDict_SetItemString(kw.GetPyObject(), "SeriesInstanceUID", tmp.GetPyObject());
63
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
326 }
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
327
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
328 {
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
329 PythonString tmp(lock, sopInstanceUid_);
126
9ffe8881f856 fixing more PyDict_SetItemString()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 101
diff changeset
330 PyDict_SetItemString(kw.GetPyObject(), "SOPInstanceUID", tmp.GetPyObject());
63
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
331 }
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
332
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
333 {
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
334 PythonString tmp(lock, originatorAet_);
126
9ffe8881f856 fixing more PyDict_SetItemString()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 101
diff changeset
335 PyDict_SetItemString(kw.GetPyObject(), "OriginatorAET", tmp.GetPyObject());
63
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
336 }
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
337
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
338 {
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
339 PythonString tmp(lock, sourceAet_);
126
9ffe8881f856 fixing more PyDict_SetItemString()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 101
diff changeset
340 PyDict_SetItemString(kw.GetPyObject(), "SourceAET", tmp.GetPyObject());
63
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
341 }
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
342
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
343 {
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
344 PythonString tmp(lock, targetAet_);
126
9ffe8881f856 fixing more PyDict_SetItemString()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 101
diff changeset
345 PyDict_SetItemString(kw.GetPyObject(), "TargetAET", tmp.GetPyObject());
63
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
346 }
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
347
127
a862d554753f fixing leaks associated with setting integers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 126
diff changeset
348 {
a862d554753f fixing leaks associated with setting integers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 126
diff changeset
349 PythonObject tmp(lock, PyLong_FromUnsignedLong(originatorId_));
a862d554753f fixing leaks associated with setting integers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 126
diff changeset
350 PyDict_SetItemString(kw.GetPyObject(), "OriginatorID", tmp.GetPyObject());
a862d554753f fixing leaks associated with setting integers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 126
diff changeset
351 }
63
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
352
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
353 PythonObject args(lock, PyTuple_New(0));
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
354
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
355 assert(moveScpCallback_ != NULL);
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
356 PythonObject result(lock, PyObject_Call(moveScpCallback_, args.GetPyObject(), kw.GetPyObject()));
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
357
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
358 OrthancPluginErrorCode code = lock.CheckCallbackSuccess("Python C-MOVE SCP callback");
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
359 if (code != OrthancPluginErrorCode_Success)
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
360 {
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
361 throw OrthancPlugins::PluginException(code);
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
362 }
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
363 }
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
364 };
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
365
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
366 try
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
367 {
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
368 return new Driver(resourceType, patientId, accessionNumber, studyInstanceUid,
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
369 seriesInstanceUid, sopInstanceUid, originatorAet, sourceAet,
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
370 targetAet, originatorId);
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
371 }
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
372 catch (OrthancPlugins::PluginException& e)
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
373 {
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
374 return NULL;
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
375 }
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
376 }
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
377
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
378
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
379 static uint32_t GetMoveSize(void *moveDriver)
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
380 {
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
381 assert(moveDriver != NULL);
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
382 return 1;
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
383 }
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
384
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
385
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
386 OrthancPluginErrorCode ApplyMove(void *moveDriver)
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
387 {
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
388 assert(moveDriver != NULL);
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
389
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
390 try
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
391 {
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
392 reinterpret_cast<IMoveDriver*>(moveDriver)->Apply();
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
393 return OrthancPluginErrorCode_Success;
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
394 }
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
395 catch (OrthancPlugins::PluginException& e)
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
396 {
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
397 return e.GetErrorCode();
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
398 }
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
399 }
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
400
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
401
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
402 void FreeMove(void *moveDriver)
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
403 {
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
404 assert(moveDriver != NULL);
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
405 delete reinterpret_cast<IMoveDriver*>(moveDriver);
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
406 }
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
407
64
091fb1903bfc new wrapped function: orthanc.RegisterWorklistCallback() and orthanc.WorklistAnswers.WorklistAddAnswer()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 63
diff changeset
408
151
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
409 static void* CreateMoveCallback2(OrthancPluginResourceType resourceType,
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
410 const char *patientId,
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
411 const char *accessionNumber,
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
412 const char *studyInstanceUid,
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
413 const char *seriesInstanceUid,
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
414 const char *sopInstanceUid,
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
415 const char *originatorAet,
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
416 const char *sourceAet,
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
417 const char *targetAet,
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
418 uint16_t originatorId)
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
419 {
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
420 assert(createMoveScpDriverCallback_ != NULL);
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
421
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
422 try
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
423 {
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
424 std::string _patientId, _accessionNumber, _studyInstanceUid, _seriesInstanceUid, _sopInstanceUid, _originatorAet, _sourceAet, _targetAet;
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
425 if (patientId != NULL)
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
426 {
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
427 _patientId.assign(patientId);
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
428 }
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
429
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
430 if (accessionNumber != NULL)
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
431 {
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
432 _accessionNumber.assign(accessionNumber);
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
433 }
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
434
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
435 if (studyInstanceUid != NULL)
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
436 {
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
437 _studyInstanceUid.assign(studyInstanceUid);
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
438 }
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
439
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
440 if (seriesInstanceUid != NULL)
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
441 {
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
442 _seriesInstanceUid.assign(seriesInstanceUid);
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
443 }
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
444
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
445 if (sopInstanceUid != NULL)
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
446 {
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
447 _sopInstanceUid.assign(sopInstanceUid);
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
448 }
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
449
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
450 if (originatorAet != NULL)
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
451 {
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
452 _originatorAet.assign(originatorAet);
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
453 }
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
454
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
455 if (sourceAet != NULL)
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
456 {
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
457 _sourceAet.assign(sourceAet);
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
458 }
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
459
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
460 if (targetAet != NULL)
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
461 {
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
462 _targetAet.assign(targetAet);
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
463 }
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
464
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
465 PythonLock lock;
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
466
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
467 PythonObject kw(lock, PyDict_New());
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
468
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
469 std::string level;
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
470 switch (resourceType)
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
471 {
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
472 case OrthancPluginResourceType_Patient:
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
473 level = "PATIENT";
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
474 break;
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
475
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
476 case OrthancPluginResourceType_Study:
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
477 level = "STUDY";
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
478 break;
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
479
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
480 case OrthancPluginResourceType_Series:
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
481 level = "SERIES";
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
482 break;
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
483
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
484 case OrthancPluginResourceType_Instance:
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
485 level = "INSTANCE";
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
486 break;
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
487
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
488 default:
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
489 throw OrthancPlugins::PluginException(OrthancPluginErrorCode_ParameterOutOfRange);
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
490 }
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
491
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
492 {
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
493 PythonString tmp(lock, level);
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
494 PyDict_SetItemString(kw.GetPyObject(), "Level", tmp.GetPyObject());
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
495 }
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
496
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
497 {
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
498 PythonString tmp(lock, _patientId);
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
499 PyDict_SetItemString(kw.GetPyObject(), "PatientID", tmp.GetPyObject());
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
500 }
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
501
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
502 {
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
503 PythonString tmp(lock, _accessionNumber);
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
504 PyDict_SetItemString(kw.GetPyObject(), "AccessionNumber", tmp.GetPyObject());
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
505 }
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
506
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
507 {
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
508 PythonString tmp(lock, _studyInstanceUid);
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
509 PyDict_SetItemString(kw.GetPyObject(), "StudyInstanceUID", tmp.GetPyObject());
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
510 }
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
511
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
512 {
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
513 PythonString tmp(lock, _seriesInstanceUid);
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
514 PyDict_SetItemString(kw.GetPyObject(), "SeriesInstanceUID", tmp.GetPyObject());
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
515 }
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
516
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
517 {
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
518 PythonString tmp(lock, _sopInstanceUid);
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
519 PyDict_SetItemString(kw.GetPyObject(), "SOPInstanceUID", tmp.GetPyObject());
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
520 }
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
521
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
522 {
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
523 PythonString tmp(lock, _originatorAet);
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
524 PyDict_SetItemString(kw.GetPyObject(), "OriginatorAET", tmp.GetPyObject());
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
525 }
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
526
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
527 {
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
528 PythonString tmp(lock, _sourceAet);
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
529 PyDict_SetItemString(kw.GetPyObject(), "SourceAET", tmp.GetPyObject());
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
530 }
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
531
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
532 {
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
533 PythonString tmp(lock, _targetAet);
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
534 PyDict_SetItemString(kw.GetPyObject(), "TargetAET", tmp.GetPyObject());
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
535 }
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
536
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
537 {
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
538 PythonObject tmp(lock, PyLong_FromUnsignedLong(originatorId));
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
539 PyDict_SetItemString(kw.GetPyObject(), "OriginatorID", tmp.GetPyObject());
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
540 }
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
541
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
542 PythonObject args(lock, PyTuple_New(0));
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
543
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
544 // Note: the result is not attached to the PythonLock because we want it to survive after this call since
152
a6b4e0abe532 fix leaking of MoveDriver
Alain Mazy <am@osimis.io>
parents: 151
diff changeset
545 // the result is the python move driver that will be passed as first argument to GetMoveSize, Apply and Free.
a6b4e0abe532 fix leaking of MoveDriver
Alain Mazy <am@osimis.io>
parents: 151
diff changeset
546 // After the PyObject_Call, result's ref count is 1 -> no need to add a reference but we need to decref explicitely
a6b4e0abe532 fix leaking of MoveDriver
Alain Mazy <am@osimis.io>
parents: 151
diff changeset
547 // to delete the object at the end of the move.
a6b4e0abe532 fix leaking of MoveDriver
Alain Mazy <am@osimis.io>
parents: 151
diff changeset
548 PyObject* result = PyObject_Call(createMoveScpDriverCallback_, args.GetPyObject(), kw.GetPyObject());
151
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
549
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
550 OrthancPluginErrorCode code = lock.CheckCallbackSuccess("Python C-MOVE SCP callback (Create)");
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
551 if (code != OrthancPluginErrorCode_Success)
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
552 {
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
553 throw OrthancPlugins::PluginException(code);
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
554 }
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
555
152
a6b4e0abe532 fix leaking of MoveDriver
Alain Mazy <am@osimis.io>
parents: 151
diff changeset
556 return result;
151
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
557 }
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
558 catch (OrthancPlugins::PluginException& e)
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
559 {
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
560 return NULL;
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
561 }
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
562 }
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
563
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
564
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
565 static uint32_t GetMoveSize2(void *moveDriver)
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
566 {
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
567 assert(moveDriver != NULL);
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
568 assert(getMoveSizeCallback_ != NULL);
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
569
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
570 PythonLock lock;
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
571
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
572 PythonObject args(lock, PyTuple_New(1));
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
573 PyTuple_SetItem(args.GetPyObject(), 0, reinterpret_cast<PyObject*>(moveDriver));
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
574 Py_INCREF(moveDriver); // because PyTuple_SetItem steals a reference and we need to keep the object alive
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
575
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
576 PythonObject result(lock, PyObject_CallObject(getMoveSizeCallback_, args.GetPyObject()));
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
577
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
578 OrthancPluginErrorCode code = lock.CheckCallbackSuccess("Python C-MOVE SCP callback (GetMoveSize)");
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
579 if (code != OrthancPluginErrorCode_Success)
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
580 {
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
581 throw OrthancPlugins::PluginException(code);
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
582 }
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
583
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
584 if (!PyLong_Check(result.GetPyObject()))
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
585 {
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
586 throw OrthancPlugins::PluginException(OrthancPluginErrorCode_BadParameterType);
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
587 }
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
588
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
589 return static_cast<uint32_t>(PyLong_AsLong(result.GetPyObject()));
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
590 }
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
591
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
592
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
593 OrthancPluginErrorCode ApplyMove2(void *moveDriver)
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
594 {
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
595 assert(moveDriver != NULL);
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
596 assert(applyMoveCallback_ != NULL);
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
597
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
598 PythonLock lock;
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
599
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
600 PythonObject args(lock, PyTuple_New(1));
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
601 PyTuple_SetItem(args.GetPyObject(), 0, reinterpret_cast<PyObject*>(moveDriver));
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
602 Py_INCREF(moveDriver); // because PyTuple_SetItem steals a reference and we need to keep the object alive
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
603
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
604 PythonObject result(lock, PyObject_CallObject(applyMoveCallback_, args.GetPyObject()));
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
605
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
606 OrthancPluginErrorCode code = lock.CheckCallbackSuccess("Python C-MOVE SCP callback (Apply)");
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
607 return code;
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
608 }
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
609
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
610
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
611 void FreeMove2(void *moveDriver)
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
612 {
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
613 assert(moveDriver != NULL);
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
614
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
615 PythonLock lock;
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
616
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
617 PythonObject args(lock, PyTuple_New(1));
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
618 PyTuple_SetItem(args.GetPyObject(), 0, reinterpret_cast<PyObject*>(moveDriver));
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
619 Py_INCREF(moveDriver); // because PyTuple_SetItem steals a reference and we need to keep the object alive
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
620
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
621 assert(freeMoveCallback_ != NULL);
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
622 PythonObject result(lock, PyObject_CallObject(freeMoveCallback_, args.GetPyObject()));
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
623
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
624 lock.CheckCallbackSuccess("Python C-MOVE SCP callback (Free)");
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
625
152
a6b4e0abe532 fix leaking of MoveDriver
Alain Mazy <am@osimis.io>
parents: 151
diff changeset
626 Py_DECREF(moveDriver); // remove the initial reference -> this will delete the Python Object when we exit this function
151
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
627 }
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
628
64
091fb1903bfc new wrapped function: orthanc.RegisterWorklistCallback() and orthanc.WorklistAnswers.WorklistAddAnswer()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 63
diff changeset
629
091fb1903bfc new wrapped function: orthanc.RegisterWorklistCallback() and orthanc.WorklistAnswers.WorklistAddAnswer()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 63
diff changeset
630 OrthancPluginErrorCode WorklistCallback(OrthancPluginWorklistAnswers *answers,
091fb1903bfc new wrapped function: orthanc.RegisterWorklistCallback() and orthanc.WorklistAnswers.WorklistAddAnswer()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 63
diff changeset
631 const OrthancPluginWorklistQuery *query,
091fb1903bfc new wrapped function: orthanc.RegisterWorklistCallback() and orthanc.WorklistAnswers.WorklistAddAnswer()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 63
diff changeset
632 const char *issuerAet,
091fb1903bfc new wrapped function: orthanc.RegisterWorklistCallback() and orthanc.WorklistAnswers.WorklistAddAnswer()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 63
diff changeset
633 const char *calledAet)
091fb1903bfc new wrapped function: orthanc.RegisterWorklistCallback() and orthanc.WorklistAnswers.WorklistAddAnswer()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 63
diff changeset
634 {
091fb1903bfc new wrapped function: orthanc.RegisterWorklistCallback() and orthanc.WorklistAnswers.WorklistAddAnswer()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 63
diff changeset
635 try
091fb1903bfc new wrapped function: orthanc.RegisterWorklistCallback() and orthanc.WorklistAnswers.WorklistAddAnswer()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 63
diff changeset
636 {
091fb1903bfc new wrapped function: orthanc.RegisterWorklistCallback() and orthanc.WorklistAnswers.WorklistAddAnswer()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 63
diff changeset
637 PythonLock lock;
091fb1903bfc new wrapped function: orthanc.RegisterWorklistCallback() and orthanc.WorklistAnswers.WorklistAddAnswer()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 63
diff changeset
638
091fb1903bfc new wrapped function: orthanc.RegisterWorklistCallback() and orthanc.WorklistAnswers.WorklistAddAnswer()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 63
diff changeset
639 PyObject *pAnswers, *pQuery;
091fb1903bfc new wrapped function: orthanc.RegisterWorklistCallback() and orthanc.WorklistAnswers.WorklistAddAnswer()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 63
diff changeset
640
091fb1903bfc new wrapped function: orthanc.RegisterWorklistCallback() and orthanc.WorklistAnswers.WorklistAddAnswer()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 63
diff changeset
641 {
091fb1903bfc new wrapped function: orthanc.RegisterWorklistCallback() and orthanc.WorklistAnswers.WorklistAddAnswer()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 63
diff changeset
642 PythonObject args(lock, PyTuple_New(2));
091fb1903bfc new wrapped function: orthanc.RegisterWorklistCallback() and orthanc.WorklistAnswers.WorklistAddAnswer()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 63
diff changeset
643 PyTuple_SetItem(args.GetPyObject(), 0, PyLong_FromSsize_t((intptr_t) answers));
091fb1903bfc new wrapped function: orthanc.RegisterWorklistCallback() and orthanc.WorklistAnswers.WorklistAddAnswer()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 63
diff changeset
644 PyTuple_SetItem(args.GetPyObject(), 1, PyBool_FromLong(true /* borrowed, don't destruct */));
091fb1903bfc new wrapped function: orthanc.RegisterWorklistCallback() and orthanc.WorklistAnswers.WorklistAddAnswer()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 63
diff changeset
645 pAnswers = PyObject_CallObject((PyObject *) GetOrthancPluginWorklistAnswersType(), args.GetPyObject());
091fb1903bfc new wrapped function: orthanc.RegisterWorklistCallback() and orthanc.WorklistAnswers.WorklistAddAnswer()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 63
diff changeset
646 }
091fb1903bfc new wrapped function: orthanc.RegisterWorklistCallback() and orthanc.WorklistAnswers.WorklistAddAnswer()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 63
diff changeset
647
091fb1903bfc new wrapped function: orthanc.RegisterWorklistCallback() and orthanc.WorklistAnswers.WorklistAddAnswer()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 63
diff changeset
648 {
091fb1903bfc new wrapped function: orthanc.RegisterWorklistCallback() and orthanc.WorklistAnswers.WorklistAddAnswer()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 63
diff changeset
649 PythonObject args(lock, PyTuple_New(2));
091fb1903bfc new wrapped function: orthanc.RegisterWorklistCallback() and orthanc.WorklistAnswers.WorklistAddAnswer()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 63
diff changeset
650 PyTuple_SetItem(args.GetPyObject(), 0, PyLong_FromSsize_t((intptr_t) query));
091fb1903bfc new wrapped function: orthanc.RegisterWorklistCallback() and orthanc.WorklistAnswers.WorklistAddAnswer()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 63
diff changeset
651 PyTuple_SetItem(args.GetPyObject(), 1, PyBool_FromLong(true /* borrowed, don't destruct */));
091fb1903bfc new wrapped function: orthanc.RegisterWorklistCallback() and orthanc.WorklistAnswers.WorklistAddAnswer()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 63
diff changeset
652 pQuery = PyObject_CallObject((PyObject *) GetOrthancPluginWorklistQueryType(), args.GetPyObject());
091fb1903bfc new wrapped function: orthanc.RegisterWorklistCallback() and orthanc.WorklistAnswers.WorklistAddAnswer()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 63
diff changeset
653 }
091fb1903bfc new wrapped function: orthanc.RegisterWorklistCallback() and orthanc.WorklistAnswers.WorklistAddAnswer()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 63
diff changeset
654
091fb1903bfc new wrapped function: orthanc.RegisterWorklistCallback() and orthanc.WorklistAnswers.WorklistAddAnswer()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 63
diff changeset
655 PythonString pIssuerAet(lock, issuerAet);
091fb1903bfc new wrapped function: orthanc.RegisterWorklistCallback() and orthanc.WorklistAnswers.WorklistAddAnswer()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 63
diff changeset
656 PythonString pCalledAet(lock, calledAet);
091fb1903bfc new wrapped function: orthanc.RegisterWorklistCallback() and orthanc.WorklistAnswers.WorklistAddAnswer()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 63
diff changeset
657
091fb1903bfc new wrapped function: orthanc.RegisterWorklistCallback() and orthanc.WorklistAnswers.WorklistAddAnswer()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 63
diff changeset
658 {
091fb1903bfc new wrapped function: orthanc.RegisterWorklistCallback() and orthanc.WorklistAnswers.WorklistAddAnswer()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 63
diff changeset
659 PythonObject args(lock, PyTuple_New(4));
091fb1903bfc new wrapped function: orthanc.RegisterWorklistCallback() and orthanc.WorklistAnswers.WorklistAddAnswer()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 63
diff changeset
660 PyTuple_SetItem(args.GetPyObject(), 0, pAnswers);
091fb1903bfc new wrapped function: orthanc.RegisterWorklistCallback() and orthanc.WorklistAnswers.WorklistAddAnswer()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 63
diff changeset
661 PyTuple_SetItem(args.GetPyObject(), 1, pQuery);
091fb1903bfc new wrapped function: orthanc.RegisterWorklistCallback() and orthanc.WorklistAnswers.WorklistAddAnswer()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 63
diff changeset
662 PyTuple_SetItem(args.GetPyObject(), 2, pIssuerAet.Release());
091fb1903bfc new wrapped function: orthanc.RegisterWorklistCallback() and orthanc.WorklistAnswers.WorklistAddAnswer()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 63
diff changeset
663 PyTuple_SetItem(args.GetPyObject(), 3, pCalledAet.Release());
091fb1903bfc new wrapped function: orthanc.RegisterWorklistCallback() and orthanc.WorklistAnswers.WorklistAddAnswer()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 63
diff changeset
664
091fb1903bfc new wrapped function: orthanc.RegisterWorklistCallback() and orthanc.WorklistAnswers.WorklistAddAnswer()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 63
diff changeset
665 assert(worklistScpCallback_ != NULL);
091fb1903bfc new wrapped function: orthanc.RegisterWorklistCallback() and orthanc.WorklistAnswers.WorklistAddAnswer()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 63
diff changeset
666 PythonObject result(lock, PyObject_CallObject(worklistScpCallback_, args.GetPyObject()));
091fb1903bfc new wrapped function: orthanc.RegisterWorklistCallback() and orthanc.WorklistAnswers.WorklistAddAnswer()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 63
diff changeset
667 }
091fb1903bfc new wrapped function: orthanc.RegisterWorklistCallback() and orthanc.WorklistAnswers.WorklistAddAnswer()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 63
diff changeset
668
091fb1903bfc new wrapped function: orthanc.RegisterWorklistCallback() and orthanc.WorklistAnswers.WorklistAddAnswer()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 63
diff changeset
669 return lock.CheckCallbackSuccess("Python C-FIND SCP for worklist callback");
091fb1903bfc new wrapped function: orthanc.RegisterWorklistCallback() and orthanc.WorklistAnswers.WorklistAddAnswer()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 63
diff changeset
670 }
091fb1903bfc new wrapped function: orthanc.RegisterWorklistCallback() and orthanc.WorklistAnswers.WorklistAddAnswer()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 63
diff changeset
671 catch (OrthancPlugins::PluginException& e)
091fb1903bfc new wrapped function: orthanc.RegisterWorklistCallback() and orthanc.WorklistAnswers.WorklistAddAnswer()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 63
diff changeset
672 {
091fb1903bfc new wrapped function: orthanc.RegisterWorklistCallback() and orthanc.WorklistAnswers.WorklistAddAnswer()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 63
diff changeset
673 return e.GetErrorCode();
091fb1903bfc new wrapped function: orthanc.RegisterWorklistCallback() and orthanc.WorklistAnswers.WorklistAddAnswer()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 63
diff changeset
674 }
091fb1903bfc new wrapped function: orthanc.RegisterWorklistCallback() and orthanc.WorklistAnswers.WorklistAddAnswer()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 63
diff changeset
675 }
091fb1903bfc new wrapped function: orthanc.RegisterWorklistCallback() and orthanc.WorklistAnswers.WorklistAddAnswer()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 63
diff changeset
676
63
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
677
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
678 PyObject* RegisterFindCallback(PyObject* module, PyObject* args)
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
679 {
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
680 // The GIL is locked at this point (no need to create "PythonLock")
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
681
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
682 class Registration : public ICallbackRegistration
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
683 {
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
684 public:
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
685 virtual void Register() ORTHANC_OVERRIDE
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
686 {
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
687 OrthancPluginRegisterFindCallback(OrthancPlugins::GetGlobalContext(), FindCallback);
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
688 }
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
689 };
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
690
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
691 Registration registration;
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
692 return ICallbackRegistration::Apply(
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
693 registration, args, findScpCallback_, "Python C-FIND SCP callback");
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
694 }
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
695
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
696
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
697 PyObject* RegisterMoveCallback(PyObject* module, PyObject* args)
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
698 {
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
699 // The GIL is locked at this point (no need to create "PythonLock")
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
700
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
701 class Registration : public ICallbackRegistration
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
702 {
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
703 public:
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
704 virtual void Register() ORTHANC_OVERRIDE
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
705 {
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
706 OrthancPluginRegisterMoveCallback(
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
707 OrthancPlugins::GetGlobalContext(), CreateMoveCallback, GetMoveSize, ApplyMove, FreeMove);
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
708 }
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
709 };
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
710
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
711 Registration registration;
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
712 return ICallbackRegistration::Apply(
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
713 registration, args, moveScpCallback_, "Python C-MOVE SCP callback");
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
714 }
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
715
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
716
151
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
717 PyObject* RegisterMoveCallback2(PyObject* module, PyObject* args)
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
718 {
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
719 // The GIL is locked at this point (no need to create "PythonLock")
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
720
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
721 class Registration : public ICallbackRegistration
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
722 {
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
723 public:
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
724 virtual void Register() ORTHANC_OVERRIDE
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
725 {
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
726 OrthancPluginRegisterMoveCallback(
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
727 OrthancPlugins::GetGlobalContext(), CreateMoveCallback2, GetMoveSize2, ApplyMove2, FreeMove2);
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
728 }
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
729 };
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
730
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
731 Registration registration;
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
732 return ICallbackRegistration::Apply4(
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
733 registration, args, createMoveScpDriverCallback_, getMoveSizeCallback_, applyMoveCallback_, freeMoveCallback_, "Python C-MOVE SCP callback (2)");
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
734 }
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
735
64
091fb1903bfc new wrapped function: orthanc.RegisterWorklistCallback() and orthanc.WorklistAnswers.WorklistAddAnswer()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 63
diff changeset
736 PyObject* RegisterWorklistCallback(PyObject* module, PyObject* args)
091fb1903bfc new wrapped function: orthanc.RegisterWorklistCallback() and orthanc.WorklistAnswers.WorklistAddAnswer()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 63
diff changeset
737 {
091fb1903bfc new wrapped function: orthanc.RegisterWorklistCallback() and orthanc.WorklistAnswers.WorklistAddAnswer()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 63
diff changeset
738 // The GIL is locked at this point (no need to create "PythonLock")
091fb1903bfc new wrapped function: orthanc.RegisterWorklistCallback() and orthanc.WorklistAnswers.WorklistAddAnswer()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 63
diff changeset
739
091fb1903bfc new wrapped function: orthanc.RegisterWorklistCallback() and orthanc.WorklistAnswers.WorklistAddAnswer()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 63
diff changeset
740 class Registration : public ICallbackRegistration
091fb1903bfc new wrapped function: orthanc.RegisterWorklistCallback() and orthanc.WorklistAnswers.WorklistAddAnswer()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 63
diff changeset
741 {
091fb1903bfc new wrapped function: orthanc.RegisterWorklistCallback() and orthanc.WorklistAnswers.WorklistAddAnswer()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 63
diff changeset
742 public:
091fb1903bfc new wrapped function: orthanc.RegisterWorklistCallback() and orthanc.WorklistAnswers.WorklistAddAnswer()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 63
diff changeset
743 virtual void Register() ORTHANC_OVERRIDE
091fb1903bfc new wrapped function: orthanc.RegisterWorklistCallback() and orthanc.WorklistAnswers.WorklistAddAnswer()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 63
diff changeset
744 {
091fb1903bfc new wrapped function: orthanc.RegisterWorklistCallback() and orthanc.WorklistAnswers.WorklistAddAnswer()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 63
diff changeset
745 OrthancPluginRegisterWorklistCallback(OrthancPlugins::GetGlobalContext(), WorklistCallback);
091fb1903bfc new wrapped function: orthanc.RegisterWorklistCallback() and orthanc.WorklistAnswers.WorklistAddAnswer()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 63
diff changeset
746 }
091fb1903bfc new wrapped function: orthanc.RegisterWorklistCallback() and orthanc.WorklistAnswers.WorklistAddAnswer()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 63
diff changeset
747 };
091fb1903bfc new wrapped function: orthanc.RegisterWorklistCallback() and orthanc.WorklistAnswers.WorklistAddAnswer()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 63
diff changeset
748
091fb1903bfc new wrapped function: orthanc.RegisterWorklistCallback() and orthanc.WorklistAnswers.WorklistAddAnswer()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 63
diff changeset
749 Registration registration;
091fb1903bfc new wrapped function: orthanc.RegisterWorklistCallback() and orthanc.WorklistAnswers.WorklistAddAnswer()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 63
diff changeset
750 return ICallbackRegistration::Apply(
091fb1903bfc new wrapped function: orthanc.RegisterWorklistCallback() and orthanc.WorklistAnswers.WorklistAddAnswer()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 63
diff changeset
751 registration, args, worklistScpCallback_, "Python C-FIND SCP for worklist callback");
091fb1903bfc new wrapped function: orthanc.RegisterWorklistCallback() and orthanc.WorklistAnswers.WorklistAddAnswer()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 63
diff changeset
752 }
091fb1903bfc new wrapped function: orthanc.RegisterWorklistCallback() and orthanc.WorklistAnswers.WorklistAddAnswer()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 63
diff changeset
753
091fb1903bfc new wrapped function: orthanc.RegisterWorklistCallback() and orthanc.WorklistAnswers.WorklistAddAnswer()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 63
diff changeset
754
63
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
755 void FinalizeDicomScpCallbacks()
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
756 {
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
757 ICallbackRegistration::Unregister(findScpCallback_);
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
758 ICallbackRegistration::Unregister(moveScpCallback_);
64
091fb1903bfc new wrapped function: orthanc.RegisterWorklistCallback() and orthanc.WorklistAnswers.WorklistAddAnswer()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 63
diff changeset
759 ICallbackRegistration::Unregister(worklistScpCallback_);
151
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
760
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
761 ICallbackRegistration::Unregister(createMoveScpDriverCallback_);
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
762 ICallbackRegistration::Unregister(getMoveSizeCallback_);
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
763 ICallbackRegistration::Unregister(applyMoveCallback_);
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
764 ICallbackRegistration::Unregister(freeMoveCallback_);
63
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
765 }