Class: Orthanc::Tool

Inherits:
Object
  • Object
show all
Includes:
Response
Defined in:
lib/orthanc/tools.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Response

#bool_to_num, #handle_response, #num_to_bool

Constructor Details

#initialize(id = nil) ⇒ Tool

Returns a new instance of Tool.



6
7
8
9
# File 'lib/orthanc/tools.rb', line 6

def initialize(id = nil)
  client = Client.new
  self.base_uri = client.base_uri["tools"]
end

Instance Attribute Details

#base_uriObject

Returns the value of attribute base_uri.



4
5
6
# File 'lib/orthanc/tools.rb', line 4

def base_uri
  @base_uri
end

Instance Method Details

#create_dicom(payload = {}) ⇒ Object

POST /tools/create-dicom



12
13
14
# File 'lib/orthanc/tools.rb', line 12

def create_dicom(payload = {}) # Create and store a new DICOM instance (experimental)
  handle_response(base_uri["create-dicom"].post(payload))
end

#dicom_conformanceObject

GET /tools/dicom-conformance



17
18
19
# File 'lib/orthanc/tools.rb', line 17

def dicom_conformance # DICOM conformance statement of this version of Orthanc
  base_uri["dicom-conformance"].get
end

#execute_script(payload = {}) ⇒ Object

POST /tools/execute-script



22
23
24
# File 'lib/orthanc/tools.rb', line 22

def execute_script(payload = {}) # Execute the Lua script in the POST body (experimental)
  handle_response(base_uri["execute-script"].post(payload))
end

#generate_uid(level) ⇒ Object

GET /tools/generate-uid



27
28
29
# File 'lib/orthanc/tools.rb', line 27

def generate_uid(level) # "level" argument among "patient", "study", "series" and "instance"
  handle_response(base_uri["generate-uid"].get({params: {level: level}}))
end

#lookup(payload = {}) ⇒ Object

POST /tools/lookup



32
33
34
# File 'lib/orthanc/tools.rb', line 32

def lookup(payload = {}) # Map DICOM UIDs to Orthanc identifiers
  handle_response(base_uri["lookup"].post(payload))
end

#nowObject

GET /tools/now



37
38
39
# File 'lib/orthanc/tools.rb', line 37

def now # Returns the current datetime in the ISO 8601 format
  base_uri["now"].get
end

#reset(payload = {}) ⇒ Object

POST /tools/reset



42
43
44
# File 'lib/orthanc/tools.rb', line 42

def reset(payload = {}) # Hot restart of Orthanc, the configuration file will be read again
  handle_response(base_uri["reset"].post(payload))
end