annotate Resources/Samples/Lua/AutoroutingConditional.lua @ 3841:be7df7fe3d80

avoid one memcpy of the DICOM buffer on "POST /instances"
author Sebastien Jodogne <s.jodogne@gmail.com>
date Thu, 16 Apr 2020 16:58:37 +0200
parents 904096e7367e
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
1572
904096e7367e More information about the origin request in OnStoredInstance() callbacks
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1285
diff changeset
1 function OnStoredInstance(instanceId, tags, metadata, origin)
904096e7367e More information about the origin request in OnStoredInstance() callbacks
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1285
diff changeset
2 -- The "origin" is only available since Orthanc 0.9.4
904096e7367e More information about the origin request in OnStoredInstance() callbacks
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1285
diff changeset
3 PrintRecursive(origin)
1285
5730f374e4e6 Access to called AET and remote AET from Lua scripts
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1011
diff changeset
4
1011
23590917e83e lua samples
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5 -- Extract the value of the "PatientName" DICOM tag
23590917e83e lua samples
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6 local patientName = string.lower(tags['PatientName'])
23590917e83e lua samples
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7
23590917e83e lua samples
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8 if string.find(patientName, 'david') ~= nil then
23590917e83e lua samples
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
9 -- Only send patients whose name contains "David"
23590917e83e lua samples
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
10 Delete(SendToModality(instanceId, 'sample'))
23590917e83e lua samples
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
11
23590917e83e lua samples
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
12 else
23590917e83e lua samples
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
13 -- Delete the patients that are not called "David"
23590917e83e lua samples
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
14 Delete(instanceId)
23590917e83e lua samples
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
15 end
23590917e83e lua samples
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
16 end