comparison Sources/Plugin.cpp @ 205:234681297600

documented orthanc.LookupDictionary()
author Sebastien Jodogne <s.jodogne@gmail.com>
date Wed, 03 Jul 2024 12:35:13 +0200
parents 28531e615104
children 315e1720a35f
comparison
equal deleted inserted replaced
204:65ad095c25d8 205:234681297600
80 * same thread, so no problem in creating a PythonLock even if 80 * same thread, so no problem in creating a PythonLock even if
81 * the GIL is already locked. 81 * the GIL is already locked.
82 **/ 82 **/
83 PythonLock lock; 83 PythonLock lock;
84 84
85 PythonObject kw(lock, PyDict_New()); 85 PythonObject dict(lock, PyDict_New());
86 86
87 { 87 {
88 PythonObject tmp(lock, PyLong_FromUnsignedLong(entry.group)); 88 PythonObject tmp(lock, PyLong_FromUnsignedLong(entry.group));
89 PyDict_SetItemString(kw.GetPyObject(), "Group", tmp.GetPyObject()); 89 PyDict_SetItemString(dict.GetPyObject(), "Group", tmp.GetPyObject());
90 } 90 }
91 91
92 { 92 {
93 PythonObject tmp(lock, PyLong_FromUnsignedLong(entry.element)); 93 PythonObject tmp(lock, PyLong_FromUnsignedLong(entry.element));
94 PyDict_SetItemString(kw.GetPyObject(), "Element", tmp.GetPyObject()); 94 PyDict_SetItemString(dict.GetPyObject(), "Element", tmp.GetPyObject());
95 } 95 }
96 96
97 { 97 {
98 PythonObject tmp(lock, PyLong_FromUnsignedLong(entry.vr)); 98 PythonObject tmp(lock, PyLong_FromUnsignedLong(entry.vr));
99 PyDict_SetItemString(kw.GetPyObject(), "ValueRepresentation", tmp.GetPyObject()); 99 PyDict_SetItemString(dict.GetPyObject(), "ValueRepresentation", tmp.GetPyObject());
100 } 100 }
101 101
102 { 102 {
103 PythonObject tmp(lock, PyLong_FromUnsignedLong(entry.minMultiplicity)); 103 PythonObject tmp(lock, PyLong_FromUnsignedLong(entry.minMultiplicity));
104 PyDict_SetItemString(kw.GetPyObject(), "MinMultiplicity", tmp.GetPyObject()); 104 PyDict_SetItemString(dict.GetPyObject(), "MinMultiplicity", tmp.GetPyObject());
105 } 105 }
106 106
107 { 107 {
108 PythonObject tmp(lock, PyLong_FromUnsignedLong(entry.maxMultiplicity)); 108 PythonObject tmp(lock, PyLong_FromUnsignedLong(entry.maxMultiplicity));
109 PyDict_SetItemString(kw.GetPyObject(), "MaxMultiplicity", tmp.GetPyObject()); 109 PyDict_SetItemString(dict.GetPyObject(), "MaxMultiplicity", tmp.GetPyObject());
110 } 110 }
111 111
112 return kw.Release(); 112 return dict.Release();
113 } 113 }
114 else 114 else
115 { 115 {
116 std::string message = "Unknown DICOM tag: " + std::string(name); 116 std::string message = "Unknown DICOM tag: " + std::string(name);
117 PyErr_SetString(PyExc_TypeError, message.c_str()); 117 PyErr_SetString(PyExc_TypeError, message.c_str());
285 285
286 286
287 /** 287 /**
288 * New in release 3.2 288 * New in release 3.2
289 **/ 289 **/
290
291 {
292 PyMethodDef f = { "LookupDictionary", LookupDictionary, METH_VARARGS, "" };
293 functions.push_back(f);
294 }
295 290
296 { 291 {
297 PyMethodDef f = { "CreateImageFromBuffer", CreateImageFromBuffer, METH_VARARGS, "" }; 292 PyMethodDef f = { "CreateImageFromBuffer", CreateImageFromBuffer, METH_VARARGS, "" };
298 functions.push_back(f); 293 functions.push_back(f);
299 } 294 }