Mercurial > hg > orthanc-python
comparison Sources/Autogenerated/sdk_OrthancPluginDicomInstance.impl.h @ 131:c55b0583084b
integration fix-leak->mainline
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Wed, 30 Aug 2023 11:52:45 +0200 |
parents | 65ec5597ec70 5643e97d9367 |
children | 71d305c29cfa |
comparison
equal
deleted
inserted
replaced
130:a3f77cf16396 | 131:c55b0583084b |
---|---|
158 | 158 |
159 Py_TYPE(self)->tp_free((PyObject *)self); | 159 Py_TYPE(self)->tp_free((PyObject *)self); |
160 } | 160 } |
161 | 161 |
162 | 162 |
163 // Actual implementation of the methods | |
164 static PyObject *sdk_OrthancPluginDicomInstance_OrthancPluginGetInstanceRemoteAet( | |
165 sdk_OrthancPluginDicomInstance_Object* self, PyObject *args) | |
166 { | |
167 PythonLock::LogCall("Calling method OrthancPluginGetInstanceRemoteAet() on object of class OrthancPluginDicomInstance"); | |
168 | |
169 if (self->object_ == NULL) | |
170 { | |
171 PyErr_SetString(PyExc_ValueError, "Invalid object"); | |
172 return NULL; | |
173 } | |
174 | |
175 | |
176 const char* s = OrthancPluginGetInstanceRemoteAet(OrthancPlugins::GetGlobalContext(), self->object_); | |
177 | |
178 if (s == NULL) | |
179 { | |
180 Py_INCREF(Py_None); | |
181 return Py_None; | |
182 } | |
183 else | |
184 { | |
185 return PyUnicode_FromString(s); | |
186 } | |
187 } | |
188 | |
189 static PyObject *sdk_OrthancPluginDicomInstance_OrthancPluginGetInstanceSize( | |
190 sdk_OrthancPluginDicomInstance_Object* self, PyObject *args) | |
191 { | |
192 PythonLock::LogCall("Calling method OrthancPluginGetInstanceSize() on object of class OrthancPluginDicomInstance"); | |
193 | |
194 if (self->object_ == NULL) | |
195 { | |
196 PyErr_SetString(PyExc_ValueError, "Invalid object"); | |
197 return NULL; | |
198 } | |
199 | |
200 | |
201 long value = OrthancPluginGetInstanceSize(OrthancPlugins::GetGlobalContext(), self->object_); | |
202 | |
203 return PyLong_FromLong(value); | |
204 } | |
205 | |
206 static PyObject *sdk_OrthancPluginDicomInstance_OrthancPluginGetInstanceJson( | |
207 sdk_OrthancPluginDicomInstance_Object* self, PyObject *args) | |
208 { | |
209 PythonLock::LogCall("Calling method OrthancPluginGetInstanceJson() on object of class OrthancPluginDicomInstance"); | |
210 | |
211 if (self->object_ == NULL) | |
212 { | |
213 PyErr_SetString(PyExc_ValueError, "Invalid object"); | |
214 return NULL; | |
215 } | |
216 | |
217 | |
218 OrthancPlugins::OrthancString s; | |
219 s.Assign(OrthancPluginGetInstanceJson(OrthancPlugins::GetGlobalContext(), self->object_)); | |
220 | |
221 if (s.GetContent() == NULL) | |
222 { | |
223 PythonLock::RaiseException(OrthancPluginErrorCode_InternalError); | |
224 return NULL; | |
225 } | |
226 else | |
227 { | |
228 return PyUnicode_FromString(s.GetContent()); | |
229 } | |
230 } | |
231 | |
232 static PyObject *sdk_OrthancPluginDicomInstance_OrthancPluginGetInstanceSimplifiedJson( | |
233 sdk_OrthancPluginDicomInstance_Object* self, PyObject *args) | |
234 { | |
235 PythonLock::LogCall("Calling method OrthancPluginGetInstanceSimplifiedJson() on object of class OrthancPluginDicomInstance"); | |
236 | |
237 if (self->object_ == NULL) | |
238 { | |
239 PyErr_SetString(PyExc_ValueError, "Invalid object"); | |
240 return NULL; | |
241 } | |
242 | |
243 | |
244 OrthancPlugins::OrthancString s; | |
245 s.Assign(OrthancPluginGetInstanceSimplifiedJson(OrthancPlugins::GetGlobalContext(), self->object_)); | |
246 | |
247 if (s.GetContent() == NULL) | |
248 { | |
249 PythonLock::RaiseException(OrthancPluginErrorCode_InternalError); | |
250 return NULL; | |
251 } | |
252 else | |
253 { | |
254 return PyUnicode_FromString(s.GetContent()); | |
255 } | |
256 } | |
257 | |
258 static PyObject *sdk_OrthancPluginDicomInstance_OrthancPluginHasInstanceMetadata( | |
259 sdk_OrthancPluginDicomInstance_Object* self, PyObject *args) | |
260 { | |
261 PythonLock::LogCall("Calling method OrthancPluginHasInstanceMetadata() on object of class OrthancPluginDicomInstance"); | |
262 | |
263 if (self->object_ == NULL) | |
264 { | |
265 PyErr_SetString(PyExc_ValueError, "Invalid object"); | |
266 return NULL; | |
267 } | |
268 | |
269 const char* arg0 = NULL; | |
270 | |
271 if (!PyArg_ParseTuple(args, "s", &arg0)) | |
272 { | |
273 PyErr_SetString(PyExc_TypeError, "Bad types for the arguments (1 arguments expected)"); | |
274 return NULL; | |
275 } | |
276 long value = OrthancPluginHasInstanceMetadata(OrthancPlugins::GetGlobalContext(), self->object_, arg0); | |
277 | |
278 return PyLong_FromLong(value); | |
279 } | |
280 | |
281 static PyObject *sdk_OrthancPluginDicomInstance_OrthancPluginGetInstanceMetadata( | |
282 sdk_OrthancPluginDicomInstance_Object* self, PyObject *args) | |
283 { | |
284 PythonLock::LogCall("Calling method OrthancPluginGetInstanceMetadata() on object of class OrthancPluginDicomInstance"); | |
285 | |
286 if (self->object_ == NULL) | |
287 { | |
288 PyErr_SetString(PyExc_ValueError, "Invalid object"); | |
289 return NULL; | |
290 } | |
291 | |
292 const char* arg0 = NULL; | |
293 | |
294 if (!PyArg_ParseTuple(args, "s", &arg0)) | |
295 { | |
296 PyErr_SetString(PyExc_TypeError, "Bad types for the arguments (1 arguments expected)"); | |
297 return NULL; | |
298 } | |
299 const char* s = OrthancPluginGetInstanceMetadata(OrthancPlugins::GetGlobalContext(), self->object_, arg0); | |
300 | |
301 if (s == NULL) | |
302 { | |
303 Py_INCREF(Py_None); | |
304 return Py_None; | |
305 } | |
306 else | |
307 { | |
308 return PyUnicode_FromString(s); | |
309 } | |
310 } | |
311 | |
312 static PyObject *sdk_OrthancPluginDicomInstance_OrthancPluginGetInstanceOrigin( | |
313 sdk_OrthancPluginDicomInstance_Object* self, PyObject *args) | |
314 { | |
315 PythonLock::LogCall("Calling method OrthancPluginGetInstanceOrigin() on object of class OrthancPluginDicomInstance"); | |
316 | |
317 if (self->object_ == NULL) | |
318 { | |
319 PyErr_SetString(PyExc_ValueError, "Invalid object"); | |
320 return NULL; | |
321 } | |
322 | |
323 | |
324 OrthancPluginInstanceOrigin value = OrthancPluginGetInstanceOrigin(OrthancPlugins::GetGlobalContext(), self->object_); | |
325 | |
326 return PyLong_FromLong(value); | |
327 } | |
328 | |
329 static PyObject *sdk_OrthancPluginDicomInstance_OrthancPluginGetInstanceTransferSyntaxUid( | |
330 sdk_OrthancPluginDicomInstance_Object* self, PyObject *args) | |
331 { | |
332 PythonLock::LogCall("Calling method OrthancPluginGetInstanceTransferSyntaxUid() on object of class OrthancPluginDicomInstance"); | |
333 | |
334 if (self->object_ == NULL) | |
335 { | |
336 PyErr_SetString(PyExc_ValueError, "Invalid object"); | |
337 return NULL; | |
338 } | |
339 | |
340 | |
341 OrthancPlugins::OrthancString s; | |
342 s.Assign(OrthancPluginGetInstanceTransferSyntaxUid(OrthancPlugins::GetGlobalContext(), self->object_)); | |
343 | |
344 if (s.GetContent() == NULL) | |
345 { | |
346 PythonLock::RaiseException(OrthancPluginErrorCode_InternalError); | |
347 return NULL; | |
348 } | |
349 else | |
350 { | |
351 return PyUnicode_FromString(s.GetContent()); | |
352 } | |
353 } | |
354 | |
355 static PyObject *sdk_OrthancPluginDicomInstance_OrthancPluginHasInstancePixelData( | |
356 sdk_OrthancPluginDicomInstance_Object* self, PyObject *args) | |
357 { | |
358 PythonLock::LogCall("Calling method OrthancPluginHasInstancePixelData() on object of class OrthancPluginDicomInstance"); | |
359 | |
360 if (self->object_ == NULL) | |
361 { | |
362 PyErr_SetString(PyExc_ValueError, "Invalid object"); | |
363 return NULL; | |
364 } | |
365 | |
366 | |
367 long value = OrthancPluginHasInstancePixelData(OrthancPlugins::GetGlobalContext(), self->object_); | |
368 | |
369 return PyLong_FromLong(value); | |
370 } | |
371 | |
372 static PyObject *sdk_OrthancPluginDicomInstance_OrthancPluginGetInstanceFramesCount( | |
373 sdk_OrthancPluginDicomInstance_Object* self, PyObject *args) | |
374 { | |
375 PythonLock::LogCall("Calling method OrthancPluginGetInstanceFramesCount() on object of class OrthancPluginDicomInstance"); | |
376 | |
377 if (self->object_ == NULL) | |
378 { | |
379 PyErr_SetString(PyExc_ValueError, "Invalid object"); | |
380 return NULL; | |
381 } | |
382 | |
383 | |
384 long value = OrthancPluginGetInstanceFramesCount(OrthancPlugins::GetGlobalContext(), self->object_); | |
385 | |
386 return PyLong_FromLong(value); | |
387 } | |
388 | |
389 static PyObject *sdk_OrthancPluginDicomInstance_OrthancPluginGetInstanceRawFrame( | |
390 sdk_OrthancPluginDicomInstance_Object* self, PyObject *args) | |
391 { | |
392 PythonLock::LogCall("Calling method OrthancPluginGetInstanceRawFrame() on object of class OrthancPluginDicomInstance"); | |
393 | |
394 if (self->object_ == NULL) | |
395 { | |
396 PyErr_SetString(PyExc_ValueError, "Invalid object"); | |
397 return NULL; | |
398 } | |
399 | |
400 unsigned long arg0 = 0; | |
401 | |
402 if (!PyArg_ParseTuple(args, "k", &arg0)) | |
403 { | |
404 PyErr_SetString(PyExc_TypeError, "Bad types for the arguments (1 arguments expected)"); | |
405 return NULL; | |
406 } | |
407 OrthancPlugins::MemoryBuffer buffer; | |
408 OrthancPluginErrorCode code = OrthancPluginGetInstanceRawFrame(OrthancPlugins::GetGlobalContext(), *buffer, self->object_, arg0); | |
409 | |
410 if (code == OrthancPluginErrorCode_Success) | |
411 { | |
412 return PyBytes_FromStringAndSize(buffer.GetData(), buffer.GetSize()); | |
413 } | |
414 else | |
415 { | |
416 PythonLock::RaiseException(code); | |
417 return NULL; | |
418 } | |
419 } | |
420 | |
421 static PyObject *sdk_OrthancPluginDicomInstance_OrthancPluginGetInstanceDecodedFrame( | |
422 sdk_OrthancPluginDicomInstance_Object* self, PyObject *args) | |
423 { | |
424 PythonLock::LogCall("Calling method OrthancPluginGetInstanceDecodedFrame() on object of class OrthancPluginDicomInstance"); | |
425 | |
426 if (self->object_ == NULL) | |
427 { | |
428 PyErr_SetString(PyExc_ValueError, "Invalid object"); | |
429 return NULL; | |
430 } | |
431 | |
432 unsigned long arg0 = 0; | |
433 | |
434 if (!PyArg_ParseTuple(args, "k", &arg0)) | |
435 { | |
436 PyErr_SetString(PyExc_TypeError, "Bad types for the arguments (1 arguments expected)"); | |
437 return NULL; | |
438 } | |
439 // This is the case of a constructor | |
440 OrthancPluginImage* obj = OrthancPluginGetInstanceDecodedFrame(OrthancPlugins::GetGlobalContext(), self->object_, arg0); | |
441 | |
442 if (obj == NULL) | |
443 { | |
444 PythonLock::RaiseException(OrthancPluginErrorCode_InternalError); | |
445 return NULL; | |
446 } | |
447 else | |
448 { | |
449 PyObject *argList = Py_BuildValue("Lb", obj, false /* not borrowed */); | |
450 PyObject *python = PyObject_CallObject((PyObject *) &sdk_OrthancPluginImage_Type, argList); | |
451 Py_DECREF(argList); | |
452 return python; | |
453 } | |
454 } | |
455 | |
456 static PyObject *sdk_OrthancPluginDicomInstance_OrthancPluginSerializeDicomInstance( | |
457 sdk_OrthancPluginDicomInstance_Object* self, PyObject *args) | |
458 { | |
459 PythonLock::LogCall("Calling method OrthancPluginSerializeDicomInstance() on object of class OrthancPluginDicomInstance"); | |
460 | |
461 if (self->object_ == NULL) | |
462 { | |
463 PyErr_SetString(PyExc_ValueError, "Invalid object"); | |
464 return NULL; | |
465 } | |
466 | |
467 | |
468 OrthancPlugins::MemoryBuffer buffer; | |
469 OrthancPluginErrorCode code = OrthancPluginSerializeDicomInstance(OrthancPlugins::GetGlobalContext(), *buffer, self->object_); | |
470 | |
471 if (code == OrthancPluginErrorCode_Success) | |
472 { | |
473 return PyBytes_FromStringAndSize(buffer.GetData(), buffer.GetSize()); | |
474 } | |
475 else | |
476 { | |
477 PythonLock::RaiseException(code); | |
478 return NULL; | |
479 } | |
480 } | |
481 | |
482 static PyObject *sdk_OrthancPluginDicomInstance_OrthancPluginGetInstanceAdvancedJson( | |
483 sdk_OrthancPluginDicomInstance_Object* self, PyObject *args) | |
484 { | |
485 PythonLock::LogCall("Calling method OrthancPluginGetInstanceAdvancedJson() on object of class OrthancPluginDicomInstance"); | |
486 | |
487 if (self->object_ == NULL) | |
488 { | |
489 PyErr_SetString(PyExc_ValueError, "Invalid object"); | |
490 return NULL; | |
491 } | |
492 | |
493 long int arg0 = 0; | |
494 long int arg1 = 0; | |
495 unsigned long arg2 = 0; | |
496 | |
497 if (!PyArg_ParseTuple(args, "llk", &arg0, &arg1, &arg2)) | |
498 { | |
499 PyErr_SetString(PyExc_TypeError, "Bad types for the arguments (3 arguments expected)"); | |
500 return NULL; | |
501 } | |
502 OrthancPlugins::OrthancString s; | |
503 s.Assign(OrthancPluginGetInstanceAdvancedJson(OrthancPlugins::GetGlobalContext(), self->object_, static_cast<OrthancPluginDicomToJsonFormat>(arg0), static_cast<OrthancPluginDicomToJsonFlags>(arg1), arg2)); | |
504 | |
505 if (s.GetContent() == NULL) | |
506 { | |
507 PythonLock::RaiseException(OrthancPluginErrorCode_InternalError); | |
508 return NULL; | |
509 } | |
510 else | |
511 { | |
512 return PyUnicode_FromString(s.GetContent()); | |
513 } | |
514 } | |
515 | |
516 | |
517 | |
518 static void RegisterOrthancPluginDicomInstanceClass(PyObject* module) | 163 static void RegisterOrthancPluginDicomInstanceClass(PyObject* module) |
519 { | 164 { |
520 sdk_OrthancPluginDicomInstance_Type.tp_new = PyType_GenericNew; | 165 sdk_OrthancPluginDicomInstance_Type.tp_new = PyType_GenericNew; |
521 sdk_OrthancPluginDicomInstance_Type.tp_flags = Py_TPFLAGS_DEFAULT; | 166 sdk_OrthancPluginDicomInstance_Type.tp_flags = Py_TPFLAGS_DEFAULT; |
522 sdk_OrthancPluginDicomInstance_Type.tp_doc = "Generated from Orthanc C class: OrthancPluginDicomInstance"; | 167 sdk_OrthancPluginDicomInstance_Type.tp_doc = "Generated from Orthanc C class: OrthancPluginDicomInstance"; |