class Orthanc::Instance

Attributes

base_uri[RW]

Public Class Methods

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

Public Instance Methods

anonymize(payload = {}) click to toggle source

POST /instances/{id}/anonymize

# File lib/orthanc/instances.rb, line 22
def anonymize(payload = {}) # https://code.google.com/p/orthanc/wiki/Anonymization
  base_uri["anonymize"].post(payload.to_s)
end
attachments(id = nil) click to toggle source
# File lib/orthanc/instances.rb, line 154
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/instances.rb, line 150
def attachments_list # Orthanc endpoint response
  handle_response(base_uri["attachments"].get)
end
content() click to toggle source

GET /instances/{id}/content/

# File lib/orthanc/instances.rb, line 27
def content # List the first-level DICOM tags
  handle_response(base_uri["frames"].get)
end
content_sequence(group, element, index) click to toggle source

GET /instances/{id}/content/{group}-{element}/{index}/…

# File lib/orthanc/instances.rb, line 37
def content_sequence(group, element, index) # Raw access to the content of DICOM sequences
  handle_response(base_uri["content/#{group}-#{element}/#{index}"].get)
end
content_tag(group, element) click to toggle source

GET /instances/{id}/content/{group}-{element}

# File lib/orthanc/instances.rb, line 32
def content_tag(group, element) # Raw access to the value of DICOM tags (comprising the padding character)
  handle_response(base_uri["content/#{group}-#{element}"].get)
end
delete() click to toggle source

DELETE /instances/{id}

# File lib/orthanc/instances.rb, line 17
def delete
  handle_response(base_uri.delete)
end
export(payload = {}) click to toggle source

POST /instances/{id}/export

# File lib/orthanc/instances.rb, line 42
def export(payload = {}) # Write the DICOM file in the filesystem where Orthanc is running
  base_uri["export"].post(payload)
end
fetch() click to toggle source

GET /instances, # GET /instances/{id}

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

GET /instances/{id}/file

# File lib/orthanc/instances.rb, line 47
def file
  base_uri["file"].get
end
frame_image_int16(frame_number) click to toggle source

GET /instances/{id}/frames/{frameNumber}/image-int16

# File lib/orthanc/instances.rb, line 57
def frame_image_int16(frame_number) # Truncated image to the [-32768;32767] range
  base_uri["frames/#{frame_number}/image-int16"].get
end
frame_image_uint16(frame_number) click to toggle source

GET /instances/{id}/frames/{frameNumber}/image-uint16

# File lib/orthanc/instances.rb, line 62
def frame_image_uint16(frame_number) # Truncated image to the [0;65535] range
  base_uri["frames/#{frame_number}/image-uint16"].get
end
frame_image_uint8(frame_number) click to toggle source

GET /instances/{id}/frames/{frameNumber}/image-uint8

# File lib/orthanc/instances.rb, line 67
def frame_image_uint8(frame_number) # Truncated image to the [0;255] range
  base_uri["frames/#{frame_number}/image-uint8"].get
end
frame_matlab(frame_number) click to toggle source

GET /instances/{id}/frames/{frameNumber}/matlab

# File lib/orthanc/instances.rb, line 72
def frame_matlab(frame_number) # a = eval(urlread('http://localhost:8042/instances/.../matlab'))
  base_uri["frames/#{frame_number}/matlab"].get
end
frames() click to toggle source

GET /instances/{id}/frames

# File lib/orthanc/instances.rb, line 52
def frames # Instance frames array
  handle_response(base_uri["frames"].get)
end
image_int16() click to toggle source

GET /instances/{id}/image-int16

# File lib/orthanc/instances.rb, line 82
def image_int16 # Truncated image to the [-32768;32767] range
  base_uri["image-int16"].get
end
image_uint16() click to toggle source

GET /instances/{id}/image-uint16

# File lib/orthanc/instances.rb, line 87
def image_uint16 # Truncated image to the [0;65535] range
  base_uri["image-uint16"].get
end
image_uint8() click to toggle source

GET /instances/{id}/image-uint8

# File lib/orthanc/instances.rb, line 92
def image_uint8 # Truncated image to the [0;255] range
  base_uri["image-uint8"].get
end
matlab() click to toggle source

GET /instances/{id}/matlab

# File lib/orthanc/instances.rb, line 97
def matlab # a = eval(urlread('http://localhost:8042/instances/.../matlab'))
  base_uri["matlab"].get
end
metadata(name = nil) click to toggle source
# File lib/orthanc/instances.rb, line 173
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/instances.rb, line 169
def metadata_list # Orthanc endpoint response
  handle_response(base_uri["metadata"].get)
end
modify(payload = {}) click to toggle source

POST /instances/{id}/modify

# File lib/orthanc/instances.rb, line 102
def modify(payload = {}) # https://code.google.com/p/orthanc/wiki/Anonymization
  base_uri["modify"].post(payload.to_s)
end
module() click to toggle source

GET /instances/{id}/module

# File lib/orthanc/instances.rb, line 107
def module
  handle_response(base_uri["module"].get)
end
patient() click to toggle source

GET /instances/{id}/patient

# File lib/orthanc/instances.rb, line 112
def patient
  handle_response(base_uri["patient"].get)
end
preview(frame_number) click to toggle source

GET /instances/{id}/frames/{frameNumber}/preview

# File lib/orthanc/instances.rb, line 77
def preview(frame_number) # Rescaled image (so that all the range [0;255] is used)
  base_uri["frames/#{frame_number}/preview"].get
end
series() click to toggle source

GET /instances/{id}/series

# File lib/orthanc/instances.rb, line 122
def series
  handle_response(base_uri["series"].get)
end
simplified_tags(params = {}) click to toggle source

GET /instances/{id}/simplified-tags

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

GET /instances/{id}/statistics

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

GET /instances/{id}/study

# File lib/orthanc/instances.rb, line 137
def study
  handle_response(base_uri["study"].get)
end
tags(params = {}) click to toggle source

GET /instances/{id}/tags

# File lib/orthanc/instances.rb, line 142
def tags(params = {}) # TODO: "?simplify" argument to simplify output (same as "simplified-tags")
  handle_response(base_uri["tags"].get({params: params}))
end