Mercurial > hg > orthanc-python
comparison Sources/Autogenerated/sdk_OrthancPluginDicomInstance.methods.h @ 129:5643e97d9367 fix-leak
reproducible code generation
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Wed, 30 Aug 2023 11:40:22 +0200 |
parents | |
children | e9be3c9294d4 |
comparison
equal
deleted
inserted
replaced
128:5b59ebc267e1 | 129:5643e97d9367 |
---|---|
1 // Actual implementation of the methods | |
2 static PyObject *sdk_OrthancPluginDicomInstance_OrthancPluginGetInstanceRemoteAet( | |
3 sdk_OrthancPluginDicomInstance_Object* self, PyObject *args) | |
4 { | |
5 PythonLock::LogCall("Calling method OrthancPluginGetInstanceRemoteAet() on object of class OrthancPluginDicomInstance"); | |
6 | |
7 if (self->object_ == NULL) | |
8 { | |
9 PyErr_SetString(PyExc_ValueError, "Invalid object"); | |
10 return NULL; | |
11 } | |
12 | |
13 | |
14 const char* s = OrthancPluginGetInstanceRemoteAet(OrthancPlugins::GetGlobalContext(), self->object_); | |
15 | |
16 if (s == NULL) | |
17 { | |
18 Py_INCREF(Py_None); | |
19 return Py_None; | |
20 } | |
21 else | |
22 { | |
23 return PyUnicode_FromString(s); | |
24 } | |
25 } | |
26 | |
27 static PyObject *sdk_OrthancPluginDicomInstance_OrthancPluginGetInstanceSize( | |
28 sdk_OrthancPluginDicomInstance_Object* self, PyObject *args) | |
29 { | |
30 PythonLock::LogCall("Calling method OrthancPluginGetInstanceSize() on object of class OrthancPluginDicomInstance"); | |
31 | |
32 if (self->object_ == NULL) | |
33 { | |
34 PyErr_SetString(PyExc_ValueError, "Invalid object"); | |
35 return NULL; | |
36 } | |
37 | |
38 | |
39 long value = OrthancPluginGetInstanceSize(OrthancPlugins::GetGlobalContext(), self->object_); | |
40 | |
41 return PyLong_FromLong(value); | |
42 } | |
43 | |
44 static PyObject *sdk_OrthancPluginDicomInstance_OrthancPluginGetInstanceJson( | |
45 sdk_OrthancPluginDicomInstance_Object* self, PyObject *args) | |
46 { | |
47 PythonLock::LogCall("Calling method OrthancPluginGetInstanceJson() on object of class OrthancPluginDicomInstance"); | |
48 | |
49 if (self->object_ == NULL) | |
50 { | |
51 PyErr_SetString(PyExc_ValueError, "Invalid object"); | |
52 return NULL; | |
53 } | |
54 | |
55 | |
56 OrthancPlugins::OrthancString s; | |
57 s.Assign(OrthancPluginGetInstanceJson(OrthancPlugins::GetGlobalContext(), self->object_)); | |
58 | |
59 if (s.GetContent() == NULL) | |
60 { | |
61 PythonLock::RaiseException(OrthancPluginErrorCode_InternalError); | |
62 return NULL; | |
63 } | |
64 else | |
65 { | |
66 return PyUnicode_FromString(s.GetContent()); | |
67 } | |
68 } | |
69 | |
70 static PyObject *sdk_OrthancPluginDicomInstance_OrthancPluginGetInstanceSimplifiedJson( | |
71 sdk_OrthancPluginDicomInstance_Object* self, PyObject *args) | |
72 { | |
73 PythonLock::LogCall("Calling method OrthancPluginGetInstanceSimplifiedJson() on object of class OrthancPluginDicomInstance"); | |
74 | |
75 if (self->object_ == NULL) | |
76 { | |
77 PyErr_SetString(PyExc_ValueError, "Invalid object"); | |
78 return NULL; | |
79 } | |
80 | |
81 | |
82 OrthancPlugins::OrthancString s; | |
83 s.Assign(OrthancPluginGetInstanceSimplifiedJson(OrthancPlugins::GetGlobalContext(), self->object_)); | |
84 | |
85 if (s.GetContent() == NULL) | |
86 { | |
87 PythonLock::RaiseException(OrthancPluginErrorCode_InternalError); | |
88 return NULL; | |
89 } | |
90 else | |
91 { | |
92 return PyUnicode_FromString(s.GetContent()); | |
93 } | |
94 } | |
95 | |
96 static PyObject *sdk_OrthancPluginDicomInstance_OrthancPluginHasInstanceMetadata( | |
97 sdk_OrthancPluginDicomInstance_Object* self, PyObject *args) | |
98 { | |
99 PythonLock::LogCall("Calling method OrthancPluginHasInstanceMetadata() on object of class OrthancPluginDicomInstance"); | |
100 | |
101 if (self->object_ == NULL) | |
102 { | |
103 PyErr_SetString(PyExc_ValueError, "Invalid object"); | |
104 return NULL; | |
105 } | |
106 | |
107 const char* arg0 = NULL; | |
108 | |
109 if (!PyArg_ParseTuple(args, "s", &arg0)) | |
110 { | |
111 PyErr_SetString(PyExc_TypeError, "Bad types for the arguments (1 arguments expected)"); | |
112 return NULL; | |
113 } | |
114 long value = OrthancPluginHasInstanceMetadata(OrthancPlugins::GetGlobalContext(), self->object_, arg0); | |
115 | |
116 return PyLong_FromLong(value); | |
117 } | |
118 | |
119 static PyObject *sdk_OrthancPluginDicomInstance_OrthancPluginGetInstanceMetadata( | |
120 sdk_OrthancPluginDicomInstance_Object* self, PyObject *args) | |
121 { | |
122 PythonLock::LogCall("Calling method OrthancPluginGetInstanceMetadata() on object of class OrthancPluginDicomInstance"); | |
123 | |
124 if (self->object_ == NULL) | |
125 { | |
126 PyErr_SetString(PyExc_ValueError, "Invalid object"); | |
127 return NULL; | |
128 } | |
129 | |
130 const char* arg0 = NULL; | |
131 | |
132 if (!PyArg_ParseTuple(args, "s", &arg0)) | |
133 { | |
134 PyErr_SetString(PyExc_TypeError, "Bad types for the arguments (1 arguments expected)"); | |
135 return NULL; | |
136 } | |
137 const char* s = OrthancPluginGetInstanceMetadata(OrthancPlugins::GetGlobalContext(), self->object_, arg0); | |
138 | |
139 if (s == NULL) | |
140 { | |
141 Py_INCREF(Py_None); | |
142 return Py_None; | |
143 } | |
144 else | |
145 { | |
146 return PyUnicode_FromString(s); | |
147 } | |
148 } | |
149 | |
150 static PyObject *sdk_OrthancPluginDicomInstance_OrthancPluginGetInstanceOrigin( | |
151 sdk_OrthancPluginDicomInstance_Object* self, PyObject *args) | |
152 { | |
153 PythonLock::LogCall("Calling method OrthancPluginGetInstanceOrigin() on object of class OrthancPluginDicomInstance"); | |
154 | |
155 if (self->object_ == NULL) | |
156 { | |
157 PyErr_SetString(PyExc_ValueError, "Invalid object"); | |
158 return NULL; | |
159 } | |
160 | |
161 | |
162 OrthancPluginInstanceOrigin value = OrthancPluginGetInstanceOrigin(OrthancPlugins::GetGlobalContext(), self->object_); | |
163 | |
164 return PyLong_FromLong(value); | |
165 } | |
166 | |
167 static PyObject *sdk_OrthancPluginDicomInstance_OrthancPluginGetInstanceTransferSyntaxUid( | |
168 sdk_OrthancPluginDicomInstance_Object* self, PyObject *args) | |
169 { | |
170 PythonLock::LogCall("Calling method OrthancPluginGetInstanceTransferSyntaxUid() on object of class OrthancPluginDicomInstance"); | |
171 | |
172 if (self->object_ == NULL) | |
173 { | |
174 PyErr_SetString(PyExc_ValueError, "Invalid object"); | |
175 return NULL; | |
176 } | |
177 | |
178 | |
179 OrthancPlugins::OrthancString s; | |
180 s.Assign(OrthancPluginGetInstanceTransferSyntaxUid(OrthancPlugins::GetGlobalContext(), self->object_)); | |
181 | |
182 if (s.GetContent() == NULL) | |
183 { | |
184 PythonLock::RaiseException(OrthancPluginErrorCode_InternalError); | |
185 return NULL; | |
186 } | |
187 else | |
188 { | |
189 return PyUnicode_FromString(s.GetContent()); | |
190 } | |
191 } | |
192 | |
193 static PyObject *sdk_OrthancPluginDicomInstance_OrthancPluginHasInstancePixelData( | |
194 sdk_OrthancPluginDicomInstance_Object* self, PyObject *args) | |
195 { | |
196 PythonLock::LogCall("Calling method OrthancPluginHasInstancePixelData() on object of class OrthancPluginDicomInstance"); | |
197 | |
198 if (self->object_ == NULL) | |
199 { | |
200 PyErr_SetString(PyExc_ValueError, "Invalid object"); | |
201 return NULL; | |
202 } | |
203 | |
204 | |
205 long value = OrthancPluginHasInstancePixelData(OrthancPlugins::GetGlobalContext(), self->object_); | |
206 | |
207 return PyLong_FromLong(value); | |
208 } | |
209 | |
210 static PyObject *sdk_OrthancPluginDicomInstance_OrthancPluginGetInstanceFramesCount( | |
211 sdk_OrthancPluginDicomInstance_Object* self, PyObject *args) | |
212 { | |
213 PythonLock::LogCall("Calling method OrthancPluginGetInstanceFramesCount() on object of class OrthancPluginDicomInstance"); | |
214 | |
215 if (self->object_ == NULL) | |
216 { | |
217 PyErr_SetString(PyExc_ValueError, "Invalid object"); | |
218 return NULL; | |
219 } | |
220 | |
221 | |
222 long value = OrthancPluginGetInstanceFramesCount(OrthancPlugins::GetGlobalContext(), self->object_); | |
223 | |
224 return PyLong_FromLong(value); | |
225 } | |
226 | |
227 static PyObject *sdk_OrthancPluginDicomInstance_OrthancPluginGetInstanceRawFrame( | |
228 sdk_OrthancPluginDicomInstance_Object* self, PyObject *args) | |
229 { | |
230 PythonLock::LogCall("Calling method OrthancPluginGetInstanceRawFrame() on object of class OrthancPluginDicomInstance"); | |
231 | |
232 if (self->object_ == NULL) | |
233 { | |
234 PyErr_SetString(PyExc_ValueError, "Invalid object"); | |
235 return NULL; | |
236 } | |
237 | |
238 unsigned long arg0 = 0; | |
239 | |
240 if (!PyArg_ParseTuple(args, "k", &arg0)) | |
241 { | |
242 PyErr_SetString(PyExc_TypeError, "Bad types for the arguments (1 arguments expected)"); | |
243 return NULL; | |
244 } | |
245 OrthancPlugins::MemoryBuffer buffer; | |
246 OrthancPluginErrorCode code = OrthancPluginGetInstanceRawFrame(OrthancPlugins::GetGlobalContext(), *buffer, self->object_, arg0); | |
247 | |
248 if (code == OrthancPluginErrorCode_Success) | |
249 { | |
250 return PyBytes_FromStringAndSize(buffer.GetData(), buffer.GetSize()); | |
251 } | |
252 else | |
253 { | |
254 PythonLock::RaiseException(code); | |
255 return NULL; | |
256 } | |
257 } | |
258 | |
259 static PyObject *sdk_OrthancPluginDicomInstance_OrthancPluginGetInstanceDecodedFrame( | |
260 sdk_OrthancPluginDicomInstance_Object* self, PyObject *args) | |
261 { | |
262 PythonLock::LogCall("Calling method OrthancPluginGetInstanceDecodedFrame() on object of class OrthancPluginDicomInstance"); | |
263 | |
264 if (self->object_ == NULL) | |
265 { | |
266 PyErr_SetString(PyExc_ValueError, "Invalid object"); | |
267 return NULL; | |
268 } | |
269 | |
270 unsigned long arg0 = 0; | |
271 | |
272 if (!PyArg_ParseTuple(args, "k", &arg0)) | |
273 { | |
274 PyErr_SetString(PyExc_TypeError, "Bad types for the arguments (1 arguments expected)"); | |
275 return NULL; | |
276 } | |
277 // This is the case of a constructor | |
278 OrthancPluginImage* obj = OrthancPluginGetInstanceDecodedFrame(OrthancPlugins::GetGlobalContext(), self->object_, arg0); | |
279 | |
280 if (obj == NULL) | |
281 { | |
282 PythonLock::RaiseException(OrthancPluginErrorCode_InternalError); | |
283 return NULL; | |
284 } | |
285 else | |
286 { | |
287 PyObject *argList = Py_BuildValue("Lb", obj, false /* not borrowed */); | |
288 PyObject *python = PyObject_CallObject((PyObject *) &sdk_OrthancPluginImage_Type, argList); | |
289 Py_DECREF(argList); | |
290 return python; | |
291 } | |
292 } | |
293 | |
294 static PyObject *sdk_OrthancPluginDicomInstance_OrthancPluginSerializeDicomInstance( | |
295 sdk_OrthancPluginDicomInstance_Object* self, PyObject *args) | |
296 { | |
297 PythonLock::LogCall("Calling method OrthancPluginSerializeDicomInstance() on object of class OrthancPluginDicomInstance"); | |
298 | |
299 if (self->object_ == NULL) | |
300 { | |
301 PyErr_SetString(PyExc_ValueError, "Invalid object"); | |
302 return NULL; | |
303 } | |
304 | |
305 | |
306 OrthancPlugins::MemoryBuffer buffer; | |
307 OrthancPluginErrorCode code = OrthancPluginSerializeDicomInstance(OrthancPlugins::GetGlobalContext(), *buffer, self->object_); | |
308 | |
309 if (code == OrthancPluginErrorCode_Success) | |
310 { | |
311 return PyBytes_FromStringAndSize(buffer.GetData(), buffer.GetSize()); | |
312 } | |
313 else | |
314 { | |
315 PythonLock::RaiseException(code); | |
316 return NULL; | |
317 } | |
318 } | |
319 | |
320 static PyObject *sdk_OrthancPluginDicomInstance_OrthancPluginGetInstanceAdvancedJson( | |
321 sdk_OrthancPluginDicomInstance_Object* self, PyObject *args) | |
322 { | |
323 PythonLock::LogCall("Calling method OrthancPluginGetInstanceAdvancedJson() on object of class OrthancPluginDicomInstance"); | |
324 | |
325 if (self->object_ == NULL) | |
326 { | |
327 PyErr_SetString(PyExc_ValueError, "Invalid object"); | |
328 return NULL; | |
329 } | |
330 | |
331 long int arg0 = 0; | |
332 long int arg1 = 0; | |
333 unsigned long arg2 = 0; | |
334 | |
335 if (!PyArg_ParseTuple(args, "llk", &arg0, &arg1, &arg2)) | |
336 { | |
337 PyErr_SetString(PyExc_TypeError, "Bad types for the arguments (3 arguments expected)"); | |
338 return NULL; | |
339 } | |
340 OrthancPlugins::OrthancString s; | |
341 s.Assign(OrthancPluginGetInstanceAdvancedJson(OrthancPlugins::GetGlobalContext(), self->object_, static_cast<OrthancPluginDicomToJsonFormat>(arg0), static_cast<OrthancPluginDicomToJsonFlags>(arg1), arg2)); | |
342 | |
343 if (s.GetContent() == NULL) | |
344 { | |
345 PythonLock::RaiseException(OrthancPluginErrorCode_InternalError); | |
346 return NULL; | |
347 } | |
348 else | |
349 { | |
350 return PyUnicode_FromString(s.GetContent()); | |
351 } | |
352 } | |
353 |