annotate Resources/Samples/Lua/AutoroutingModification.lua @ 1400:1c8df4424437

install plugin SDK
author Sebastien Jodogne <s.jodogne@gmail.com>
date Mon, 01 Jun 2015 14:05:35 +0200
parents f796207e3df1
children bfdf24883ff3
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
1011
23590917e83e lua samples
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1 function OnStoredInstance(instanceId, tags, metadata)
23590917e83e lua samples
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2 -- Ignore the instances that result from a modification to avoid
23590917e83e lua samples
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3 -- infinite loops
23590917e83e lua samples
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4 if (metadata['ModifiedFrom'] == nil and
23590917e83e lua samples
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5 metadata['AnonymizedFrom'] == nil) then
23590917e83e lua samples
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6
23590917e83e lua samples
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7 -- The tags to be replaced
23590917e83e lua samples
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8 local replace = {}
23590917e83e lua samples
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
9 replace['StationName'] = 'My Medical Device'
1307
f796207e3df1 Fix replacement and insertion of private DICOM tags
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 1011
diff changeset
10 replace['0031-1020'] = 'Some private tag'
1011
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 -- The tags to be removed
23590917e83e lua samples
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
13 local remove = { 'MilitaryRank' }
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 -- Modify the instance, send it, then delete the modified instance
23590917e83e lua samples
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
16 Delete(SendToModality(ModifyInstance(instanceId, replace, remove, true), 'sample'))
23590917e83e lua samples
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
17
23590917e83e lua samples
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
18 -- Delete the original instance
23590917e83e lua samples
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
19 Delete(instanceId)
23590917e83e lua samples
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
20 end
23590917e83e lua samples
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
21 end