class Orthanc::Patient

Attributes

base_uri[RW]

Public Class Methods

new(id = nil) click to toggle source
# File lib/orthanc/patients.rb, line 6
def initialize(id = nil)
  client = Client.new
  self.base_uri = client.base_uri["/patients/#{id}"]
end

Public Instance Methods

anonymize(payload = {}) click to toggle source

POST /patients/{id}/anonymize

# 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() click to toggle source

GET /patients/{id}/archive

# File lib/orthanc/patients.rb, line 27
def archive # Create ZIP
  base_uri["archive"].get # CAREFUL! Returns the whole zipfile
end
attachments(id = nil) click to toggle source
# File lib/orthanc/patients.rb, line 91
def attachments(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() click to toggle source

GET /{resourceType}/{id}/attachments

# File lib/orthanc/patients.rb, line 87
def attachments_list # Orthanc endpoint response
  handle_response(base_uri["attachments"].get)
end
delete() click to toggle source

DELETE /patients/{id}

# File lib/orthanc/patients.rb, line 17
def delete
  handle_response(base_uri.delete)
end
fetch() click to toggle source

GET /patients, # GET /patients/{id}

# File lib/orthanc/patients.rb, line 12
def fetch # Fetch API response
  handle_response(base_uri.get)
end
instances() click to toggle source

GET /patients/{id}/instances

# 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() click to toggle source

GET /patients/{id}/media

# 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) click to toggle source
# File lib/orthanc/patients.rb, line 110
def metadata(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() click to toggle source

GET /{resourceType}/{id}/metadata

# File lib/orthanc/patients.rb, line 106
def metadata_list # Orthanc endpoint response
  handle_response(base_uri["metadata"].get)
end
modify(payload = {}) click to toggle source

POST /patients/{id}/modify

# 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() click to toggle source

GET /patients/{id}/module

# File lib/orthanc/patients.rb, line 47
def module
  handle_response(base_uri["module"].get)
end
protected(boolstatus = true) click to toggle source

PUT /patients/{id}/protected

# 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?() click to toggle source

GET /patients/{id}/protected

# 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() click to toggle source

GET /patients/{id}/series

# 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 = {}) click to toggle source

GET /patients/{id}/shared-tags

# File lib/orthanc/patients.rb, line 69
def shared_tags(params = {}) # "?simplify" argument to simplify output
  handle_response(base_uri["shared-tags"].get({params: params}))
end
statistics() click to toggle source

GET /patients/{id}/statistics

# File lib/orthanc/patients.rb, line 74
def statistics
  handle_response(base_uri["statistics"].get)
end
studies() click to toggle source

GET /patients/{id}/studies

# 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