Mercurial > hg > orthanc
annotate Resources/Samples/Lua/AutoroutingConditional.lua @ 1452:b737acb13da5
refactoring of the main function
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Thu, 02 Jul 2015 11:35:41 +0200 |
parents | 5730f374e4e6 |
children | 904096e7367e |
rev | line source |
---|---|
1285
5730f374e4e6
Access to called AET and remote AET from Lua scripts
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1011
diff
changeset
|
1 function OnStoredInstance(instanceId, tags, metadata, remoteAet, calledAet) |
5730f374e4e6
Access to called AET and remote AET from Lua scripts
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1011
diff
changeset
|
2 -- The "remoteAet" and "calledAet" arguments are only available |
5730f374e4e6
Access to called AET and remote AET from Lua scripts
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1011
diff
changeset
|
3 -- since Orthanc 0.8.6 |
5730f374e4e6
Access to called AET and remote AET from Lua scripts
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1011
diff
changeset
|
4 if remoteAet ~=nil and calledAet ~= nil then |
5730f374e4e6
Access to called AET and remote AET from Lua scripts
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1011
diff
changeset
|
5 print ("Source AET: " .. remoteAet .. " => Called AET: " .. calledAet) |
5730f374e4e6
Access to called AET and remote AET from Lua scripts
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1011
diff
changeset
|
6 end |
5730f374e4e6
Access to called AET and remote AET from Lua scripts
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1011
diff
changeset
|
7 |
1011 | 8 -- Extract the value of the "PatientName" DICOM tag |
9 local patientName = string.lower(tags['PatientName']) | |
10 | |
11 if string.find(patientName, 'david') ~= nil then | |
12 -- Only send patients whose name contains "David" | |
13 Delete(SendToModality(instanceId, 'sample')) | |
14 | |
15 else | |
16 -- Delete the patients that are not called "David" | |
17 Delete(instanceId) | |
18 end | |
19 end |