orthanc 0.1.0 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: fdfad2aeeae25d4ff088160e28a91ea86b64fa01
4
- data.tar.gz: d87077c820484914845e550b003562b5cb19b6b7
3
+ metadata.gz: cd7892469761f2610ebec1e93d457212a0231f4a
4
+ data.tar.gz: 6b5a8cbd7aac358337ca577e914997479473d97a
5
5
  SHA512:
6
- metadata.gz: dbe6ececc0c65bc59f7da9f6dc76ebc06227dab0cad6b2af44cb7f259a742f225d9e6d91dc1daee4d45cc3bbaa76c10de30186e093976d0bb69cb4bf8133eeb3
7
- data.tar.gz: 7f5ac39bbe99b695cce5c3099c954144bbaf12914fd46f9463bc337881d072bf8a34f8d040739903c48c91395975fe8ac2faf1ae1fc1b4578202862ecc50627a
6
+ metadata.gz: 1c6b7a5e8a156cf63bc64e80847d5f319dd3c9a197aec2622d49223feb451d2765d12d2a6e4410959c8815387bcaba61004ae77144a914701054a8ff0c257a50
7
+ data.tar.gz: 3541b04589e433c39e98cc8c56b1490efa2e843d98bc92e5b329d8cd6516eeb69b59afb3ef8d2ba88ce6694539894d60c9fb827ffd47195799a111a776d18208
data/README.md CHANGED
@@ -8,6 +8,8 @@
8
8
 
9
9
  ## Installation
10
10
 
11
+ **NOTE:** If you need an instance of Orthanc to test against, you can build a ready-to-use Orthanc server VM with the [orthanc-vagrant](https://github.com/chafey/orthanc-vagrant) project.
12
+
11
13
  Add this line to your application's Gemfile:
12
14
 
13
15
  ```ruby
@@ -25,19 +27,19 @@ Or install it yourself as:
25
27
  ## Usage
26
28
  The gem tries to follow the Orthanc API naming scheme as closely as possible, converting methods and response items to snake case to make the experience more ruby-like.
27
29
 
28
- api=Orthanc::Client.new("localhost", "8042")
29
- api.all_patients
30
- api.all_patients.first
31
- api.system.database_version => 5
32
- api.statistics.count_studies => 14
30
+ api=Orthanc::Client.new("localhost", "8042")
31
+ api.all_patients
32
+ api.all_patients.first
33
+ api.system.database_version => 5
34
+ api.statistics.count_studies => 14
35
+
36
+ You get the picture.
33
37
 
34
- You get the picture.
38
+ You can see what Orthanc API resources have been mapped in the gem, and their status [here](https://docs.google.com/spreadsheets/d/1KWQHNGS-NEYppo3XW4TkNbZYk_AraPhWOmSwxcsScvU/edit?usp=sharing)
35
39
 
36
- ## Development
40
+ Basic documentation can be found in [here](http://www.rubydoc.info/github/simonmd/orthanc-ruby/master/Orthanc/Client)
37
41
 
38
- After checking out the repo, run `bin/setup` to install dependencies. Then, run `bin/console` for an interactive prompt that will allow you to experiment.
39
42
 
40
- To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release` to create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
41
43
 
42
44
  ## Contributing
43
45
 
@@ -49,4 +51,4 @@ To install this gem onto your local machine, run `bundle exec rake install`. To
49
51
 
50
52
  ## License
51
53
 
52
- MIT License
54
+ MIT License
@@ -18,27 +18,27 @@ module Orthanc
18
18
 
19
19
  # ------------- General -------------
20
20
  def system
21
- objectify(base_uri["system"].get)
21
+ handle_response(base_uri["system"].get)
22
22
  end
23
23
 
24
24
  def statistics
25
- objectify(base_uri["statistics"].get)
25
+ handle_response(base_uri["statistics"].get)
26
26
  end
27
27
 
28
28
  def changes(params = {}) # "last", "limit" and "since" arguments
29
- objectify(base_uri["changes"].get({params: params}))
29
+ handle_response(base_uri["changes"].get({params: params}))
30
30
  end
31
31
 
32
32
  def delete_changes(params = {}) # "last", "limit" and "since" arguments
33
- objectify(base_uri["changes"].delete({params: params}))
33
+ handle_response(base_uri["changes"].delete({params: params}))
34
34
  end
35
35
 
36
36
  def exports(params = {}) # "last", "limit" and "since" arguments
37
- objectify(base_uri["exports"].get({params: params}))
37
+ handle_response(base_uri["exports"].get({params: params}))
38
38
  end
39
39
 
40
40
  def delete_exports(params = {}) # "last", "limit" and "since" arguments
41
- objectify(base_uri["exports"].delete({params: params}))
41
+ handle_response(base_uri["exports"].delete({params: params}))
42
42
  end
43
43
 
44
44
 
@@ -54,19 +54,22 @@ module Orthanc
54
54
  return true if num == "1"
55
55
  end
56
56
 
57
- def lowkey(h)
58
- Hash[h.map{|k,v| v.class == Array ? [k,v.map{|r| f r}.to_a] : [k.downcase,v]}]
59
- end
60
-
61
- def objectify(response)
62
- if JSON.parse(response).class == Array
63
- return JSON.parse(response)
64
- elsif JSON.parse(response).class == Hash
65
- return RecursiveOpenStruct.new(JSON.parse(response).to_snake_keys, recurse_over_arrays: true )
66
- else
57
+ def handle_response(response)
58
+ begin
59
+ # Try to parse response
60
+ parsed_response = JSON.parse(response)
61
+
62
+ if parsed_response.class == Array
63
+ return parsed_response
64
+ elsif parsed_response.class == Hash
65
+ return RecursiveOpenStruct.new(parsed_response.to_snake_keys, recurse_over_arrays: true )
66
+ else
67
+ return response
68
+ end
69
+ rescue JSON::ParserError => e # If JSON parse fails, return original response
67
70
  return response
68
71
  end
69
72
  end
70
73
 
71
74
  end
72
- end
75
+ end
@@ -4,220 +4,220 @@ module Orthanc
4
4
 
5
5
  # GET /instances
6
6
  def all_instances
7
- objectify(base_uri["instances"].get)
7
+ handle_response(base_uri["instances"].get)
8
8
  end
9
9
 
10
10
  # POST /instances
11
11
  def instances(dicom_file) # POST = Add the new DICOM file given in the POST body
12
- objectify(base_uri["instances"].post(dicom_file))
12
+ handle_response(base_uri["instances"].post(dicom_file))
13
13
  end
14
14
 
15
15
  # GET /instances/{id}
16
16
  def instance(id)
17
- objectify(base_uri["instances/#{id}"].get)
17
+ handle_response(base_uri["instances/#{id}"].get)
18
18
  end
19
19
 
20
20
  # DELETE /instances/{id}
21
21
  def delete_instance(id)
22
- objectify(base_uri["instances/#{id}"].delete)
22
+ handle_response(base_uri["instances/#{id}"].delete)
23
23
  end
24
24
 
25
25
  # POST /instances/{id}/anonymize
26
26
  def anonymize_instance(id, payload = {}) # https://code.google.com/p/orthanc/wiki/Anonymization
27
- objectify(base_uri["instances/#{id}/anonymize"].post(payload))
27
+ base_uri["instances/#{id}/anonymize"].post(payload.to_s)
28
28
  end
29
29
 
30
30
  # GET /instances/{id}/content/
31
31
  def instance_content(id) # List the first-level DICOM tags
32
- objectify(base_uri["instances/#{id}/frames"].get)
32
+ handle_response(base_uri["instances/#{id}/frames"].get)
33
33
  end
34
34
 
35
35
  # GET /instances/{id}/content/{group}-{element}
36
36
  def instance_content_tag(id, group, element) # Raw access to the value of DICOM tags (comprising the padding character)
37
- objectify(base_uri["instances/#{id}/content/#{group}-#{element}"].get)
37
+ handle_response(base_uri["instances/#{id}/content/#{group}-#{element}"].get)
38
38
  end
39
39
 
40
40
  # GET /instances/{id}/content/{group}-{element}/{index}/...
41
41
  def instance_content_sequence(id, group, element, index) # Raw access to the content of DICOM sequences
42
- objectify(base_uri["instances/#{id}/content/#{group}-#{element}/#{index}"].get)
42
+ handle_response(base_uri["instances/#{id}/content/#{group}-#{element}/#{index}"].get)
43
43
  end
44
44
 
45
45
  # POST /instances/{id}/export
46
- def instance_export(id) # Write the DICOM file in the filesystem where Orthanc is running
47
- objectify(base_uri["instances/#{id}/export"].post)
48
- end
46
+ def instance_export(id, payload = {}) # Write the DICOM file in the filesystem where Orthanc is running
47
+ base_uri["instances/#{id}/export"].post(payload)
48
+ end
49
49
 
50
50
  # GET /instances/{id}/file
51
51
  def instance_file(id)
52
- objectify(base_uri["instances/#{id}/file"].get)
53
- end
52
+ base_uri["instances/#{id}/file"].get
53
+ end
54
54
 
55
55
  # GET /instances/{id}/frames
56
56
  def instance_frames(id) # Instance frames array
57
- objectify(base_uri["instances/#{id}/frames"].get)
58
- end
57
+ handle_response(base_uri["instances/#{id}/frames"].get)
58
+ end
59
59
 
60
60
  # GET /instances/{id}/frames/{frameNumber}/image-int16
61
61
  def instance_frame_image_int16(id, frame_number) # Truncated image to the [-32768;32767] range
62
- objectify(base_uri["instances/#{id}/frames/#{frame_number}/image-int16"].get)
62
+ base_uri["instances/#{id}/frames/#{frame_number}/image-int16"].get
63
63
  end
64
64
 
65
65
  # GET /instances/{id}/frames/{frameNumber}/image-uint16
66
66
  def instance_frame_image_uint16(id, frame_number) # Truncated image to the [0;65535] range
67
- objectify(base_uri["instances/#{id}/frames/#{frame_number}/image-uint16"].get)
67
+ base_uri["instances/#{id}/frames/#{frame_number}/image-uint16"].get
68
68
  end
69
69
 
70
70
  # GET /instances/{id}/frames/{frameNumber}/image-uint8
71
71
  def instance_frame_image_uint8(id, frame_number) # Truncated image to the [0;255] range
72
- objectify(base_uri["instances/#{id}/frames/#{frame_number}/image-uint8"].get)
72
+ base_uri["instances/#{id}/frames/#{frame_number}/image-uint8"].get
73
73
  end
74
74
 
75
75
  # GET /instances/{id}/frames/{frameNumber}/matlab
76
76
  def instance_frame_matlab(id, frame_number) # a = eval(urlread('http://localhost:8042/instances/.../matlab'))
77
- objectify(base_uri["instances/#{id}/frames/#{frame_number}/matlab"].get)
77
+ base_uri["instances/#{id}/frames/#{frame_number}/matlab"].get
78
78
  end
79
79
 
80
80
  # GET /instances/{id}/frames/{frameNumber}/preview
81
81
  def instance_preview(id, frame_number) # Rescaled image (so that all the range [0;255] is used)
82
- objectify(base_uri["instances/#{id}/frames/#{frame_number}/preview"].get)
82
+ base_uri["instances/#{id}/frames/#{frame_number}/preview"].get
83
83
  end
84
84
 
85
85
  # GET /instances/{id}/image-int16
86
86
  def instance_image_int16(id) # Truncated image to the [-32768;32767] range
87
- objectify(base_uri["instances/#{id}/image-int16"].get)
87
+ base_uri["instances/#{id}/image-int16"].get
88
88
  end
89
89
 
90
90
  # GET /instances/{id}/image-uint16
91
91
  def instance_image_uint16(id) # Truncated image to the [0;65535] range
92
- objectify(base_uri["instances/#{id}/image-uint16"].get)
92
+ base_uri["instances/#{id}/image-uint16"].get
93
93
  end
94
94
 
95
95
  # GET /instances/{id}/image-uint8
96
96
  def instance_image_uint8(id) # Truncated image to the [0;255] range
97
- objectify(base_uri["instances/#{id}/image-uint8"].get)
97
+ base_uri["instances/#{id}/image-uint8"].get
98
98
  end
99
99
 
100
100
  # GET /instances/{id}/matlab
101
101
  def instance_matlab(id) # a = eval(urlread('http://localhost:8042/instances/.../matlab'))
102
- objectify(base_uri["instances/#{id}/matlab"].get)
102
+ base_uri["instances/#{id}/matlab"].get
103
103
  end
104
104
 
105
105
  # POST /instances/{id}/modify
106
106
  def modify_instance(id, payload = {}) # https://code.google.com/p/orthanc/wiki/Anonymization
107
- objectify(base_uri["instances/#{id}/modify"].post(payload))
107
+ base_uri["instances/#{id}/modify"].post(payload.to_s)
108
108
  end
109
109
 
110
110
  # GET /instances/{id}/module
111
111
  def instance_module(id)
112
- objectify(base_uri["instances/#{id}/module"].get)
112
+ handle_response(base_uri["instances/#{id}/module"].get)
113
113
  end
114
114
 
115
115
  # GET /instances/{id}/patient
116
116
  def instance_patient(id)
117
- objectify(base_uri["instances/#{id}/patient"].get)
117
+ handle_response(base_uri["instances/#{id}/patient"].get)
118
118
  end
119
119
 
120
120
  # GET /instances/{id}/preview
121
121
  def instance_preview(id) # Rescaled image (so that all the range [0;255] is used)
122
- objectify(base_uri["instances/#{id}/preview"].get)
122
+ handle_response(base_uri["instances/#{id}/preview"].get)
123
123
  end
124
124
 
125
125
  # GET /instances/{id}/series
126
126
  def instance_series(id)
127
- objectify(base_uri["instances/#{id}/series"].get)
127
+ handle_response(base_uri["instances/#{id}/series"].get)
128
128
  end
129
129
 
130
130
  # GET /instances/{id}/simplified-tags
131
- def instance_shared_tags(id) # "?simplify" argument to simplify output
132
- objectify(base_uri["instances/#{id}/shared-tags"].get)
131
+ def instance_simplified_tags(id) # "?simplify" argument to simplify output
132
+ handle_response(base_uri["instances/#{id}/simplified-tags"].get)
133
133
  end
134
134
 
135
135
  # GET /instances/{id}/statistics
136
136
  def instance_statistics(id)
137
- objectify(base_uri["instances/#{id}/statistics"].get)
137
+ handle_response(base_uri["instances/#{id}/statistics"].get)
138
138
  end
139
139
 
140
140
  # GET /instances/{id}/study
141
141
  def instance_study(id)
142
- objectify(base_uri["instances/#{id}/study"].get)
142
+ handle_response(base_uri["instances/#{id}/study"].get)
143
143
  end
144
144
 
145
145
  # GET /instances/{id}/tags
146
146
  def instance_tags(id) # TODO: "?simplify" argument to simplify output (same as "simplified-tags")
147
- objectify(base_uri["instances/#{id}/tags"].get)
147
+ handle_response(base_uri["instances/#{id}/tags"].get)
148
148
  end
149
149
 
150
150
  # TODO: Polymorphic resourceType resources. Repetitive. must refactor
151
151
 
152
152
  # GET /{resourceType}/{id}/attachments
153
153
  def instance_attachments(id)
154
- objectify(base_uri["instances/#{id}/attachments"].get)
154
+ handle_response(base_uri["instances/#{id}/attachments"].get)
155
155
  end
156
156
 
157
157
  # DELETE /{resourceType}/{id}/attachments/{name}
158
158
  def delete_instance_attachment(id, name)
159
- objectify(base_uri["instances/#{id}/attachments/#{name}"].delete)
159
+ handle_response(base_uri["instances/#{id}/attachments/#{name}"].delete)
160
160
  end
161
161
 
162
162
  # PUT /{resourceType}/{id}/attachments/{name}
163
163
  def instance_attachment(id, name, payload = {})
164
- objectify(base_uri["instances/#{id}/attachments/#{name}"].put(payload))
164
+ handle_response(base_uri["instances/#{id}/attachments/#{name}"].put(payload))
165
165
  end
166
166
 
167
167
  # GET /{resourceType}/{id}/attachments/{name}/compressed-data
168
168
  def instance_attachment_compressed_data(id, name)
169
- objectify(base_uri["instances/#{id}/attachments/#{name}/compressed-data"].get)
169
+ handle_response(base_uri["instances/#{id}/attachments/#{name}/compressed-data"].get)
170
170
  end
171
171
 
172
172
  # GET /{resourceType}/{id}/attachments/{name}/compressed-md5
173
173
  def instance_attachment_compressed_md5(id, name)
174
- objectify(base_uri["instances/#{id}/attachments/#{name}/compressed-md5"].get)
174
+ handle_response(base_uri["instances/#{id}/attachments/#{name}/compressed-md5"].get)
175
175
  end
176
176
 
177
177
  # GET /{resourceType}/{id}/attachments/{name}/compressed-size
178
178
  def instance_attachment_compressed_size(id, name)
179
- objectify(base_uri["instances/#{id}/attachments/#{name}/compressed-size"].get)
179
+ handle_response(base_uri["instances/#{id}/attachments/#{name}/compressed-size"].get)
180
180
  end
181
181
 
182
182
  # GET /{resourceType}/{id}/attachments/{name}/data
183
183
  def instance_attachment_data(id, name)
184
- objectify(base_uri["instances/#{id}/attachments/#{name}/data"].get)
184
+ handle_response(base_uri["instances/#{id}/attachments/#{name}/data"].get)
185
185
  end
186
186
 
187
187
  # GET /{resourceType}/{id}/attachments/{name}/md5
188
188
  def instance_attachment_md5(id, name)
189
- objectify(base_uri["instances/#{id}/attachments/#{name}/md5"].get)
189
+ handle_response(base_uri["instances/#{id}/attachments/#{name}/md5"].get)
190
190
  end
191
191
 
192
192
  # GET /{resourceType}/{id}/attachments/{name}/size
193
193
  def instance_attachment_size(id, name)
194
- objectify(base_uri["instances/#{id}/attachments/#{name}/size"].get)
194
+ handle_response(base_uri["instances/#{id}/attachments/#{name}/size"].get)
195
195
  end
196
196
 
197
197
  # POST /{resourceType}/{id}/attachments/{name}/verify-md5
198
198
  def instance_attachment_verify_md5(id, name)
199
- objectify(base_uri["instances/#{id}/attachments/#{name}/verify-md5"].get)
199
+ handle_response(base_uri["instances/#{id}/attachments/#{name}/verify-md5"].get)
200
200
  end
201
201
 
202
202
  # GET /{resourceType}/{id}/metadata
203
203
  def instance_all_metadata(id)
204
- objectify(base_uri["instances/#{id}/metadata"].get)
204
+ handle_response(base_uri["instances/#{id}/metadata"].get)
205
205
  end
206
206
 
207
207
  # GET /{resourceType}/{id}/metadata/{name}
208
208
  def instance_metadata(id, name)
209
- objectify(base_uri["instances/#{id}/metadata/#{name}"].get)
209
+ handle_response(base_uri["instances/#{id}/metadata/#{name}"].get)
210
210
  end
211
211
 
212
212
  # DELETE /{resourceType}/{id}/metadata/{name}
213
213
  def instance_delete_metadata(id, name)
214
- objectify(base_uri["instances/#{id}/metadata/#{name}"].delete)
214
+ handle_response(base_uri["instances/#{id}/metadata/#{name}"].delete)
215
215
  end
216
216
 
217
217
  # PUT /{resourceType}/{id}/metadata/{name}
218
218
  def instance_update_metadata(id, name, payload = {})
219
- objectify(base_uri["instances/#{id}/metadata/#{name}"].put(payload))
219
+ handle_response(base_uri["instances/#{id}/metadata/#{name}"].put(payload))
220
220
  end
221
221
 
222
222
  end
223
- end
223
+ end
@@ -3,53 +3,53 @@ module Orthanc
3
3
  # ------------- Modalities -------------
4
4
  # GET /modalities
5
5
  def modalities
6
- objectify(base_uri["modalities"].get)
6
+ handle_response(base_uri["modalities"].get)
7
7
  end
8
8
 
9
9
  # GET /modalities/{dicom}
10
10
  def modality(dicom)
11
- objectify(base_uri["modalities/#{dicom}"].get)
11
+ handle_response(base_uri["modalities/#{dicom}"].get)
12
12
  end
13
13
 
14
14
  # DELETE /modalities/{dicom}
15
15
  def delete_modality(dicom)
16
- objectify(base_uri["modalities/#{dicom}"].delete)
16
+ handle_response(base_uri["modalities/#{dicom}"].delete)
17
17
  end
18
18
 
19
19
  # PUT /modalities/{dicom}
20
- def modify_modality(dicom)
21
- objectify(base_uri["modalities/#{dicom}"].put)
20
+ def modify_modality(dicom, payload = {})
21
+ handle_response(base_uri["modalities/#{dicom}"].put(payload))
22
22
  end
23
23
 
24
24
  # POST /modalities/{dicom}/echo
25
25
  def modality_echo(dicom, payload = {}) # C-Echo SCU
26
- objectify(base_uri["modalities/#{dicom}/echo"].post(payload))
26
+ handle_response(base_uri["modalities/#{dicom}/echo"].post(payload))
27
27
  end
28
28
 
29
29
  # POST /modalities/{dicom}/find
30
30
  def modality_find(dicom, payload = {})
31
- objectify(base_uri["modalities/#{dicom}/find"].post(payload))
31
+ handle_response(base_uri["modalities/#{dicom}/find"].post(payload))
32
32
  end
33
33
 
34
34
  # POST /modalities/{dicom}/find-patient
35
35
  def modality_find_patient(dicom, payload = {})
36
- objectify(base_uri["modalities/#{dicom}/find-patient"].post(payload))
36
+ handle_response(base_uri["modalities/#{dicom}/find-patient"].post(payload))
37
37
  end
38
38
 
39
39
  # POST /modalities/{dicom}/find-series
40
40
  def modality_find_series(dicom, payload = {})
41
- objectify(base_uri["modalities/#{dicom}/find-series"].post(payload))
41
+ handle_response(base_uri["modalities/#{dicom}/find-series"].post(payload))
42
42
  end
43
43
 
44
44
  # POST /modalities/{dicom}/find-study
45
45
  def modality_find_study(dicom, payload = {})
46
- objectify(base_uri["modalities/#{dicom}/find-study"].post(payload))
46
+ handle_response(base_uri["modalities/#{dicom}/find-study"].post(payload))
47
47
  end
48
48
 
49
49
  # POST /modalities/{dicom}/store
50
50
  def modality_store(dicom, payload = {}) # POST body = UUID series, UUID instance, or raw DICOM file
51
- objectify(base_uri["modalities/#{dicom}/store"].post(payload))
51
+ handle_response(base_uri["modalities/#{dicom}/store"].post(payload))
52
52
  end
53
53
 
54
54
  end
55
- end
55
+ end
@@ -3,22 +3,22 @@ module Orthanc
3
3
  # ------------- Patients -------------
4
4
  # GET /patients
5
5
  def all_patients
6
- objectify(base_uri["patients"].get)
6
+ handle_response(base_uri["patients"].get)
7
7
  end
8
8
 
9
9
  # GET /patients/{id}
10
10
  def patient(id)
11
- objectify(base_uri["patients/#{id}"].get)
11
+ handle_response(base_uri["patients/#{id}"].get)
12
12
  end
13
13
 
14
- # DELETE /patients/{id}
14
+ # DELETE /patients/{id}
15
15
  def delete_patient(id)
16
- objectify(base_uri["patients/#{id}"].delete)
16
+ handle_response(base_uri["patients/#{id}"].delete)
17
17
  end
18
18
 
19
19
  # POST /patients/{id}/anonymize
20
20
  def anonymize_patient(id, payload = {}) # https://code.google.com/p/orthanc/wiki/Anonymization
21
- objectify(base_uri["patients/#{id}/anonymize"].post(payload))
21
+ handle_response(base_uri["patients/#{id}/anonymize"].post(payload.to_s))
22
22
  end
23
23
 
24
24
  # GET /patients/{id}/archive
@@ -28,7 +28,7 @@ module Orthanc
28
28
 
29
29
  # GET /patients/{id}/instances
30
30
  def patient_instances(id) # Retrieve all the instances of this patient in a single REST call
31
- objectify(base_uri["patients/#{id}/instances"].get)
31
+ handle_response(base_uri["patients/#{id}/instances"].get)
32
32
  end
33
33
 
34
34
  # GET /patients/{id}/media
@@ -38,12 +38,12 @@ module Orthanc
38
38
 
39
39
  # POST /patients/{id}/modify
40
40
  def modify_patient(id, payload = {}) # https://code.google.com/p/orthanc/wiki/Anonymization
41
- objectify(base_uri["patients/#{id}/modify"].post(payload))
41
+ handle_response(base_uri["patients/#{id}/modify"].post(payload.to_s))
42
42
  end
43
43
 
44
44
  # GET /patients/{id}/module
45
45
  def patient_module(id)
46
- objectify(base_uri["patients/#{id}/module"].get)
46
+ handle_response(base_uri["patients/#{id}/module"].get)
47
47
  end
48
48
 
49
49
  # GET /patients/{id}/protected
@@ -60,95 +60,95 @@ module Orthanc
60
60
 
61
61
  # GET /patients/{id}/series
62
62
  def patient_series(id) # Retrieve all the series of this patient in a single REST call
63
- objectify(base_uri["patients/#{id}/series"].get)
63
+ handle_response(base_uri["patients/#{id}/series"].get)
64
64
  end
65
65
 
66
66
  # GET /patients/{id}/shared-tags
67
67
  def patient_shared_tags(id) # "?simplify" argument to simplify output
68
- objectify(base_uri["patients/#{id}/shared-tags"].get)
68
+ handle_response(base_uri["patients/#{id}/shared-tags"].get)
69
69
  end
70
70
 
71
71
  # GET /patients/{id}/statistics
72
72
  def patient_statistics(id)
73
- objectify(base_uri["patients/#{id}/statistics"].get)
73
+ handle_response(base_uri["patients/#{id}/statistics"].get)
74
74
  end
75
75
 
76
76
  # GET /patients/{id}/studies
77
77
  def patient_studies(id) # Retrieve all the studies of this patient in a single REST call
78
- objectify(base_uri["patients/#{id}/studies"].get)
78
+ handle_response(base_uri["patients/#{id}/studies"].get)
79
79
  end
80
80
 
81
81
  # TODO: Polymorphic resourceType resources. Repetitive. must refactor
82
82
 
83
83
  # GET /{resourceType}/{id}/attachments
84
84
  def patient_attachments(id)
85
- objectify(base_uri["patients/#{id}/attachments"].get)
85
+ handle_response(base_uri["patients/#{id}/attachments"].get)
86
86
  end
87
87
 
88
88
  # DELETE /{resourceType}/{id}/attachments/{name}
89
89
  def delete_patient_attachment(id, name)
90
- objectify(base_uri["patients/#{id}/attachments/#{name}"].delete)
90
+ handle_response(base_uri["patients/#{id}/attachments/#{name}"].delete)
91
91
  end
92
92
 
93
93
  # PUT /{resourceType}/{id}/attachments/{name}
94
94
  def patient_attachment(id, name, payload = {})
95
- objectify(base_uri["patients/#{id}/attachments/#{name}"].put(payload))
95
+ handle_response(base_uri["patients/#{id}/attachments/#{name}"].put(payload))
96
96
  end
97
97
 
98
98
  # GET /{resourceType}/{id}/attachments/{name}/compressed-data
99
99
  def patient_attachment_compressed_data(id, name)
100
- objectify(base_uri["patients/#{id}/attachments/#{name}/compressed-data"].get)
100
+ handle_response(base_uri["patients/#{id}/attachments/#{name}/compressed-data"].get)
101
101
  end
102
102
 
103
103
  # GET /{resourceType}/{id}/attachments/{name}/compressed-md5
104
104
  def patient_attachment_compressed_md5(id, name)
105
- objectify(base_uri["patients/#{id}/attachments/#{name}/compressed-md5"].get)
105
+ handle_response(base_uri["patients/#{id}/attachments/#{name}/compressed-md5"].get)
106
106
  end
107
107
 
108
108
  # GET /{resourceType}/{id}/attachments/{name}/compressed-size
109
109
  def patient_attachment_compressed_size(id, name)
110
- objectify(base_uri["patients/#{id}/attachments/#{name}/compressed-size"].get)
110
+ handle_response(base_uri["patients/#{id}/attachments/#{name}/compressed-size"].get)
111
111
  end
112
112
 
113
113
  # GET /{resourceType}/{id}/attachments/{name}/data
114
114
  def patient_attachment_data(id, name)
115
- objectify(base_uri["patients/#{id}/attachments/#{name}/data"].get)
115
+ handle_response(base_uri["patients/#{id}/attachments/#{name}/data"].get)
116
116
  end
117
117
 
118
118
  # GET /{resourceType}/{id}/attachments/{name}/md5
119
119
  def patient_attachment_md5(id, name)
120
- objectify(base_uri["patients/#{id}/attachments/#{name}/md5"].get)
120
+ handle_response(base_uri["patients/#{id}/attachments/#{name}/md5"].get)
121
121
  end
122
122
 
123
123
  # GET /{resourceType}/{id}/attachments/{name}/size
124
124
  def patient_attachment_size(id, name)
125
- objectify(base_uri["patients/#{id}/attachments/#{name}/size"].get)
125
+ handle_response(base_uri["patients/#{id}/attachments/#{name}/size"].get)
126
126
  end
127
127
 
128
128
  # POST /{resourceType}/{id}/attachments/{name}/verify-md5
129
129
  def patient_attachment_verify_md5(id, name)
130
- objectify(base_uri["patients/#{id}/attachments/#{name}/verify-md5"].get)
130
+ handle_response(base_uri["patients/#{id}/attachments/#{name}/verify-md5"].get)
131
131
  end
132
132
 
133
133
  # GET /{resourceType}/{id}/metadata
134
134
  def patient_all_metadata(id)
135
- objectify(base_uri["patients/#{id}/metadata"].get)
135
+ handle_response(base_uri["patients/#{id}/metadata"].get)
136
136
  end
137
137
 
138
138
  # GET /{resourceType}/{id}/metadata/{name}
139
139
  def patient_metadata(id, name)
140
- objectify(base_uri["patients/#{id}/metadata/#{name}"].get)
140
+ handle_response(base_uri["patients/#{id}/metadata/#{name}"].get)
141
141
  end
142
142
 
143
143
  # DELETE /{resourceType}/{id}/metadata/{name}
144
144
  def patient_delete_metadata(id, name)
145
- objectify(base_uri["patients/#{id}/metadata/#{name}"].delete)
145
+ handle_response(base_uri["patients/#{id}/metadata/#{name}"].delete)
146
146
  end
147
147
 
148
148
  # PUT /{resourceType}/{id}/metadata/{name}
149
149
  def patient_update_metadata(id, name, payload = {})
150
- objectify(base_uri["patients/#{id}/metadata/#{name}"].put(payload))
150
+ handle_response(base_uri["patients/#{id}/metadata/#{name}"].put(payload))
151
151
  end
152
-
152
+
153
153
  end
154
- end
154
+ end
@@ -3,28 +3,28 @@ module Orthanc
3
3
  # ------------- Peers -------------
4
4
  # GET /peers
5
5
  def peers # Get the list of all the registered plugins
6
- objectify(base_uri["peers"].get)
6
+ handle_response(base_uri["peers"].get)
7
7
  end
8
8
 
9
9
  # GET /peers/{peer}
10
10
  def peer(peer)
11
- objectify(base_uri["peers/#{peer}"].get)
11
+ handle_response(base_uri["peers/#{peer}"].get)
12
12
  end
13
13
 
14
14
  # DELETE /peers/{peer}
15
15
  def delete_peer(peer)
16
- objectify(base_uri["peers/#{peer}"].delete)
16
+ handle_response(base_uri["peers/#{peer}"].delete)
17
17
  end
18
18
 
19
19
  # PUT /peers/{peer}
20
20
  def modify_peer(peer, payload = {})
21
- objectify(base_uri["peers/#{peer}"].put(payload))
21
+ handle_response(base_uri["peers/#{peer}"].put(payload))
22
22
  end
23
23
 
24
24
  # GET /peers/{peer}/store
25
25
  def peer_store(peer, payload = {}) # POST body = UUID series, UUID instance, or raw DICOM file
26
- objectify(base_uri["peers/#{peer}/store"].post(payload))
27
- end
26
+ handle_response(base_uri["peers/#{peer}/store"].post(payload))
27
+ end
28
28
 
29
29
  end
30
- end
30
+ end
@@ -3,18 +3,18 @@ module Orthanc
3
3
  # ------------- Plugins -------------
4
4
  # GET /plugins
5
5
  def plugins # Get the list of all the registered plugins
6
- objectify(base_uri["plugins"].get)
6
+ handle_response(base_uri["plugins"].get)
7
7
  end
8
8
 
9
9
  # GET /plugins/explorer.js
10
10
  def plugins_explorerjs # Get the JavaScript code that is injected by plugins into Orthanc Explorer
11
- objectify(base_uri["plugins/explorer.js"].get)
11
+ handle_response(base_uri["plugins/explorer.js"].get)
12
12
  end
13
13
 
14
14
  # GET /plugins/{id}
15
15
  def plugin(id) # Get information about some plugin
16
- objectify(base_uri["plugins/#{id}"].get)
17
- end
16
+ handle_response(base_uri["plugins/#{id}"].get)
17
+ end
18
18
 
19
19
  end
20
- end
20
+ end
@@ -3,22 +3,22 @@ module Orthanc
3
3
  # ------------- Series -------------
4
4
  # GET /series
5
5
  def all_series # Darn DICOM, why did you have to call them something that's spelled the same singular and plural?
6
- objectify(base_uri["series"].get)
6
+ handle_response(base_uri["series"].get)
7
7
  end
8
8
 
9
9
  # GET /series/{id}
10
10
  def series(id)
11
- objectify(base_uri["series/#{id}"].get)
11
+ handle_response(base_uri["series/#{id}"].get)
12
12
  end
13
13
 
14
14
  # DELETE /series/{id}
15
15
  def delete_series(id)
16
- objectify(base_uri["series/#{id}"].delete)
16
+ handle_response(base_uri["series/#{id}"].delete)
17
17
  end
18
18
 
19
19
  # POST /series/{id}/anonymize
20
20
  def anonymize_series(id, payload = {}) # https://code.google.com/p/orthanc/wiki/Anonymization
21
- objectify(base_uri["series/#{id}/anonymize"].post(payload))
21
+ handle_response(base_uri["series/#{id}/anonymize"].post(payload.to_s))
22
22
  end
23
23
 
24
24
  # GET /series/{id}/archive
@@ -28,7 +28,7 @@ module Orthanc
28
28
 
29
29
  # GET /series/{id}/instances
30
30
  def series_instances(id) # Retrieve all the instances of this patient in a single REST call
31
- objectify(base_uri["series/#{id}/instances"].get)
31
+ handle_response(base_uri["series/#{id}/instances"].get)
32
32
  end
33
33
 
34
34
  # GET /series/{id}/media
@@ -38,105 +38,105 @@ module Orthanc
38
38
 
39
39
  # POST /series/{id}/modify
40
40
  def modify_series(id, payload = {}) # https://code.google.com/p/orthanc/wiki/Anonymization
41
- objectify(base_uri["series/#{id}/modify"].post(payload))
41
+ handle_response(base_uri["series/#{id}/modify"].post(payload.to_s))
42
42
  end
43
43
 
44
44
  # GET /series/{id}/module
45
45
  def series_module(id)
46
- objectify(base_uri["series/#{id}/module"].get)
46
+ handle_response(base_uri["series/#{id}/module"].get)
47
47
  end
48
48
 
49
49
  # GET /series/{id}/patient
50
50
  def series_patient(id)
51
- objectify(base_uri["series/#{id}/patient"].get)
51
+ handle_response(base_uri["series/#{id}/patient"].get)
52
52
  end
53
53
 
54
54
  # GET /series/{id}/shared-tags
55
55
  def series_shared_tags(id) # "?simplify" argument to simplify output
56
- objectify(base_uri["series/#{id}/shared-tags"].get)
56
+ handle_response(base_uri["series/#{id}/shared-tags"].get)
57
57
  end
58
58
 
59
59
  # GET /series/{id}/statistics
60
60
  def series_statistics(id)
61
- objectify(base_uri["series/#{id}/statistics"].get)
61
+ handle_response(base_uri["series/#{id}/statistics"].get)
62
62
  end
63
63
 
64
64
  # GET /series/{id}/study
65
65
  def series_study(id)
66
- objectify(base_uri["series/#{id}/study"].get)
66
+ handle_response(base_uri["series/#{id}/study"].get)
67
67
  end
68
68
 
69
69
  # TODO: Polymorphic resourceType resources. Repetitive. must refactor
70
70
 
71
71
  # GET /{resourceType}/{id}/attachments
72
72
  def series_attachments(id)
73
- objectify(base_uri["series/#{id}/attachments"].get)
73
+ handle_response(base_uri["series/#{id}/attachments"].get)
74
74
  end
75
75
 
76
76
  # DELETE /{resourceType}/{id}/attachments/{name}
77
77
  def delete_series_attachment(id, name)
78
- objectify(base_uri["series/#{id}/attachments/#{name}"].delete)
78
+ handle_response(base_uri["series/#{id}/attachments/#{name}"].delete)
79
79
  end
80
80
 
81
81
  # PUT /{resourceType}/{id}/attachments/{name}
82
82
  def series_attachment(id, name, payload = {})
83
- objectify(base_uri["series/#{id}/attachments/#{name}"].put(payload))
83
+ handle_response(base_uri["series/#{id}/attachments/#{name}"].put(payload))
84
84
  end
85
85
 
86
86
  # GET /{resourceType}/{id}/attachments/{name}/compressed-data
87
87
  def series_attachment_compressed_data(id, name)
88
- objectify(base_uri["series/#{id}/attachments/#{name}/compressed-data"].get)
88
+ handle_response(base_uri["series/#{id}/attachments/#{name}/compressed-data"].get)
89
89
  end
90
90
 
91
91
  # GET /{resourceType}/{id}/attachments/{name}/compressed-md5
92
92
  def series_attachment_compressed_md5(id, name)
93
- objectify(base_uri["series/#{id}/attachments/#{name}/compressed-md5"].get)
93
+ handle_response(base_uri["series/#{id}/attachments/#{name}/compressed-md5"].get)
94
94
  end
95
95
 
96
96
  # GET /{resourceType}/{id}/attachments/{name}/compressed-size
97
97
  def series_attachment_compressed_size(id, name)
98
- objectify(base_uri["series/#{id}/attachments/#{name}/compressed-size"].get)
98
+ handle_response(base_uri["series/#{id}/attachments/#{name}/compressed-size"].get)
99
99
  end
100
100
 
101
101
  # GET /{resourceType}/{id}/attachments/{name}/data
102
102
  def series_attachment_data(id, name)
103
- objectify(base_uri["series/#{id}/attachments/#{name}/data"].get)
103
+ handle_response(base_uri["series/#{id}/attachments/#{name}/data"].get)
104
104
  end
105
105
 
106
106
  # GET /{resourceType}/{id}/attachments/{name}/md5
107
107
  def series_attachment_md5(id, name)
108
- objectify(base_uri["series/#{id}/attachments/#{name}/md5"].get)
108
+ handle_response(base_uri["series/#{id}/attachments/#{name}/md5"].get)
109
109
  end
110
110
 
111
111
  # GET /{resourceType}/{id}/attachments/{name}/size
112
112
  def series_attachment_size(id, name)
113
- objectify(base_uri["series/#{id}/attachments/#{name}/size"].get)
113
+ handle_response(base_uri["series/#{id}/attachments/#{name}/size"].get)
114
114
  end
115
115
 
116
116
  # POST /{resourceType}/{id}/attachments/{name}/verify-md5
117
117
  def series_attachment_verify_md5(id, name)
118
- objectify(base_uri["series/#{id}/attachments/#{name}/verify-md5"].get)
118
+ handle_response(base_uri["series/#{id}/attachments/#{name}/verify-md5"].get)
119
119
  end
120
120
 
121
121
  # GET /{resourceType}/{id}/metadata
122
122
  def series_all_metadata(id)
123
- objectify(base_uri["series/#{id}/metadata"].get)
123
+ handle_response(base_uri["series/#{id}/metadata"].get)
124
124
  end
125
125
 
126
126
  # GET /{resourceType}/{id}/metadata/{name}
127
127
  def series_metadata(id, name)
128
- objectify(base_uri["series/#{id}/metadata/#{name}"].get)
128
+ handle_response(base_uri["series/#{id}/metadata/#{name}"].get)
129
129
  end
130
130
 
131
131
  # DELETE /{resourceType}/{id}/metadata/{name}
132
132
  def series_delete_metadata(id, name)
133
- objectify(base_uri["series/#{id}/metadata/#{name}"].delete)
133
+ handle_response(base_uri["series/#{id}/metadata/#{name}"].delete)
134
134
  end
135
135
 
136
136
  # GET /{resourceType}/{id}/metadata/{name}
137
137
  def series_update_metadata(id, name, payload = {})
138
- objectify(base_uri["series/#{id}/metadata/#{name}"].put(payload))
138
+ handle_response(base_uri["series/#{id}/metadata/#{name}"].put(payload))
139
139
  end
140
-
140
+
141
141
  end
142
- end
142
+ end
@@ -3,22 +3,22 @@ module Orthanc
3
3
  # ------------- Studies -------------
4
4
  # GET /studies
5
5
  def all_studies
6
- objectify(base_uri["studies"].get)
6
+ handle_response(base_uri["studies"].get)
7
7
  end
8
8
 
9
9
  # GET /studies/{id}
10
10
  def study(id)
11
- objectify(base_uri["studies/#{id}"].get)
11
+ handle_response(base_uri["studies/#{id}"].get)
12
12
  end
13
13
 
14
14
  # DELETE /studies/{id}
15
15
  def delete_study(id)
16
- objectify(base_uri["studies/#{id}"].delete)
16
+ handle_response(base_uri["studies/#{id}"].delete)
17
17
  end
18
18
 
19
19
  # POST /studies/{id}/anonymize
20
20
  def anonymize_study(id, payload = {}) # https://code.google.com/p/orthanc/wiki/Anonymization
21
- objectify(base_uri["studies/#{id}/anonymize"].post(payload))
21
+ handle_response(base_uri["studies/#{id}/anonymize"].post(payload.to_s))
22
22
  end
23
23
 
24
24
  # GET /studies/{id}/archive
@@ -28,7 +28,7 @@ module Orthanc
28
28
 
29
29
  # GET /studies/{id}/instances
30
30
  def study_instances(id) # Retrieve all the instances of this patient in a single REST call
31
- objectify(base_uri["studies/#{id}/instances"].get)
31
+ handle_response(base_uri["studies/#{id}/instances"].get)
32
32
  end
33
33
 
34
34
  # GET /studies/{id}/media
@@ -38,110 +38,110 @@ module Orthanc
38
38
 
39
39
  # POST /studies/{id}/modify
40
40
  def modify_study(id, payload = {}) # https://code.google.com/p/orthanc/wiki/Anonymization
41
- objectify(base_uri["studies/#{id}/modify"].post(payload))
41
+ handle_response(base_uri["studies/#{id}/modify"].post(payload.to_s))
42
42
  end
43
43
 
44
44
  # GET /studies/{id}/module
45
45
  def study_module(id)
46
- objectify(base_uri["studies/#{id}/module"].get)
46
+ handle_response(base_uri["studies/#{id}/module"].get)
47
47
  end
48
48
 
49
49
  # GET /studies/{id}/module-patient
50
50
  def study_module_patient(id)
51
- objectify(base_uri["studies/#{id}/module-patient"].get)
51
+ handle_response(base_uri["studies/#{id}/module-patient"].get)
52
52
  end
53
53
 
54
54
  # GET /studies/{id}/patient
55
55
  def study_patient(id)
56
- objectify(base_uri["studies/#{id}/patient"].get)
56
+ handle_response(base_uri["studies/#{id}/patient"].get)
57
57
  end
58
58
 
59
59
  # GET /studies/{id}/series
60
60
  def study_series(id) # Retrieve all the series of this patient in a single REST call
61
- objectify(base_uri["studies/#{id}/series"].get)
61
+ handle_response(base_uri["studies/#{id}/series"].get)
62
62
  end
63
63
 
64
64
  # GET /studies/{id}/shared-tags
65
65
  def study_shared_tags(id) # "?simplify" argument to simplify output
66
- objectify(base_uri["studies/#{id}/shared-tags"].get)
66
+ handle_response(base_uri["studies/#{id}/shared-tags"].get)
67
67
  end
68
68
 
69
69
  # GET /studies/{id}/statistics
70
70
  def study_statistics(id)
71
- objectify(base_uri["studies/#{id}/statistics"].get)
71
+ handle_response(base_uri["studies/#{id}/statistics"].get)
72
72
  end
73
73
 
74
74
  # TODO: Polymorphic resourceType resources. Repetitive. must refactor
75
75
 
76
76
  # GET /{resourceType}/{id}/attachments
77
77
  def study_attachments(id)
78
- objectify(base_uri["studies/#{id}/attachments"].get)
78
+ handle_response(base_uri["studies/#{id}/attachments"].get)
79
79
  end
80
80
 
81
81
  # DELETE /{resourceType}/{id}/attachments/{name}
82
82
  def delete_study_attachment(id, name)
83
- objectify(base_uri["studies/#{id}/attachments/#{name}"].delete)
83
+ handle_response(base_uri["studies/#{id}/attachments/#{name}"].delete)
84
84
  end
85
85
 
86
86
  # PUT /{resourceType}/{id}/attachments/{name}
87
87
  def study_attachment(id, name, payload = {})
88
- objectify(base_uri["studies/#{id}/attachments/#{name}"].put(payload))
88
+ handle_response(base_uri["studies/#{id}/attachments/#{name}"].put(payload))
89
89
  end
90
90
 
91
91
  # GET /{resourceType}/{id}/attachments/{name}/compressed-data
92
92
  def study_attachment_compressed_data(id, name)
93
- objectify(base_uri["studies/#{id}/attachments/#{name}/compressed-data"].get)
93
+ handle_response(base_uri["studies/#{id}/attachments/#{name}/compressed-data"].get)
94
94
  end
95
95
 
96
96
  # GET /{resourceType}/{id}/attachments/{name}/compressed-md5
97
97
  def study_attachment_compressed_md5(id, name)
98
- objectify(base_uri["studies/#{id}/attachments/#{name}/compressed-md5"].get)
98
+ handle_response(base_uri["studies/#{id}/attachments/#{name}/compressed-md5"].get)
99
99
  end
100
100
 
101
101
  # GET /{resourceType}/{id}/attachments/{name}/compressed-size
102
102
  def study_attachment_compressed_size(id, name)
103
- objectify(base_uri["studies/#{id}/attachments/#{name}/compressed-size"].get)
103
+ handle_response(base_uri["studies/#{id}/attachments/#{name}/compressed-size"].get)
104
104
  end
105
105
 
106
106
  # GET /{resourceType}/{id}/attachments/{name}/data
107
107
  def study_attachment_data(id, name)
108
- objectify(base_uri["studies/#{id}/attachments/#{name}/data"].get)
108
+ handle_response(base_uri["studies/#{id}/attachments/#{name}/data"].get)
109
109
  end
110
110
 
111
111
  # GET /{resourceType}/{id}/attachments/{name}/md5
112
112
  def study_attachment_md5(id, name)
113
- objectify(base_uri["studies/#{id}/attachments/#{name}/md5"].get)
113
+ handle_response(base_uri["studies/#{id}/attachments/#{name}/md5"].get)
114
114
  end
115
115
 
116
116
  # GET /{resourceType}/{id}/attachments/{name}/size
117
117
  def study_attachment_size(id, name)
118
- objectify(base_uri["studies/#{id}/attachments/#{name}/size"].get)
118
+ handle_response(base_uri["studies/#{id}/attachments/#{name}/size"].get)
119
119
  end
120
120
 
121
121
  # POST /{resourceType}/{id}/attachments/{name}/verify-md5
122
122
  def study_attachment_verify_md5(id, name)
123
- objectify(base_uri["studies/#{id}/attachments/#{name}/verify-md5"].get)
123
+ handle_response(base_uri["studies/#{id}/attachments/#{name}/verify-md5"].get)
124
124
  end
125
125
 
126
126
  # GET /{resourceType}/{id}/metadata
127
127
  def study_all_metadata(id)
128
- objectify(base_uri["studies/#{id}/metadata"].get)
128
+ handle_response(base_uri["studies/#{id}/metadata"].get)
129
129
  end
130
130
 
131
131
  # GET /{resourceType}/{id}/metadata/{name}
132
132
  def study_metadata(id, name)
133
- objectify(base_uri["studies/#{id}/metadata/#{name}"].get)
133
+ handle_response(base_uri["studies/#{id}/metadata/#{name}"].get)
134
134
  end
135
135
 
136
136
  # DELETE /{resourceType}/{id}/metadata/{name}
137
137
  def study_delete_metadata(id, name)
138
- objectify(base_uri["studies/#{id}/metadata/#{name}"].delete)
138
+ handle_response(base_uri["studies/#{id}/metadata/#{name}"].delete)
139
139
  end
140
140
 
141
141
  # PUT /{resourceType}/{id}/metadata/{name}
142
142
  def study_update_metadata(id, name, payload = {})
143
- objectify(base_uri["studies/#{id}/metadata/#{name}"].put(payload))
143
+ handle_response(base_uri["studies/#{id}/metadata/#{name}"].put(payload))
144
144
  end
145
-
145
+
146
146
  end
147
- end
147
+ end
@@ -4,7 +4,7 @@ module Orthanc
4
4
 
5
5
  # POST /tools/create-dicom
6
6
  def tools_create_dicom(payload = {}) # Create and store a new DICOM instance (experimental)
7
- objectify(base_uri["tools/create-dicom"].post(payload))
7
+ handle_response(base_uri["tools/create-dicom"].post(payload))
8
8
  end
9
9
 
10
10
  # GET /tools/dicom-conformance
@@ -14,17 +14,17 @@ module Orthanc
14
14
 
15
15
  # POST /tools/execute-script
16
16
  def tools_execute_script(payload = {}) # Execute the Lua script in the POST body (experimental)
17
- objectify(base_uri["tools/execute-script"].post(payload))
17
+ handle_response(base_uri["tools/execute-script"].post(payload))
18
18
  end
19
19
 
20
20
  # GET /tools/generate-uid
21
21
  def tools_generate_uid(level) # "level" argument among "patient", "study", "series" and "instance"
22
- objectify(base_uri["tools/generate-uid"].get({params: {level: level}}))
22
+ handle_response(base_uri["tools/generate-uid"].get({params: {level: level}}))
23
23
  end
24
24
 
25
25
  # POST /tools/lookup
26
26
  def tools_lookup(payload = {}) # Map DICOM UIDs to Orthanc identifiers
27
- objectify(base_uri["tools/lookup"].post(payload))
27
+ handle_response(base_uri["tools/lookup"].post(payload))
28
28
  end
29
29
 
30
30
  # GET /tools/now
@@ -34,8 +34,8 @@ module Orthanc
34
34
 
35
35
  # POST /tools/reset
36
36
  def tools_reset(payload = {}) # Hot restart of Orthanc, the configuration file will be read again
37
- objectify(base_uri["tools/reset"].post(payload))
37
+ handle_response(base_uri["tools/reset"].post(payload))
38
38
  end
39
39
 
40
40
  end
41
- end
41
+ end
@@ -1,3 +1,3 @@
1
1
  module Orthanc
2
- VERSION = "0.1.0"
2
+ VERSION = "0.1.1"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: orthanc
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Simon Rascovsky
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2015-04-16 00:00:00.000000000 Z
11
+ date: 2015-04-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler