Mercurial > hg > orthanc
comparison Resources/Toolbox.lua @ 1010:160dfe770618 lua-scripting
refactoring
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Wed, 09 Jul 2014 17:05:00 +0200 |
parents | 649d47854314 |
children | 921532f67770 |
comparison
equal
deleted
inserted
replaced
1009:26642cecd36d | 1010:160dfe770618 |
---|---|
17 if (l < 0) then break end | 17 if (l < 0) then break end |
18 end | 18 end |
19 return l | 19 return l |
20 end | 20 end |
21 | 21 |
22 | |
23 | |
24 | |
25 function _InitializeJob() | |
26 _job = {} | |
27 end | |
28 | |
29 | |
30 function _AccessJob() | |
31 return _job | |
32 end | |
33 | |
34 | |
35 function SendToModality(instanceId, modality) | |
36 if instanceId == nil then | |
37 error('Cannot send a nonexistent instance') | |
38 end | |
39 | |
40 table.insert(_job, { | |
41 Operation = 'store-scu', | |
42 Instance = instanceId, | |
43 Modality = modality | |
44 }) | |
45 return instanceId | |
46 end | |
47 | |
48 | |
49 function SendToPeer(instanceId, peer) | |
50 if instanceId == nil then | |
51 error('Cannot send a nonexistent instance') | |
52 end | |
53 | |
54 table.insert(_job, { | |
55 Operation = 'store-peer', | |
56 Instance = instanceId, | |
57 Peer = peer | |
58 }) | |
59 return instanceId | |
60 end | |
61 | |
62 | |
63 function Delete(instanceId) | |
64 if instanceId == nil then | |
65 error('Cannot delete a nonexistent instance') | |
66 end | |
67 | |
68 table.insert(_job, { | |
69 Operation = 'delete', | |
70 Instance = instanceId | |
71 }) | |
72 return nil -- Forbid chaining | |
73 end | |
74 | |
75 | |
76 function ModifyInstance(instanceId, replacements, removals, removePrivateTags) | |
77 if instanceId == nil then | |
78 error('Cannot modify a nonexistent instance') | |
79 end | |
80 | |
81 if instanceId == '' then | |
82 error('Cannot modify twice an instance'); | |
83 end | |
84 | |
85 table.insert(_job, { | |
86 Operation = 'modify', | |
87 Instance = instanceId, | |
88 Replace = replacements, | |
89 Remove = removals, | |
90 RemovePrivateTags = removePrivateTags | |
91 }) | |
92 return '' -- Chain with another operation | |
93 end | |
94 | |
95 | |
96 | |
22 print('Lua toolbox installed') | 97 print('Lua toolbox installed') |