annotate Resources/Samples/Lua/AutoroutingConditional.lua @ 1382:1cd2e09cb0e5

case insensitive search by default
author Sebastien Jodogne <s.jodogne@gmail.com>
date Fri, 29 May 2015 14:46:06 +0200
parents 5730f374e4e6
children 904096e7367e
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
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
23590917e83e lua samples
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8 -- Extract the value of the "PatientName" DICOM tag
23590917e83e lua samples
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
9 local patientName = string.lower(tags['PatientName'])
23590917e83e lua samples
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
10
23590917e83e lua samples
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
11 if string.find(patientName, 'david') ~= nil then
23590917e83e lua samples
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
12 -- Only send patients whose name contains "David"
23590917e83e lua samples
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
13 Delete(SendToModality(instanceId, 'sample'))
23590917e83e lua samples
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
14
23590917e83e lua samples
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
15 else
23590917e83e lua samples
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
16 -- Delete the patients that are not called "David"
23590917e83e lua samples
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
17 Delete(instanceId)
23590917e83e lua samples
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
18 end
23590917e83e lua samples
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
19 end