Class: Orthanc::Patient
- Inherits:
-
Object
- Object
- Orthanc::Patient
- Includes:
- Response
- Defined in:
- lib/orthanc/patients.rb
Instance Attribute Summary collapse
-
#base_uri ⇒ Object
Returns the value of attribute base_uri.
Instance Method Summary collapse
-
#anonymize(payload = {}) ⇒ Object
POST /patients/id/anonymize.
-
#archive ⇒ Object
GET /patients/id/archive.
- #attachments(id = nil) ⇒ Object
-
#attachments_list ⇒ Object
GET /resourceType/id/attachments.
-
#delete ⇒ Object
DELETE /patients/id.
-
#fetch ⇒ Object
GET /patients, # GET /patients/id.
-
#initialize(id = nil) ⇒ Patient
constructor
A new instance of Patient.
-
#instances ⇒ Object
GET /patients/id/instances.
-
#media ⇒ Object
GET /patients/id/media.
-
#metadata(name = nil) ⇒ Object
As class instances, for method chaining.
-
#metadata_list ⇒ Object
GET /resourceType/id/metadata.
-
#modify(payload = {}) ⇒ Object
POST /patients/id/modify.
-
#module ⇒ Object
GET /patients/id/module.
-
#protected(boolstatus = true) ⇒ Object
PUT /patients/id/protected.
-
#protected? ⇒ Boolean
GET /patients/id/protected.
-
#series ⇒ Object
GET /patients/id/series.
-
#shared_tags(params = {}) ⇒ Object
GET /patients/id/shared-tags.
-
#statistics ⇒ Object
GET /patients/id/statistics.
-
#studies ⇒ Object
GET /patients/id/studies.
Methods included from Response
#bool_to_num, #handle_response, #num_to_bool
Constructor Details
#initialize(id = nil) ⇒ Patient
Returns a new instance of Patient.
6 7 8 9 |
# File 'lib/orthanc/patients.rb', line 6 def initialize(id = nil) client = Client.new self.base_uri = client.base_uri["/patients/#{id}"] end |
Instance Attribute Details
#base_uri ⇒ Object
Returns the value of attribute base_uri.
4 5 6 |
# File 'lib/orthanc/patients.rb', line 4 def base_uri @base_uri end |
Instance Method Details
#anonymize(payload = {}) ⇒ Object
POST /patients/id/anonymize
22 23 24 |
# File 'lib/orthanc/patients.rb', line 22 def anonymize(payload = {}) # https://code.google.com/p/orthanc/wiki/Anonymization handle_response(base_uri["anonymize"].post(payload.to_s)) end |
#archive ⇒ Object
GET /patients/id/archive
27 28 29 |
# File 'lib/orthanc/patients.rb', line 27 def archive # Create ZIP base_uri["archive"].get # CAREFUL! Returns the whole zipfile end |
#attachments(id = nil) ⇒ Object
91 92 93 94 95 96 97 98 99 100 101 |
# File 'lib/orthanc/patients.rb', line 91 def (id = nil) if id return Attachment.new(base_uri, id) else a = [] handle_response(base_uri["attachments"].get).each do |id| a << Attachment.new(base_uri, id) end return a end end |
#attachments_list ⇒ Object
GET /resourceType/id/attachments
87 88 89 |
# File 'lib/orthanc/patients.rb', line 87 def # Orthanc endpoint response handle_response(base_uri["attachments"].get) end |
#delete ⇒ Object
DELETE /patients/id
17 18 19 |
# File 'lib/orthanc/patients.rb', line 17 def delete handle_response(base_uri.delete) end |
#fetch ⇒ Object
GET /patients, # GET /patients/id
12 13 14 |
# File 'lib/orthanc/patients.rb', line 12 def fetch # Fetch API response handle_response(base_uri.get) end |
#instances ⇒ Object
GET /patients/id/instances
32 33 34 |
# File 'lib/orthanc/patients.rb', line 32 def instances # Retrieve all the instances of this patient in a single REST call handle_response(base_uri["instances"].get) end |
#media ⇒ Object
GET /patients/id/media
37 38 39 |
# File 'lib/orthanc/patients.rb', line 37 def media # Create a ZIP archive for media storage with DICOMDIR base_uri["media"].get # CAREFUL! Returns the whole zipfile end |
#metadata(name = nil) ⇒ Object
As class instances, for method chaining
110 111 112 113 114 115 116 117 118 119 120 |
# File 'lib/orthanc/patients.rb', line 110 def (name = nil) # As class instances, for method chaining if name return Metadata.new(base_uri, name) else a = [] handle_response(base_uri["metadata"].get).each do |name| a << Metadata.new(base_uri, name) end return a end end |
#metadata_list ⇒ Object
GET /resourceType/id/metadata
106 107 108 |
# File 'lib/orthanc/patients.rb', line 106 def # Orthanc endpoint response handle_response(base_uri["metadata"].get) end |
#modify(payload = {}) ⇒ Object
POST /patients/id/modify
42 43 44 |
# File 'lib/orthanc/patients.rb', line 42 def modify(payload = {}) # https://code.google.com/p/orthanc/wiki/Anonymization handle_response(base_uri["modify"].post(payload.to_s)) end |
#module ⇒ Object
GET /patients/id/module
47 48 49 |
# File 'lib/orthanc/patients.rb', line 47 def module handle_response(base_uri["module"].get) end |
#protected(boolstatus = true) ⇒ Object
PUT /patients/id/protected
57 58 59 60 61 |
# File 'lib/orthanc/patients.rb', line 57 def protected(boolstatus = true) # Protection against recycling: "0" means unprotected, "1" protected status = bool_to_num(boolstatus) base_uri["protected"].put("#{status}") return nil # API returns "" end |
#protected? ⇒ Boolean
GET /patients/id/protected
52 53 54 |
# File 'lib/orthanc/patients.rb', line 52 def protected? # Protection against recycling: "0" means unprotected, "1" protected num_to_bool(base_uri["protected"].get) end |
#series ⇒ Object
GET /patients/id/series
64 65 66 |
# File 'lib/orthanc/patients.rb', line 64 def series # Retrieve all the series of this patient in a single REST call handle_response(base_uri["series"].get) end |
#shared_tags(params = {}) ⇒ Object
GET /patients/id/shared-tags
69 70 71 |
# File 'lib/orthanc/patients.rb', line 69 def (params = {}) # "?simplify" argument to simplify output handle_response(base_uri["shared-tags"].get({params: params})) end |
#statistics ⇒ Object
GET /patients/id/statistics
74 75 76 |
# File 'lib/orthanc/patients.rb', line 74 def statistics handle_response(base_uri["statistics"].get) end |
#studies ⇒ Object
GET /patients/id/studies
79 80 81 |
# File 'lib/orthanc/patients.rb', line 79 def studies # Retrieve all the studies of this patient in a single REST call handle_response(base_uri["studies"].get) end |