comparison Sphinx/source/users/lua.rst @ 165:b879a6274065

IncomingWorklistRequestFilter
author Sebastien Jodogne <s.jodogne@gmail.com>
date Wed, 19 Sep 2018 21:29:17 +0200
parents 268ec482f051
children 6e0a0b57697b
comparison
equal deleted inserted replaced
164:05aa4f426621 165:b879a6274065
424 (cf. `this real-world example 424 (cf. `this real-world example
425 <https://groups.google.com/d/msg/orthanc-users/PLWKqVVaXLs/n_0x4vKhAgAJ>`__). In 425 <https://groups.google.com/d/msg/orthanc-users/PLWKqVVaXLs/n_0x4vKhAgAJ>`__). In
426 such situations, it is possible to dynamically fix incoming or 426 such situations, it is possible to dynamically fix incoming or
427 outgoing C-Find queries using a Lua script. 427 outgoing C-Find queries using a Lua script.
428 428
429 Fixing incoming C-Find requests can be done by implementing the 429 Sanitizing incoming C-Find requests can be done by implementing the
430 ``IncomingFindRequestFilter(query, origin)`` callback that is called 430 ``IncomingFindRequestFilter(query, origin)`` callback that is called
431 whenever the Orthanc C-Find SCP is queried by a remote modality. For 431 whenever the Orthanc C-Find SCP is queried by a remote modality. For
432 instance, here is Lua script to remove a private tag that is specified 432 instance, here is Lua script to remove a private tag that is specified
433 by some manufacturer:: 433 by some manufacturer::
434 434
445 end 445 end
446 446
447 The ``origin`` argument contains information about which modality has 447 The ``origin`` argument contains information about which modality has
448 issued the request. 448 issued the request.
449 449
450 Note that, as of Orthanc 1.2.1, the ``IncomingFindRequestFilter`` is 450 Note that the ``IncomingFindRequestFilter`` callback is not applied to
451 not applied to C-Find requests targeting the Modality Worklists plugin. 451 C-Find requests targeting :ref:`modality worklists
452 This might be fixed in a `future release <https://bitbucket.org/sjodogne/orthanc/issues/57/c-find-matching-refactoring-required>`__. 452 <worklists-plugin>`. Since Orthanc 1.4.2, the corresponding
453 ``IncomingWorklistRequestFilter`` callback can be used to sanitize
454 C-FIND requests against worklists::
455
456 function IncomingWorklistRequestFilter(query, origin)
457 PrintRecursive(query)
458 PrintRecursive(origin)
459
460 -- Implements the same behavior as the "FilterIssuerAet"
461 -- option of the sample worklist plugin
462 query['0040,0100'][1]['0040,0001'] = origin['RemoteAet']
463
464 return query
465 end
453 466
454 Similarly, the callback ``OutgoingFindRequestFilter(query, modality)`` 467 Similarly, the callback ``OutgoingFindRequestFilter(query, modality)``
455 is invoked whenever Orthanc acts as a C-Find SCU, which gives the 468 is invoked whenever Orthanc acts as a C-Find SCU, which gives the
456 opportunity to dynamically fix outgoing C-Find requests before they 469 opportunity to dynamically fix outgoing C-Find requests before they
457 are actually sent to the queried modality. For instance, here is a 470 are actually sent to the queried modality. For instance, here is a