annotate Sources/DicomScpCallbacks.cpp @ 157:a8408ef2b2d8

merge cmove2 -> default
author Alain Mazy <am@orthanc.team>
date Thu, 16 May 2024 10:38:22 +0200
parents 71d305c29cfa a6b4e0abe532
children 6fada29b6759
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
63
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1 /**
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2 * Python plugin for Orthanc
155
71d305c29cfa updated year to 2024
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 131
diff changeset
3 * Copyright (C) 2020-2024 Osimis S.A., Belgium
71d305c29cfa updated year to 2024
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 131
diff changeset
4 * 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
5 *
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6 * 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
7 * 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
8 * 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
9 * 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
10 *
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
11 * 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
12 * 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
13 * 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
14 * 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
15 *
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
16 * 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
17 * 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
18 **/
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
19
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
20
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
21 #include "DicomScpCallbacks.h"
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
22
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
23 #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
24 #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
25 #include "ICallbackRegistration.h"
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
26 #include "PythonString.h"
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
27
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
28
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
29 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
30 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
31 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
32
151
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
33 // version 2 of Move callbacks
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
34 static PyObject* createMoveScpDriverCallback_ = NULL;
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
35 static PyObject* getMoveSizeCallback_ = NULL;
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
36 static PyObject* applyMoveCallback_ = NULL;
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
37 static PyObject* freeMoveCallback_ = NULL;
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
38
63
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
39
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
40 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
41 PyObject *args,
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
42 bool isGroup)
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
43 {
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
44 unsigned long index;
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
45 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
46
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
47 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
48 {
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
49 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
50 return NULL;
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 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
53 {
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
54 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
55 return 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 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
58 OrthancPluginErrorCode_Success)
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 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
61 return NULL;
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
62 }
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
63 else if (isGroup)
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 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
66 }
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
67 else
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
68 {
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
69 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
70 }
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
71 }
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
72
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
73
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
74
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
75 // 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
76 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
77 {
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
78 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
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 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
82 {
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
83 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
84 }
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
85
64
091fb1903bfc new wrapped function: orthanc.RegisterWorklistCallback() and orthanc.WorklistAnswers.WorklistAddAnswer()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 63
diff changeset
86 PyObject *WorklistAddAnswer(sdk_OrthancPluginWorklistAnswers_Object* self, PyObject *args)
091fb1903bfc new wrapped function: orthanc.RegisterWorklistCallback() and orthanc.WorklistAnswers.WorklistAddAnswer()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 63
diff changeset
87 {
091fb1903bfc new wrapped function: orthanc.RegisterWorklistCallback() and orthanc.WorklistAnswers.WorklistAddAnswer()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 63
diff changeset
88 PyObject* query = NULL;
091fb1903bfc new wrapped function: orthanc.RegisterWorklistCallback() and orthanc.WorklistAnswers.WorklistAddAnswer()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 63
diff changeset
89 Py_buffer dicom;
091fb1903bfc new wrapped function: orthanc.RegisterWorklistCallback() and orthanc.WorklistAnswers.WorklistAddAnswer()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 63
diff changeset
90
091fb1903bfc new wrapped function: orthanc.RegisterWorklistCallback() and orthanc.WorklistAnswers.WorklistAddAnswer()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 63
diff changeset
91 if (self->object_ == NULL)
091fb1903bfc new wrapped function: orthanc.RegisterWorklistCallback() and orthanc.WorklistAnswers.WorklistAddAnswer()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 63
diff changeset
92 {
091fb1903bfc new wrapped function: orthanc.RegisterWorklistCallback() and orthanc.WorklistAnswers.WorklistAddAnswer()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 63
diff changeset
93 PyErr_SetString(PyExc_ValueError, "Invalid object");
091fb1903bfc new wrapped function: orthanc.RegisterWorklistCallback() and orthanc.WorklistAnswers.WorklistAddAnswer()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 63
diff changeset
94 return NULL;
091fb1903bfc new wrapped function: orthanc.RegisterWorklistCallback() and orthanc.WorklistAnswers.WorklistAddAnswer()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 63
diff changeset
95 }
091fb1903bfc new wrapped function: orthanc.RegisterWorklistCallback() and orthanc.WorklistAnswers.WorklistAddAnswer()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 63
diff changeset
96 else if (!PyArg_ParseTuple(args, "Os*", &query, &dicom))
091fb1903bfc new wrapped function: orthanc.RegisterWorklistCallback() and orthanc.WorklistAnswers.WorklistAddAnswer()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 63
diff changeset
97 {
091fb1903bfc new wrapped function: orthanc.RegisterWorklistCallback() and orthanc.WorklistAnswers.WorklistAddAnswer()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 63
diff changeset
98 PyErr_SetString(PyExc_TypeError, "Please provide a orthanc.WorklistQuery object, and a DICOM buffer");
091fb1903bfc new wrapped function: orthanc.RegisterWorklistCallback() and orthanc.WorklistAnswers.WorklistAddAnswer()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 63
diff changeset
99 return NULL;
091fb1903bfc new wrapped function: orthanc.RegisterWorklistCallback() and orthanc.WorklistAnswers.WorklistAddAnswer()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 63
diff changeset
100 }
091fb1903bfc new wrapped function: orthanc.RegisterWorklistCallback() and orthanc.WorklistAnswers.WorklistAddAnswer()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 63
diff changeset
101 else if (query == Py_None ||
091fb1903bfc new wrapped function: orthanc.RegisterWorklistCallback() and orthanc.WorklistAnswers.WorklistAddAnswer()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 63
diff changeset
102 Py_TYPE(query) != GetOrthancPluginWorklistQueryType())
091fb1903bfc new wrapped function: orthanc.RegisterWorklistCallback() and orthanc.WorklistAnswers.WorklistAddAnswer()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 63
diff changeset
103 {
091fb1903bfc new wrapped function: orthanc.RegisterWorklistCallback() and orthanc.WorklistAnswers.WorklistAddAnswer()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 63
diff changeset
104 PyErr_SetString(PyExc_TypeError, "Invalid orthanc.WorklistQuery object");
091fb1903bfc new wrapped function: orthanc.RegisterWorklistCallback() and orthanc.WorklistAnswers.WorklistAddAnswer()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 63
diff changeset
105 return NULL;
091fb1903bfc new wrapped function: orthanc.RegisterWorklistCallback() and orthanc.WorklistAnswers.WorklistAddAnswer()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 63
diff changeset
106 }
091fb1903bfc new wrapped function: orthanc.RegisterWorklistCallback() and orthanc.WorklistAnswers.WorklistAddAnswer()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 63
diff changeset
107 else
091fb1903bfc new wrapped function: orthanc.RegisterWorklistCallback() and orthanc.WorklistAnswers.WorklistAddAnswer()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 63
diff changeset
108 {
091fb1903bfc new wrapped function: orthanc.RegisterWorklistCallback() and orthanc.WorklistAnswers.WorklistAddAnswer()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 63
diff changeset
109 OrthancPluginErrorCode code = OrthancPluginWorklistAddAnswer(
091fb1903bfc new wrapped function: orthanc.RegisterWorklistCallback() and orthanc.WorklistAnswers.WorklistAddAnswer()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 63
diff changeset
110 OrthancPlugins::GetGlobalContext(), self->object_,
091fb1903bfc new wrapped function: orthanc.RegisterWorklistCallback() and orthanc.WorklistAnswers.WorklistAddAnswer()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 63
diff changeset
111 reinterpret_cast<sdk_OrthancPluginWorklistQuery_Object*>(query)->object_,
091fb1903bfc new wrapped function: orthanc.RegisterWorklistCallback() and orthanc.WorklistAnswers.WorklistAddAnswer()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 63
diff changeset
112 dicom.buf, dicom.len);
091fb1903bfc new wrapped function: orthanc.RegisterWorklistCallback() and orthanc.WorklistAnswers.WorklistAddAnswer()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 63
diff changeset
113
091fb1903bfc new wrapped function: orthanc.RegisterWorklistCallback() and orthanc.WorklistAnswers.WorklistAddAnswer()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 63
diff changeset
114 PyBuffer_Release(&dicom);
091fb1903bfc new wrapped function: orthanc.RegisterWorklistCallback() and orthanc.WorklistAnswers.WorklistAddAnswer()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 63
diff changeset
115
091fb1903bfc new wrapped function: orthanc.RegisterWorklistCallback() and orthanc.WorklistAnswers.WorklistAddAnswer()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 63
diff changeset
116 if (code == OrthancPluginErrorCode_Success)
091fb1903bfc new wrapped function: orthanc.RegisterWorklistCallback() and orthanc.WorklistAnswers.WorklistAddAnswer()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 63
diff changeset
117 {
091fb1903bfc new wrapped function: orthanc.RegisterWorklistCallback() and orthanc.WorklistAnswers.WorklistAddAnswer()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 63
diff changeset
118 Py_INCREF(Py_None);
091fb1903bfc new wrapped function: orthanc.RegisterWorklistCallback() and orthanc.WorklistAnswers.WorklistAddAnswer()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 63
diff changeset
119 return Py_None;
091fb1903bfc new wrapped function: orthanc.RegisterWorklistCallback() and orthanc.WorklistAnswers.WorklistAddAnswer()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 63
diff changeset
120 }
091fb1903bfc new wrapped function: orthanc.RegisterWorklistCallback() and orthanc.WorklistAnswers.WorklistAddAnswer()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 63
diff changeset
121 else
091fb1903bfc new wrapped function: orthanc.RegisterWorklistCallback() and orthanc.WorklistAnswers.WorklistAddAnswer()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 63
diff changeset
122 {
091fb1903bfc new wrapped function: orthanc.RegisterWorklistCallback() and orthanc.WorklistAnswers.WorklistAddAnswer()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 63
diff changeset
123 PyErr_SetString(PyExc_ValueError, "Internal error");
091fb1903bfc new wrapped function: orthanc.RegisterWorklistCallback() and orthanc.WorklistAnswers.WorklistAddAnswer()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 63
diff changeset
124 return NULL;
091fb1903bfc new wrapped function: orthanc.RegisterWorklistCallback() and orthanc.WorklistAnswers.WorklistAddAnswer()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 63
diff changeset
125 }
091fb1903bfc new wrapped function: orthanc.RegisterWorklistCallback() and orthanc.WorklistAnswers.WorklistAddAnswer()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 63
diff changeset
126 }
091fb1903bfc new wrapped function: orthanc.RegisterWorklistCallback() and orthanc.WorklistAnswers.WorklistAddAnswer()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 63
diff changeset
127 }
091fb1903bfc new wrapped function: orthanc.RegisterWorklistCallback() and orthanc.WorklistAnswers.WorklistAddAnswer()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 63
diff changeset
128 // End of "CUSTOM_METHODS"
091fb1903bfc new wrapped function: orthanc.RegisterWorklistCallback() and orthanc.WorklistAnswers.WorklistAddAnswer()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 63
diff changeset
129
091fb1903bfc new wrapped function: orthanc.RegisterWorklistCallback() and orthanc.WorklistAnswers.WorklistAddAnswer()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 63
diff changeset
130
63
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 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
133 const OrthancPluginFindQuery *query,
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
134 const char *issuerAet,
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
135 const char *calledAet)
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
136 {
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
137 try
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
138 {
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
139 PythonLock lock;
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
140
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
141 PyObject *pAnswers, *pQuery;
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 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
145 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
146 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
147 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
148 }
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
149
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
150 {
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
151 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
152 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
153 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
154 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
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 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
158 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
159
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
160 {
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
161 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
162 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
163 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
164 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
165 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
166
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
167 assert(findScpCallback_ != NULL);
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
168 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
169 }
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
170
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
171 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
172 }
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
173 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
174 {
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
175 return e.GetErrorCode();
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
176 }
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
177 }
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
178
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
179
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
180
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
181 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
182 {
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
183 public:
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
184 virtual ~IMoveDriver()
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
185 {
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
186 }
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
187
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
188 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
189 };
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
190
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
191
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
192 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
193 const char *patientId,
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
194 const char *accessionNumber,
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
195 const char *studyInstanceUid,
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
196 const char *seriesInstanceUid,
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
197 const char *sopInstanceUid,
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
198 const char *originatorAet,
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
199 const char *sourceAet,
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
200 const char *targetAet,
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
201 uint16_t originatorId)
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 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
204 {
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
205 private:
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
206 OrthancPluginResourceType resourceType_;
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
207 std::string patientId_;
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
208 std::string accessionNumber_;
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
209 std::string studyInstanceUid_;
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
210 std::string seriesInstanceUid_;
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
211 std::string sopInstanceUid_;
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
212 std::string originatorAet_;
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
213 std::string sourceAet_;
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
214 std::string targetAet_;
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
215 uint16_t originatorId_;
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
216
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
217 public:
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
218 Driver(OrthancPluginResourceType resourceType,
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
219 const char *patientId,
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
220 const char *accessionNumber,
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
221 const char *studyInstanceUid,
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
222 const char *seriesInstanceUid,
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
223 const char *sopInstanceUid,
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
224 const char *originatorAet,
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
225 const char *sourceAet,
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
226 const char *targetAet,
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
227 uint16_t originatorId) :
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
228 resourceType_(resourceType),
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
229 originatorId_(originatorId)
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 (patientId != 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 patientId_.assign(patientId);
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 if (accessionNumber != NULL)
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 accessionNumber_.assign(accessionNumber);
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
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
241 if (studyInstanceUid != NULL)
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
242 {
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
243 studyInstanceUid_.assign(studyInstanceUid);
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
244 }
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
245
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
246 if (seriesInstanceUid != NULL)
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
247 {
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
248 seriesInstanceUid_.assign(seriesInstanceUid);
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
249 }
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 if (sopInstanceUid != NULL)
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
252 {
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
253 sopInstanceUid_.assign(sopInstanceUid);
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
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
256 if (originatorAet != NULL)
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
257 {
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
258 originatorAet_.assign(originatorAet);
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
259 }
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
260
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
261 if (sourceAet != NULL)
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 sourceAet_.assign(sourceAet);
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
264 }
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 if (targetAet != NULL)
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 targetAet_.assign(targetAet);
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
269 }
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 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
274 {
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
275 PythonLock lock;
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 PythonObject kw(lock, PyDict_New());
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
278
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
279 std::string level;
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
280 switch (resourceType_)
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 case OrthancPluginResourceType_Patient:
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
283 level = "PATIENT";
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
284 break;
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 case OrthancPluginResourceType_Study:
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
287 level = "STUDY";
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
288 break;
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
289
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
290 case OrthancPluginResourceType_Series:
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
291 level = "SERIES";
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
292 break;
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
293
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
294 case OrthancPluginResourceType_Instance:
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
295 level = "INSTANCE";
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
296 break;
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 default:
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
299 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
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, level);
126
9ffe8881f856 fixing more PyDict_SetItemString()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 101
diff changeset
304 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
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, patientId_);
126
9ffe8881f856 fixing more PyDict_SetItemString()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 101
diff changeset
309 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
310 }
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
311
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
312 {
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
313 PythonString tmp(lock, accessionNumber_);
126
9ffe8881f856 fixing more PyDict_SetItemString()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 101
diff changeset
314 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
315 }
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
316
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
317 {
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
318 PythonString tmp(lock, studyInstanceUid_);
126
9ffe8881f856 fixing more PyDict_SetItemString()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 101
diff changeset
319 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
320 }
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
321
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
322 {
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
323 PythonString tmp(lock, seriesInstanceUid_);
126
9ffe8881f856 fixing more PyDict_SetItemString()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 101
diff changeset
324 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
325 }
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 PythonString tmp(lock, sopInstanceUid_);
126
9ffe8881f856 fixing more PyDict_SetItemString()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 101
diff changeset
329 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
330 }
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
331
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
332 {
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
333 PythonString tmp(lock, originatorAet_);
126
9ffe8881f856 fixing more PyDict_SetItemString()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 101
diff changeset
334 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
335 }
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
336
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
337 {
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
338 PythonString tmp(lock, sourceAet_);
126
9ffe8881f856 fixing more PyDict_SetItemString()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 101
diff changeset
339 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
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 PythonString tmp(lock, targetAet_);
126
9ffe8881f856 fixing more PyDict_SetItemString()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 101
diff changeset
344 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
345 }
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
346
127
a862d554753f fixing leaks associated with setting integers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 126
diff changeset
347 {
a862d554753f fixing leaks associated with setting integers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 126
diff changeset
348 PythonObject tmp(lock, PyLong_FromUnsignedLong(originatorId_));
a862d554753f fixing leaks associated with setting integers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 126
diff changeset
349 PyDict_SetItemString(kw.GetPyObject(), "OriginatorID", tmp.GetPyObject());
a862d554753f fixing leaks associated with setting integers
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 126
diff changeset
350 }
63
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 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
353
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
354 assert(moveScpCallback_ != NULL);
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
355 PythonObject result(lock, PyObject_Call(moveScpCallback_, args.GetPyObject(), kw.GetPyObject()));
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
356
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
357 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
358 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
359 {
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
360 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
361 }
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 try
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
366 {
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
367 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
368 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
369 targetAet, originatorId);
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 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
372 {
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
373 return NULL;
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
374 }
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
375 }
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
376
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
377
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
378 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
379 {
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
380 assert(moveDriver != NULL);
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
381 return 1;
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
382 }
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
383
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
384
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
385 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
386 {
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
387 assert(moveDriver != NULL);
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
388
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
389 try
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
390 {
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
391 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
392 return OrthancPluginErrorCode_Success;
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
393 }
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
394 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
395 {
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
396 return e.GetErrorCode();
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
397 }
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
398 }
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
399
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
400
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
401 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
402 {
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
403 assert(moveDriver != NULL);
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
404 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
405 }
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
406
64
091fb1903bfc new wrapped function: orthanc.RegisterWorklistCallback() and orthanc.WorklistAnswers.WorklistAddAnswer()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 63
diff changeset
407
151
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
408 static void* CreateMoveCallback2(OrthancPluginResourceType resourceType,
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
409 const char *patientId,
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
410 const char *accessionNumber,
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
411 const char *studyInstanceUid,
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
412 const char *seriesInstanceUid,
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
413 const char *sopInstanceUid,
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
414 const char *originatorAet,
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
415 const char *sourceAet,
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
416 const char *targetAet,
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
417 uint16_t originatorId)
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 assert(createMoveScpDriverCallback_ != 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 try
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 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
424 if (patientId != 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 _patientId.assign(patientId);
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 if (accessionNumber != NULL)
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
430 {
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
431 _accessionNumber.assign(accessionNumber);
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
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
434 if (studyInstanceUid != NULL)
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 _studyInstanceUid.assign(studyInstanceUid);
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
437 }
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
438
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
439 if (seriesInstanceUid != NULL)
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
440 {
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
441 _seriesInstanceUid.assign(seriesInstanceUid);
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
442 }
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 if (sopInstanceUid != NULL)
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
445 {
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
446 _sopInstanceUid.assign(sopInstanceUid);
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
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
449 if (originatorAet != NULL)
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
450 {
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
451 _originatorAet.assign(originatorAet);
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
452 }
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
453
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
454 if (sourceAet != NULL)
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 _sourceAet.assign(sourceAet);
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
457 }
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
458
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
459 if (targetAet != NULL)
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 _targetAet.assign(targetAet);
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
462 }
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
463
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
464 PythonLock lock;
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 PythonObject kw(lock, PyDict_New());
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
467
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
468 std::string level;
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
469 switch (resourceType)
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 case OrthancPluginResourceType_Patient:
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
472 level = "PATIENT";
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
473 break;
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 case OrthancPluginResourceType_Study:
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
476 level = "STUDY";
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
477 break;
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
478
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
479 case OrthancPluginResourceType_Series:
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
480 level = "SERIES";
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
481 break;
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
482
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
483 case OrthancPluginResourceType_Instance:
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
484 level = "INSTANCE";
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
485 break;
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 default:
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
488 throw OrthancPlugins::PluginException(OrthancPluginErrorCode_ParameterOutOfRange);
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, level);
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
493 PyDict_SetItemString(kw.GetPyObject(), "Level", tmp.GetPyObject());
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, _patientId);
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
498 PyDict_SetItemString(kw.GetPyObject(), "PatientID", tmp.GetPyObject());
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 PythonString tmp(lock, _accessionNumber);
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
503 PyDict_SetItemString(kw.GetPyObject(), "AccessionNumber", tmp.GetPyObject());
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 {
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
507 PythonString tmp(lock, _studyInstanceUid);
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
508 PyDict_SetItemString(kw.GetPyObject(), "StudyInstanceUID", tmp.GetPyObject());
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
509 }
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
510
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
511 {
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
512 PythonString tmp(lock, _seriesInstanceUid);
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
513 PyDict_SetItemString(kw.GetPyObject(), "SeriesInstanceUID", tmp.GetPyObject());
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
514 }
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
515
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
516 {
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
517 PythonString tmp(lock, _sopInstanceUid);
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
518 PyDict_SetItemString(kw.GetPyObject(), "SOPInstanceUID", tmp.GetPyObject());
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
519 }
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
520
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
521 {
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
522 PythonString tmp(lock, _originatorAet);
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
523 PyDict_SetItemString(kw.GetPyObject(), "OriginatorAET", tmp.GetPyObject());
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
524 }
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 PythonString tmp(lock, _sourceAet);
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
528 PyDict_SetItemString(kw.GetPyObject(), "SourceAET", tmp.GetPyObject());
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
529 }
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
530
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
531 {
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
532 PythonString tmp(lock, _targetAet);
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
533 PyDict_SetItemString(kw.GetPyObject(), "TargetAET", tmp.GetPyObject());
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
534 }
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
535
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
536 {
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
537 PythonObject tmp(lock, PyLong_FromUnsignedLong(originatorId));
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
538 PyDict_SetItemString(kw.GetPyObject(), "OriginatorID", tmp.GetPyObject());
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
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
541 PythonObject args(lock, PyTuple_New(0));
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
542
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
543 // 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
544 // 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
545 // 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
546 // to delete the object at the end of the move.
a6b4e0abe532 fix leaking of MoveDriver
Alain Mazy <am@osimis.io>
parents: 151
diff changeset
547 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
548
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
549 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
550 if (code != OrthancPluginErrorCode_Success)
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 throw OrthancPlugins::PluginException(code);
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
553 }
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
554
152
a6b4e0abe532 fix leaking of MoveDriver
Alain Mazy <am@osimis.io>
parents: 151
diff changeset
555 return result;
151
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 catch (OrthancPlugins::PluginException& e)
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 return NULL;
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
560 }
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
561 }
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
562
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
563
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
564 static uint32_t GetMoveSize2(void *moveDriver)
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
565 {
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
566 assert(moveDriver != NULL);
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
567 assert(getMoveSizeCallback_ != NULL);
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
568
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
569 PythonLock lock;
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
570
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
571 PythonObject args(lock, PyTuple_New(1));
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
572 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
573 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
574
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
575 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
576
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
577 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
578 if (code != OrthancPluginErrorCode_Success)
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
579 {
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
580 throw OrthancPlugins::PluginException(code);
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
581 }
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
582
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
583 if (!PyLong_Check(result.GetPyObject()))
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 throw OrthancPlugins::PluginException(OrthancPluginErrorCode_BadParameterType);
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
586 }
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 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
589 }
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
590
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
591
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
592 OrthancPluginErrorCode ApplyMove2(void *moveDriver)
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
593 {
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
594 assert(moveDriver != NULL);
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
595 assert(applyMoveCallback_ != NULL);
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
596
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
597 PythonLock lock;
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
598
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
599 PythonObject args(lock, PyTuple_New(1));
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
600 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
601 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
602
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
603 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
604
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
605 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
606 return code;
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
607 }
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
608
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
609
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
610 void FreeMove2(void *moveDriver)
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
611 {
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
612 assert(moveDriver != NULL);
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
613
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
614 PythonLock lock;
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
615
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
616 PythonObject args(lock, PyTuple_New(1));
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
617 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
618 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
619
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
620 assert(freeMoveCallback_ != NULL);
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
621 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
622
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
623 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
624
152
a6b4e0abe532 fix leaking of MoveDriver
Alain Mazy <am@osimis.io>
parents: 151
diff changeset
625 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
626 }
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
627
64
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 OrthancPluginErrorCode WorklistCallback(OrthancPluginWorklistAnswers *answers,
091fb1903bfc new wrapped function: orthanc.RegisterWorklistCallback() and orthanc.WorklistAnswers.WorklistAddAnswer()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 63
diff changeset
630 const OrthancPluginWorklistQuery *query,
091fb1903bfc new wrapped function: orthanc.RegisterWorklistCallback() and orthanc.WorklistAnswers.WorklistAddAnswer()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 63
diff changeset
631 const char *issuerAet,
091fb1903bfc new wrapped function: orthanc.RegisterWorklistCallback() and orthanc.WorklistAnswers.WorklistAddAnswer()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 63
diff changeset
632 const char *calledAet)
091fb1903bfc new wrapped function: orthanc.RegisterWorklistCallback() and orthanc.WorklistAnswers.WorklistAddAnswer()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 63
diff changeset
633 {
091fb1903bfc new wrapped function: orthanc.RegisterWorklistCallback() and orthanc.WorklistAnswers.WorklistAddAnswer()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 63
diff changeset
634 try
091fb1903bfc new wrapped function: orthanc.RegisterWorklistCallback() and orthanc.WorklistAnswers.WorklistAddAnswer()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 63
diff changeset
635 {
091fb1903bfc new wrapped function: orthanc.RegisterWorklistCallback() and orthanc.WorklistAnswers.WorklistAddAnswer()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 63
diff changeset
636 PythonLock lock;
091fb1903bfc new wrapped function: orthanc.RegisterWorklistCallback() and orthanc.WorklistAnswers.WorklistAddAnswer()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 63
diff changeset
637
091fb1903bfc new wrapped function: orthanc.RegisterWorklistCallback() and orthanc.WorklistAnswers.WorklistAddAnswer()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 63
diff changeset
638 PyObject *pAnswers, *pQuery;
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 {
091fb1903bfc new wrapped function: orthanc.RegisterWorklistCallback() and orthanc.WorklistAnswers.WorklistAddAnswer()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 63
diff changeset
641 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
642 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
643 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
644 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
645 }
091fb1903bfc new wrapped function: orthanc.RegisterWorklistCallback() and orthanc.WorklistAnswers.WorklistAddAnswer()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 63
diff changeset
646
091fb1903bfc new wrapped function: orthanc.RegisterWorklistCallback() and orthanc.WorklistAnswers.WorklistAddAnswer()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 63
diff changeset
647 {
091fb1903bfc new wrapped function: orthanc.RegisterWorklistCallback() and orthanc.WorklistAnswers.WorklistAddAnswer()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 63
diff changeset
648 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
649 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
650 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
651 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
652 }
091fb1903bfc new wrapped function: orthanc.RegisterWorklistCallback() and orthanc.WorklistAnswers.WorklistAddAnswer()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 63
diff changeset
653
091fb1903bfc new wrapped function: orthanc.RegisterWorklistCallback() and orthanc.WorklistAnswers.WorklistAddAnswer()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 63
diff changeset
654 PythonString pIssuerAet(lock, issuerAet);
091fb1903bfc new wrapped function: orthanc.RegisterWorklistCallback() and orthanc.WorklistAnswers.WorklistAddAnswer()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 63
diff changeset
655 PythonString pCalledAet(lock, calledAet);
091fb1903bfc new wrapped function: orthanc.RegisterWorklistCallback() and orthanc.WorklistAnswers.WorklistAddAnswer()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 63
diff changeset
656
091fb1903bfc new wrapped function: orthanc.RegisterWorklistCallback() and orthanc.WorklistAnswers.WorklistAddAnswer()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 63
diff changeset
657 {
091fb1903bfc new wrapped function: orthanc.RegisterWorklistCallback() and orthanc.WorklistAnswers.WorklistAddAnswer()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 63
diff changeset
658 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
659 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
660 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
661 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
662 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
663
091fb1903bfc new wrapped function: orthanc.RegisterWorklistCallback() and orthanc.WorklistAnswers.WorklistAddAnswer()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 63
diff changeset
664 assert(worklistScpCallback_ != NULL);
091fb1903bfc new wrapped function: orthanc.RegisterWorklistCallback() and orthanc.WorklistAnswers.WorklistAddAnswer()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 63
diff changeset
665 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
666 }
091fb1903bfc new wrapped function: orthanc.RegisterWorklistCallback() and orthanc.WorklistAnswers.WorklistAddAnswer()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 63
diff changeset
667
091fb1903bfc new wrapped function: orthanc.RegisterWorklistCallback() and orthanc.WorklistAnswers.WorklistAddAnswer()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 63
diff changeset
668 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
669 }
091fb1903bfc new wrapped function: orthanc.RegisterWorklistCallback() and orthanc.WorklistAnswers.WorklistAddAnswer()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 63
diff changeset
670 catch (OrthancPlugins::PluginException& e)
091fb1903bfc new wrapped function: orthanc.RegisterWorklistCallback() and orthanc.WorklistAnswers.WorklistAddAnswer()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 63
diff changeset
671 {
091fb1903bfc new wrapped function: orthanc.RegisterWorklistCallback() and orthanc.WorklistAnswers.WorklistAddAnswer()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 63
diff changeset
672 return e.GetErrorCode();
091fb1903bfc new wrapped function: orthanc.RegisterWorklistCallback() and orthanc.WorklistAnswers.WorklistAddAnswer()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 63
diff changeset
673 }
091fb1903bfc new wrapped function: orthanc.RegisterWorklistCallback() and orthanc.WorklistAnswers.WorklistAddAnswer()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 63
diff changeset
674 }
091fb1903bfc new wrapped function: orthanc.RegisterWorklistCallback() and orthanc.WorklistAnswers.WorklistAddAnswer()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 63
diff changeset
675
63
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
676
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
677 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
678 {
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
679 // 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
680
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
681 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
682 {
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
683 public:
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
684 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
685 {
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
686 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
687 }
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
688 };
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
689
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
690 Registration registration;
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
691 return ICallbackRegistration::Apply(
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
692 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
693 }
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
694
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
695
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
696 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
697 {
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
698 // 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
699
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
700 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
701 {
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
702 public:
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
703 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
704 {
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
705 OrthancPluginRegisterMoveCallback(
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
706 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
707 }
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
708 };
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
709
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
710 Registration registration;
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
711 return ICallbackRegistration::Apply(
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
712 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
713 }
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
714
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
715
151
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
716 PyObject* RegisterMoveCallback2(PyObject* module, PyObject* args)
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
717 {
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
718 // 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
719
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
720 class Registration : public ICallbackRegistration
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
721 {
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
722 public:
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
723 virtual void Register() ORTHANC_OVERRIDE
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 OrthancPluginRegisterMoveCallback(
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
726 OrthancPlugins::GetGlobalContext(), CreateMoveCallback2, GetMoveSize2, ApplyMove2, FreeMove2);
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
727 }
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
728 };
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
729
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
730 Registration registration;
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
731 return ICallbackRegistration::Apply4(
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
732 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
733 }
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
734
64
091fb1903bfc new wrapped function: orthanc.RegisterWorklistCallback() and orthanc.WorklistAnswers.WorklistAddAnswer()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 63
diff changeset
735 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
736 {
091fb1903bfc new wrapped function: orthanc.RegisterWorklistCallback() and orthanc.WorklistAnswers.WorklistAddAnswer()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 63
diff changeset
737 // 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
738
091fb1903bfc new wrapped function: orthanc.RegisterWorklistCallback() and orthanc.WorklistAnswers.WorklistAddAnswer()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 63
diff changeset
739 class Registration : public ICallbackRegistration
091fb1903bfc new wrapped function: orthanc.RegisterWorklistCallback() and orthanc.WorklistAnswers.WorklistAddAnswer()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 63
diff changeset
740 {
091fb1903bfc new wrapped function: orthanc.RegisterWorklistCallback() and orthanc.WorklistAnswers.WorklistAddAnswer()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 63
diff changeset
741 public:
091fb1903bfc new wrapped function: orthanc.RegisterWorklistCallback() and orthanc.WorklistAnswers.WorklistAddAnswer()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 63
diff changeset
742 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
743 {
091fb1903bfc new wrapped function: orthanc.RegisterWorklistCallback() and orthanc.WorklistAnswers.WorklistAddAnswer()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 63
diff changeset
744 OrthancPluginRegisterWorklistCallback(OrthancPlugins::GetGlobalContext(), WorklistCallback);
091fb1903bfc new wrapped function: orthanc.RegisterWorklistCallback() and orthanc.WorklistAnswers.WorklistAddAnswer()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 63
diff changeset
745 }
091fb1903bfc new wrapped function: orthanc.RegisterWorklistCallback() and orthanc.WorklistAnswers.WorklistAddAnswer()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 63
diff changeset
746 };
091fb1903bfc new wrapped function: orthanc.RegisterWorklistCallback() and orthanc.WorklistAnswers.WorklistAddAnswer()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 63
diff changeset
747
091fb1903bfc new wrapped function: orthanc.RegisterWorklistCallback() and orthanc.WorklistAnswers.WorklistAddAnswer()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 63
diff changeset
748 Registration registration;
091fb1903bfc new wrapped function: orthanc.RegisterWorklistCallback() and orthanc.WorklistAnswers.WorklistAddAnswer()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 63
diff changeset
749 return ICallbackRegistration::Apply(
091fb1903bfc new wrapped function: orthanc.RegisterWorklistCallback() and orthanc.WorklistAnswers.WorklistAddAnswer()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 63
diff changeset
750 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
751 }
091fb1903bfc new wrapped function: orthanc.RegisterWorklistCallback() and orthanc.WorklistAnswers.WorklistAddAnswer()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 63
diff changeset
752
091fb1903bfc new wrapped function: orthanc.RegisterWorklistCallback() and orthanc.WorklistAnswers.WorklistAddAnswer()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 63
diff changeset
753
63
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
754 void FinalizeDicomScpCallbacks()
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
755 {
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
756 ICallbackRegistration::Unregister(findScpCallback_);
32de70a1e4c7 New functions from the SDK wrapped in Python: CreateDicom, RegisterFindCallback, RegisterMoveCallback
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
757 ICallbackRegistration::Unregister(moveScpCallback_);
64
091fb1903bfc new wrapped function: orthanc.RegisterWorklistCallback() and orthanc.WorklistAnswers.WorklistAddAnswer()
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 63
diff changeset
758 ICallbackRegistration::Unregister(worklistScpCallback_);
151
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
759
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
760 ICallbackRegistration::Unregister(createMoveScpDriverCallback_);
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
761 ICallbackRegistration::Unregister(getMoveSizeCallback_);
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
762 ICallbackRegistration::Unregister(applyMoveCallback_);
566df919b286 new more detailed C-Move SCP callbacks
Alain Mazy <am@osimis.io>
parents: 131
diff changeset
763 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
764 }