annotate Sources/DicomScpCallbacks.cpp @ 227:9574f06d8588 default tip

todo
author Alain Mazy <am@orthanc.team>
date Tue, 24 Sep 2024 08:54:11 +0200
parents 3678a028f1f6
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
219
3678a028f1f6 making the project REUSE-compliant
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 211
diff changeset
1 /**
3678a028f1f6 making the project REUSE-compliant
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 211
diff changeset
2 * SPDX-FileCopyrightText: 2020-2023 Osimis S.A., 2024-2024 Orthanc Team SRL, 2021-2024 Sebastien Jodogne, ICTEAM UCLouvain
3678a028f1f6 making the project REUSE-compliant
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 211
diff changeset
3 * SPDX-License-Identifier: AGPL-3.0-or-later
3678a028f1f6 making the project REUSE-compliant
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 211
diff changeset
4 */
3678a028f1f6 making the project REUSE-compliant
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 211
diff changeset
5
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 * Python plugin for Orthanc
166
6fada29b6759 updated copyright, as Orthanc Team now replaces Osimis
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 157
diff changeset
8 * 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
9 * Copyright (C) 2024-2024 Orthanc Team SRL, Belgium
155
71d305c29cfa updated year to 2024
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 131
diff changeset
10 * 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
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 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
13 * 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
14 * 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
15 * 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
16 *
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
17 * 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
18 * 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
19 * 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
20 * 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
21 *
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
22 * 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
23 * 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
24 **/
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
25
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
26
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
27 #include "DicomScpCallbacks.h"
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
28
211
d7acfccc0d0b documented RegisterFindCallback(), RegisterMoveCallback(), RegisterMoveCallback2(), and RegisterWorklistCallback()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 210
diff changeset
29 #include "PythonHeaderWrapper.h"
d7acfccc0d0b documented RegisterFindCallback(), RegisterMoveCallback(), RegisterMoveCallback2(), and RegisterWorklistCallback()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 210
diff changeset
30
63
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
31 #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
32 #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
33 #include "ICallbackRegistration.h"
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
34 #include "PythonString.h"
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
35
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
36
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
37 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
38 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
39 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
40
151
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
41 // version 2 of Move callbacks
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
42 static PyObject* createMoveScpDriverCallback_ = NULL;
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
43 static PyObject* getMoveSizeCallback_ = NULL;
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
44 static PyObject* applyMoveCallback_ = NULL;
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
45 static PyObject* freeMoveCallback_ = NULL;
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
46
63
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 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
49 PyObject *args,
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
50 bool isGroup)
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
51 {
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
52 unsigned long index;
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
53 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
54
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
55 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
56 {
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
57 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
58 return NULL;
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
59 }
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
60 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
61 {
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
62 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
63 return NULL;
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
64 }
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
65 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
66 OrthancPluginErrorCode_Success)
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 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
69 return NULL;
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
70 }
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
71 else if (isGroup)
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 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
74 }
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
75 else
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
76 {
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
77 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
78 }
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
79 }
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
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
83 // 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
84 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
85 {
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
86 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
87 }
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
88
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
89 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
90 {
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
91 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
92 }
64
091fb1903bfc new wrapped function: orthanc.RegisterWorklistCallback() and orthanc.WorklistAnswers.WorklistAddAnswer()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 63
diff changeset
93 // End of "CUSTOM_METHODS"
091fb1903bfc new wrapped function: orthanc.RegisterWorklistCallback() and orthanc.WorklistAnswers.WorklistAddAnswer()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 63
diff changeset
94
091fb1903bfc new wrapped function: orthanc.RegisterWorklistCallback() and orthanc.WorklistAnswers.WorklistAddAnswer()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 63
diff changeset
95
63
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
96
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
97 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
98 const OrthancPluginFindQuery *query,
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
99 const char *issuerAet,
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
100 const char *calledAet)
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
101 {
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
102 try
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
103 {
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
104 PythonLock lock;
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
105
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
106 PyObject *pAnswers, *pQuery;
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
107
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
108 {
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
109 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
110 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
111 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
112 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
113 }
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
114
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
115 {
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
116 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
117 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
118 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
119 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
120 }
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
121
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
122 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
123 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
124
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
125 {
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
126 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
127 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
128 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
129 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
130 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
131
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
132 assert(findScpCallback_ != NULL);
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
133 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
134 }
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
135
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
136 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
137 }
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
138 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
139 {
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
140 return e.GetErrorCode();
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 }
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
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
146 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
147 {
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
148 public:
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
149 virtual ~IMoveDriver()
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
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
153 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
154 };
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
155
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 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
158 const char *patientId,
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
159 const char *accessionNumber,
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
160 const char *studyInstanceUid,
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
161 const char *seriesInstanceUid,
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
162 const char *sopInstanceUid,
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
163 const char *originatorAet,
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
164 const char *sourceAet,
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
165 const char *targetAet,
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
166 uint16_t originatorId)
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 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
169 {
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
170 private:
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
171 OrthancPluginResourceType resourceType_;
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
172 std::string patientId_;
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
173 std::string accessionNumber_;
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
174 std::string studyInstanceUid_;
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
175 std::string seriesInstanceUid_;
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
176 std::string sopInstanceUid_;
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
177 std::string originatorAet_;
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
178 std::string sourceAet_;
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
179 std::string targetAet_;
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
180 uint16_t originatorId_;
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 public:
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
183 Driver(OrthancPluginResourceType resourceType,
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
184 const char *patientId,
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
185 const char *accessionNumber,
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
186 const char *studyInstanceUid,
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
187 const char *seriesInstanceUid,
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
188 const char *sopInstanceUid,
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
189 const char *originatorAet,
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
190 const char *sourceAet,
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
191 const char *targetAet,
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
192 uint16_t originatorId) :
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
193 resourceType_(resourceType),
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
194 originatorId_(originatorId)
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
195 {
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
196 if (patientId != NULL)
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
197 {
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
198 patientId_.assign(patientId);
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
199 }
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
200
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
201 if (accessionNumber != NULL)
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
202 {
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
203 accessionNumber_.assign(accessionNumber);
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
204 }
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 if (studyInstanceUid != NULL)
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
207 {
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
208 studyInstanceUid_.assign(studyInstanceUid);
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
209 }
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
210
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
211 if (seriesInstanceUid != NULL)
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
212 {
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
213 seriesInstanceUid_.assign(seriesInstanceUid);
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
214 }
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
215
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
216 if (sopInstanceUid != NULL)
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 sopInstanceUid_.assign(sopInstanceUid);
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
219 }
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
220
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
221 if (originatorAet != NULL)
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
222 {
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
223 originatorAet_.assign(originatorAet);
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
224 }
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
225
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
226 if (sourceAet != NULL)
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
227 {
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
228 sourceAet_.assign(sourceAet);
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
229 }
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
230
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
231 if (targetAet != NULL)
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
232 {
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
233 targetAet_.assign(targetAet);
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
234 }
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
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
238 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
239 {
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
240 PythonLock lock;
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
241
210
6ca37fcf0979 reverted changeset 207
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 207
diff changeset
242 PythonObject kw(lock, PyDict_New());
63
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 std::string level;
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
245 switch (resourceType_)
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 case OrthancPluginResourceType_Patient:
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
248 level = "PATIENT";
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
249 break;
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 case OrthancPluginResourceType_Study:
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
252 level = "STUDY";
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
253 break;
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
254
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
255 case OrthancPluginResourceType_Series:
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
256 level = "SERIES";
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
257 break;
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 case OrthancPluginResourceType_Instance:
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
260 level = "INSTANCE";
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
261 break;
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
262
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
263 default:
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
264 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
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 {
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
268 PythonString tmp(lock, level);
210
6ca37fcf0979 reverted changeset 207
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 207
diff changeset
269 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
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 PythonString tmp(lock, patientId_);
210
6ca37fcf0979 reverted changeset 207
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 207
diff changeset
274 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
275 }
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
276
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 PythonString tmp(lock, accessionNumber_);
210
6ca37fcf0979 reverted changeset 207
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 207
diff changeset
279 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
280 }
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
281
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 PythonString tmp(lock, studyInstanceUid_);
210
6ca37fcf0979 reverted changeset 207
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 207
diff changeset
284 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
285 }
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 {
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
288 PythonString tmp(lock, seriesInstanceUid_);
210
6ca37fcf0979 reverted changeset 207
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 207
diff changeset
289 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
290 }
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
291
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
292 {
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
293 PythonString tmp(lock, sopInstanceUid_);
210
6ca37fcf0979 reverted changeset 207
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 207
diff changeset
294 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
295 }
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
296
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
297 {
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
298 PythonString tmp(lock, originatorAet_);
210
6ca37fcf0979 reverted changeset 207
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 207
diff changeset
299 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
300 }
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 PythonString tmp(lock, sourceAet_);
210
6ca37fcf0979 reverted changeset 207
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 207
diff changeset
304 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
305 }
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 PythonString tmp(lock, targetAet_);
210
6ca37fcf0979 reverted changeset 207
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 207
diff changeset
309 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
310 }
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
311
127
a862d554753f fixing leaks associated with setting integers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 126
diff changeset
312 {
a862d554753f fixing leaks associated with setting integers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 126
diff changeset
313 PythonObject tmp(lock, PyLong_FromUnsignedLong(originatorId_));
210
6ca37fcf0979 reverted changeset 207
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 207
diff changeset
314 PyDict_SetItemString(kw.GetPyObject(), "OriginatorID", tmp.GetPyObject());
127
a862d554753f fixing leaks associated with setting integers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 126
diff changeset
315 }
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 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
318
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
319 assert(moveScpCallback_ != NULL);
210
6ca37fcf0979 reverted changeset 207
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 207
diff changeset
320 PythonObject result(lock, PyObject_Call(moveScpCallback_, args.GetPyObject(), kw.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 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
323 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
324 {
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
325 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
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
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
330 try
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 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
333 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
334 targetAet, originatorId);
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
335 }
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
336 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
337 {
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
338 return NULL;
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
339 }
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
340 }
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 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
344 {
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
345 assert(moveDriver != NULL);
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
346 return 1;
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
347 }
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
348
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
349
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
350 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
351 {
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
352 assert(moveDriver != NULL);
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
353
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
354 try
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
355 {
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
356 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
357 return OrthancPluginErrorCode_Success;
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
358 }
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
359 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
360 {
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
361 return e.GetErrorCode();
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 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
367 {
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
368 assert(moveDriver != NULL);
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
369 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
370 }
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
371
64
091fb1903bfc new wrapped function: orthanc.RegisterWorklistCallback() and orthanc.WorklistAnswers.WorklistAddAnswer()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 63
diff changeset
372
151
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
373 static void* CreateMoveCallback2(OrthancPluginResourceType resourceType,
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
374 const char *patientId,
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
375 const char *accessionNumber,
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
376 const char *studyInstanceUid,
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
377 const char *seriesInstanceUid,
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
378 const char *sopInstanceUid,
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
379 const char *originatorAet,
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
380 const char *sourceAet,
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
381 const char *targetAet,
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
382 uint16_t originatorId)
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
383 {
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
384 assert(createMoveScpDriverCallback_ != NULL);
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
385
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
386 try
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
387 {
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
388 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
389 if (patientId != NULL)
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
390 {
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
391 _patientId.assign(patientId);
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
392 }
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
393
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
394 if (accessionNumber != NULL)
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
395 {
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
396 _accessionNumber.assign(accessionNumber);
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
397 }
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
398
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
399 if (studyInstanceUid != NULL)
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
400 {
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
401 _studyInstanceUid.assign(studyInstanceUid);
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
402 }
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
403
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
404 if (seriesInstanceUid != NULL)
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
405 {
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
406 _seriesInstanceUid.assign(seriesInstanceUid);
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
407 }
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
408
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
409 if (sopInstanceUid != NULL)
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
410 {
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
411 _sopInstanceUid.assign(sopInstanceUid);
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
412 }
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
413
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
414 if (originatorAet != NULL)
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
415 {
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
416 _originatorAet.assign(originatorAet);
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
417 }
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
418
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
419 if (sourceAet != NULL)
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
420 {
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
421 _sourceAet.assign(sourceAet);
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
422 }
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 if (targetAet != NULL)
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
425 {
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
426 _targetAet.assign(targetAet);
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
427 }
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 PythonLock lock;
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
430
210
6ca37fcf0979 reverted changeset 207
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 207
diff changeset
431 PythonObject kw(lock, PyDict_New());
151
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
432
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
433 std::string level;
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
434 switch (resourceType)
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
435 {
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
436 case OrthancPluginResourceType_Patient:
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
437 level = "PATIENT";
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
438 break;
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 case OrthancPluginResourceType_Study:
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
441 level = "STUDY";
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
442 break;
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 case OrthancPluginResourceType_Series:
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
445 level = "SERIES";
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
446 break;
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
447
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
448 case OrthancPluginResourceType_Instance:
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
449 level = "INSTANCE";
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
450 break;
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 default:
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
453 throw OrthancPlugins::PluginException(OrthancPluginErrorCode_ParameterOutOfRange);
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
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 PythonString tmp(lock, level);
210
6ca37fcf0979 reverted changeset 207
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 207
diff changeset
458 PyDict_SetItemString(kw.GetPyObject(), "Level", tmp.GetPyObject());
151
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
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 PythonString tmp(lock, _patientId);
210
6ca37fcf0979 reverted changeset 207
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 207
diff changeset
463 PyDict_SetItemString(kw.GetPyObject(), "PatientID", tmp.GetPyObject());
151
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
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 PythonString tmp(lock, _accessionNumber);
210
6ca37fcf0979 reverted changeset 207
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 207
diff changeset
468 PyDict_SetItemString(kw.GetPyObject(), "AccessionNumber", tmp.GetPyObject());
151
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
469 }
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
470
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 PythonString tmp(lock, _studyInstanceUid);
210
6ca37fcf0979 reverted changeset 207
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 207
diff changeset
473 PyDict_SetItemString(kw.GetPyObject(), "StudyInstanceUID", tmp.GetPyObject());
151
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
474 }
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 {
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
477 PythonString tmp(lock, _seriesInstanceUid);
210
6ca37fcf0979 reverted changeset 207
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 207
diff changeset
478 PyDict_SetItemString(kw.GetPyObject(), "SeriesInstanceUID", tmp.GetPyObject());
151
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
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
481 {
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
482 PythonString tmp(lock, _sopInstanceUid);
210
6ca37fcf0979 reverted changeset 207
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 207
diff changeset
483 PyDict_SetItemString(kw.GetPyObject(), "SOPInstanceUID", tmp.GetPyObject());
151
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
484 }
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
485
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
486 {
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
487 PythonString tmp(lock, _originatorAet);
210
6ca37fcf0979 reverted changeset 207
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 207
diff changeset
488 PyDict_SetItemString(kw.GetPyObject(), "OriginatorAET", tmp.GetPyObject());
151
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
489 }
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 PythonString tmp(lock, _sourceAet);
210
6ca37fcf0979 reverted changeset 207
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 207
diff changeset
493 PyDict_SetItemString(kw.GetPyObject(), "SourceAET", tmp.GetPyObject());
151
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
494 }
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 PythonString tmp(lock, _targetAet);
210
6ca37fcf0979 reverted changeset 207
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 207
diff changeset
498 PyDict_SetItemString(kw.GetPyObject(), "TargetAET", tmp.GetPyObject());
151
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
499 }
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 PythonObject tmp(lock, PyLong_FromUnsignedLong(originatorId));
210
6ca37fcf0979 reverted changeset 207
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 207
diff changeset
503 PyDict_SetItemString(kw.GetPyObject(), "OriginatorID", tmp.GetPyObject());
151
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
504 }
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 PythonObject args(lock, PyTuple_New(0));
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 // 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
509 // 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
510 // 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
511 // to delete the object at the end of the move.
210
6ca37fcf0979 reverted changeset 207
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 207
diff changeset
512 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
513
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
514 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
515 if (code != OrthancPluginErrorCode_Success)
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 throw OrthancPlugins::PluginException(code);
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
518 }
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
519
152
a6b4e0abe532 fix leaking of MoveDriver
Alain Mazy <am@osimis.io>
parents: 151
diff changeset
520 return result;
151
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 catch (OrthancPlugins::PluginException& e)
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
523 {
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
524 return NULL;
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
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
529 static uint32_t GetMoveSize2(void *moveDriver)
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 assert(moveDriver != NULL);
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
532 assert(getMoveSizeCallback_ != NULL);
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
533
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
534 PythonLock lock;
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 PythonObject args(lock, PyTuple_New(1));
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
537 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
538 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
539
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
540 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
541
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
542 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
543 if (code != OrthancPluginErrorCode_Success)
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
544 {
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
545 throw OrthancPlugins::PluginException(code);
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
546 }
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
547
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
548 if (!PyLong_Check(result.GetPyObject()))
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 throw OrthancPlugins::PluginException(OrthancPluginErrorCode_BadParameterType);
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
551 }
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 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
554 }
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
555
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
556
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
557 OrthancPluginErrorCode ApplyMove2(void *moveDriver)
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
558 {
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
559 assert(moveDriver != NULL);
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
560 assert(applyMoveCallback_ != 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 PythonLock lock;
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 PythonObject args(lock, PyTuple_New(1));
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
565 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
566 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
567
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
568 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
569
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
570 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
571 return code;
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
572 }
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
573
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
574
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
575 void FreeMove2(void *moveDriver)
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
576 {
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
577 assert(moveDriver != NULL);
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
578
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
579 PythonLock lock;
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 PythonObject args(lock, PyTuple_New(1));
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
582 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
583 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
584
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
585 assert(freeMoveCallback_ != NULL);
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
586 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
587
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
588 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
589
152
a6b4e0abe532 fix leaking of MoveDriver
Alain Mazy <am@osimis.io>
parents: 151
diff changeset
590 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
591 }
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
592
64
091fb1903bfc new wrapped function: orthanc.RegisterWorklistCallback() and orthanc.WorklistAnswers.WorklistAddAnswer()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 63
diff changeset
593
091fb1903bfc new wrapped function: orthanc.RegisterWorklistCallback() and orthanc.WorklistAnswers.WorklistAddAnswer()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 63
diff changeset
594 OrthancPluginErrorCode WorklistCallback(OrthancPluginWorklistAnswers *answers,
091fb1903bfc new wrapped function: orthanc.RegisterWorklistCallback() and orthanc.WorklistAnswers.WorklistAddAnswer()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 63
diff changeset
595 const OrthancPluginWorklistQuery *query,
091fb1903bfc new wrapped function: orthanc.RegisterWorklistCallback() and orthanc.WorklistAnswers.WorklistAddAnswer()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 63
diff changeset
596 const char *issuerAet,
091fb1903bfc new wrapped function: orthanc.RegisterWorklistCallback() and orthanc.WorklistAnswers.WorklistAddAnswer()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 63
diff changeset
597 const char *calledAet)
091fb1903bfc new wrapped function: orthanc.RegisterWorklistCallback() and orthanc.WorklistAnswers.WorklistAddAnswer()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 63
diff changeset
598 {
091fb1903bfc new wrapped function: orthanc.RegisterWorklistCallback() and orthanc.WorklistAnswers.WorklistAddAnswer()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 63
diff changeset
599 try
091fb1903bfc new wrapped function: orthanc.RegisterWorklistCallback() and orthanc.WorklistAnswers.WorklistAddAnswer()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 63
diff changeset
600 {
091fb1903bfc new wrapped function: orthanc.RegisterWorklistCallback() and orthanc.WorklistAnswers.WorklistAddAnswer()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 63
diff changeset
601 PythonLock lock;
091fb1903bfc new wrapped function: orthanc.RegisterWorklistCallback() and orthanc.WorklistAnswers.WorklistAddAnswer()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 63
diff changeset
602
091fb1903bfc new wrapped function: orthanc.RegisterWorklistCallback() and orthanc.WorklistAnswers.WorklistAddAnswer()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 63
diff changeset
603 PyObject *pAnswers, *pQuery;
091fb1903bfc new wrapped function: orthanc.RegisterWorklistCallback() and orthanc.WorklistAnswers.WorklistAddAnswer()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 63
diff changeset
604
091fb1903bfc new wrapped function: orthanc.RegisterWorklistCallback() and orthanc.WorklistAnswers.WorklistAddAnswer()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 63
diff changeset
605 {
091fb1903bfc new wrapped function: orthanc.RegisterWorklistCallback() and orthanc.WorklistAnswers.WorklistAddAnswer()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 63
diff changeset
606 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
607 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
608 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
609 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
610 }
091fb1903bfc new wrapped function: orthanc.RegisterWorklistCallback() and orthanc.WorklistAnswers.WorklistAddAnswer()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 63
diff changeset
611
091fb1903bfc new wrapped function: orthanc.RegisterWorklistCallback() and orthanc.WorklistAnswers.WorklistAddAnswer()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 63
diff changeset
612 {
091fb1903bfc new wrapped function: orthanc.RegisterWorklistCallback() and orthanc.WorklistAnswers.WorklistAddAnswer()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 63
diff changeset
613 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
614 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
615 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
616 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
617 }
091fb1903bfc new wrapped function: orthanc.RegisterWorklistCallback() and orthanc.WorklistAnswers.WorklistAddAnswer()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 63
diff changeset
618
091fb1903bfc new wrapped function: orthanc.RegisterWorklistCallback() and orthanc.WorklistAnswers.WorklistAddAnswer()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 63
diff changeset
619 PythonString pIssuerAet(lock, issuerAet);
091fb1903bfc new wrapped function: orthanc.RegisterWorklistCallback() and orthanc.WorklistAnswers.WorklistAddAnswer()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 63
diff changeset
620 PythonString pCalledAet(lock, calledAet);
091fb1903bfc new wrapped function: orthanc.RegisterWorklistCallback() and orthanc.WorklistAnswers.WorklistAddAnswer()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 63
diff changeset
621
091fb1903bfc new wrapped function: orthanc.RegisterWorklistCallback() and orthanc.WorklistAnswers.WorklistAddAnswer()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 63
diff changeset
622 {
091fb1903bfc new wrapped function: orthanc.RegisterWorklistCallback() and orthanc.WorklistAnswers.WorklistAddAnswer()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 63
diff changeset
623 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
624 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
625 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
626 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
627 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
628
091fb1903bfc new wrapped function: orthanc.RegisterWorklistCallback() and orthanc.WorklistAnswers.WorklistAddAnswer()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 63
diff changeset
629 assert(worklistScpCallback_ != NULL);
091fb1903bfc new wrapped function: orthanc.RegisterWorklistCallback() and orthanc.WorklistAnswers.WorklistAddAnswer()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 63
diff changeset
630 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
631 }
091fb1903bfc new wrapped function: orthanc.RegisterWorklistCallback() and orthanc.WorklistAnswers.WorklistAddAnswer()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 63
diff changeset
632
091fb1903bfc new wrapped function: orthanc.RegisterWorklistCallback() and orthanc.WorklistAnswers.WorklistAddAnswer()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 63
diff changeset
633 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
634 }
091fb1903bfc new wrapped function: orthanc.RegisterWorklistCallback() and orthanc.WorklistAnswers.WorklistAddAnswer()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 63
diff changeset
635 catch (OrthancPlugins::PluginException& e)
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 return e.GetErrorCode();
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 }
091fb1903bfc new wrapped function: orthanc.RegisterWorklistCallback() and orthanc.WorklistAnswers.WorklistAddAnswer()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 63
diff changeset
640
63
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
641
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
642 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
643 {
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
644 // 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
645
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
646 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
647 {
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
648 public:
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
649 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
650 {
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
651 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
652 }
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
653 };
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
654
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
655 Registration registration;
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
656 return ICallbackRegistration::Apply(
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
657 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
658 }
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
659
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
660
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
661 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
662 {
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
663 // 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
664
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
665 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
666 {
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
667 public:
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
668 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
669 {
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
670 OrthancPluginRegisterMoveCallback(
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
671 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
672 }
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
673 };
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
674
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
675 Registration registration;
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
676 return ICallbackRegistration::Apply(
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
677 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
678 }
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
151
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
681 PyObject* RegisterMoveCallback2(PyObject* module, PyObject* args)
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
682 {
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
683 // 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
684
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
685 class Registration : public ICallbackRegistration
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
686 {
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
687 public:
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
688 virtual void Register() ORTHANC_OVERRIDE
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
689 {
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
690 OrthancPluginRegisterMoveCallback(
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
691 OrthancPlugins::GetGlobalContext(), CreateMoveCallback2, GetMoveSize2, ApplyMove2, FreeMove2);
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
692 }
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
693 };
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
694
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
695 Registration registration;
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
696 return ICallbackRegistration::Apply4(
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
697 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
698 }
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
699
64
091fb1903bfc new wrapped function: orthanc.RegisterWorklistCallback() and orthanc.WorklistAnswers.WorklistAddAnswer()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 63
diff changeset
700 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
701 {
091fb1903bfc new wrapped function: orthanc.RegisterWorklistCallback() and orthanc.WorklistAnswers.WorklistAddAnswer()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 63
diff changeset
702 // 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
703
091fb1903bfc new wrapped function: orthanc.RegisterWorklistCallback() and orthanc.WorklistAnswers.WorklistAddAnswer()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 63
diff changeset
704 class Registration : public ICallbackRegistration
091fb1903bfc new wrapped function: orthanc.RegisterWorklistCallback() and orthanc.WorklistAnswers.WorklistAddAnswer()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 63
diff changeset
705 {
091fb1903bfc new wrapped function: orthanc.RegisterWorklistCallback() and orthanc.WorklistAnswers.WorklistAddAnswer()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 63
diff changeset
706 public:
091fb1903bfc new wrapped function: orthanc.RegisterWorklistCallback() and orthanc.WorklistAnswers.WorklistAddAnswer()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 63
diff changeset
707 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
708 {
091fb1903bfc new wrapped function: orthanc.RegisterWorklistCallback() and orthanc.WorklistAnswers.WorklistAddAnswer()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 63
diff changeset
709 OrthancPluginRegisterWorklistCallback(OrthancPlugins::GetGlobalContext(), WorklistCallback);
091fb1903bfc new wrapped function: orthanc.RegisterWorklistCallback() and orthanc.WorklistAnswers.WorklistAddAnswer()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 63
diff changeset
710 }
091fb1903bfc new wrapped function: orthanc.RegisterWorklistCallback() and orthanc.WorklistAnswers.WorklistAddAnswer()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 63
diff changeset
711 };
091fb1903bfc new wrapped function: orthanc.RegisterWorklistCallback() and orthanc.WorklistAnswers.WorklistAddAnswer()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 63
diff changeset
712
091fb1903bfc new wrapped function: orthanc.RegisterWorklistCallback() and orthanc.WorklistAnswers.WorklistAddAnswer()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 63
diff changeset
713 Registration registration;
091fb1903bfc new wrapped function: orthanc.RegisterWorklistCallback() and orthanc.WorklistAnswers.WorklistAddAnswer()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 63
diff changeset
714 return ICallbackRegistration::Apply(
091fb1903bfc new wrapped function: orthanc.RegisterWorklistCallback() and orthanc.WorklistAnswers.WorklistAddAnswer()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 63
diff changeset
715 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
716 }
091fb1903bfc new wrapped function: orthanc.RegisterWorklistCallback() and orthanc.WorklistAnswers.WorklistAddAnswer()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 63
diff changeset
717
091fb1903bfc new wrapped function: orthanc.RegisterWorklistCallback() and orthanc.WorklistAnswers.WorklistAddAnswer()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 63
diff changeset
718
63
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
719 void FinalizeDicomScpCallbacks()
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
720 {
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
721 ICallbackRegistration::Unregister(findScpCallback_);
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
722 ICallbackRegistration::Unregister(moveScpCallback_);
64
091fb1903bfc new wrapped function: orthanc.RegisterWorklistCallback() and orthanc.WorklistAnswers.WorklistAddAnswer()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 63
diff changeset
723 ICallbackRegistration::Unregister(worklistScpCallback_);
151
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
724
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
725 ICallbackRegistration::Unregister(createMoveScpDriverCallback_);
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
726 ICallbackRegistration::Unregister(getMoveSizeCallback_);
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
727 ICallbackRegistration::Unregister(applyMoveCallback_);
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
728 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
729 }