comparison Sphinx/source/plugins/python.rst @ 708:cd70d23f34bc

Lookup DICOM dictionary in Python scripts
author Sebastien Jodogne <s.jodogne@gmail.com>
date Fri, 11 Jun 2021 14:09:21 +0200
parents daf07750e901
children 9d5e17100a8d
comparison
equal deleted inserted replaced
707:daf07750e901 708:cd70d23f34bc
477 authorization. Here is an example using the ``requests`` library: 477 authorization. Here is an example using the ``requests`` library:
478 478
479 .. literalinclude:: python/authorization-2.py 479 .. literalinclude:: python/authorization-2.py
480 :language: python 480 :language: python
481 481
482 .. highlight:: javascript
483
484 This filter could be used together with the following Web service 482 This filter could be used together with the following Web service
485 implemented using `Node.js 483 implemented using `Node.js
486 <https://en.wikipedia.org/wiki/Node.js>`__: 484 <https://en.wikipedia.org/wiki/Node.js>`__:
487 485
488 .. literalinclude:: python/authorization-node-service.js 486 .. literalinclude:: python/authorization-node-service.js
489 :language: javascript 487 :language: javascript
490 488
491 489
490 .. _python_lookup_dictionary:
491
492 Lookup DICOM dictionary (new in 3.2)
493 ....................................
494
495 Python plugins can access the dictionary of the DICOM tags that are
496 handled by Orthanc:
497
498 .. literalinclude:: python/lookup-dictionary.py
499 :language: python
500
501 .. highlight:: text
502
503 Note how Python introspection is used in order to map the values in
504 enumeration ``orthanc.ValueRepresentation`` to a string description of
505 the value representation. If started, the plugin above would output
506 the following information in the Orthanc logs::
507
508 W0611 14:04:08.563957 PluginsManager.cpp:168] Entry in the dictionary: {
509 "Element": 32,
510 "Group": 16,
511 "MaxMultiplicity": 1,
512 "MinMultiplicity": 1,
513 "ValueRepresentation": 11
514 }
515 W0611 14:04:08.563975 PluginsManager.cpp:168] Name of the value representation: LO
516
517
492 .. _python_create_dicom: 518 .. _python_create_dicom:
493 519
494 Creating DICOM instances (new in 3.2) 520 Creating DICOM instances (new in 3.2)
495 ..................................... 521 .....................................
496 522