annotate Database/Lua/AutoroutingModification.lua @ 735:be8f174d3c9d find-refactoring tip

tools/find: Limit and Since are now forbidden when filtering on DICOM tags that are not stored in DB
author Alain Mazy <am@orthanc.team>
date Thu, 24 Oct 2024 15:08:59 +0200
parents 04fa104ab63b
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
16
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
1 function OnStoredInstance(instanceId, tags, metadata)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
2 -- Ignore the instances that result from a modification to avoid
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
3 -- infinite loops
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
4 if (metadata['ModifiedFrom'] == nil and
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
5 metadata['AnonymizedFrom'] == nil) then
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
6
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
7 -- The tags to be replaced
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
8 local replace = {}
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
9 replace['StationName'] = 'My Medical Device'
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
10 replace['0031-1020'] = 'Some private tag'
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
11
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
12 -- The tags to be removed
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
13 local remove = { 'MilitaryRank' }
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
14
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
15 -- Modify the instance, send it, then delete the modified instance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
16 Delete(SendToModality(ModifyInstance(instanceId, replace, remove, true), 'orthanctest'))
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
17
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
18 -- Delete the original instance
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
19 Delete(instanceId)
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
20 end
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff changeset
21 end