Class: Orthanc::Modality
- Inherits:
-
Object
- Object
- Orthanc::Modality
- Includes:
- Response
- Defined in:
- lib/orthanc/modalities.rb
Instance Attribute Summary collapse
-
#base_uri ⇒ Object
Returns the value of attribute base_uri.
Instance Method Summary collapse
-
#delete ⇒ Object
DELETE /modalities/id.
-
#echo(payload = {}) ⇒ Object
POST /modalities/dicom/echo.
-
#fetch ⇒ Object
GET /modalities, # GET /modalities/id.
-
#find(payload = {}) ⇒ Object
POST /modalities/dicom/find.
-
#find_patient(payload = {}) ⇒ Object
POST /modalities/dicom/find-patient.
-
#find_series(payload = {}) ⇒ Object
POST /modalities/dicom/find-series.
-
#find_study(payload = {}) ⇒ Object
POST /modalities/dicom/find-study.
-
#initialize(id = nil) ⇒ Modality
constructor
A new instance of Modality.
-
#modify(payload = {}) ⇒ Object
PUT /modalities/dicom.
-
#store(payload = {}) ⇒ Object
POST /modalities/dicom/store.
Methods included from Response
#bool_to_num, #handle_response, #num_to_bool
Constructor Details
Instance Attribute Details
#base_uri ⇒ Object
Returns the value of attribute base_uri.
4 5 6 |
# File 'lib/orthanc/modalities.rb', line 4 def base_uri @base_uri end |
Instance Method Details
#delete ⇒ Object
DELETE /modalities/id
17 18 19 |
# File 'lib/orthanc/modalities.rb', line 17 def delete handle_response(base_uri.delete) end |
#echo(payload = {}) ⇒ Object
POST /modalities/dicom/echo
27 28 29 30 31 32 33 34 35 |
# File 'lib/orthanc/modalities.rb', line 27 def echo(payload = {}) # C-Echo SCU. Return true if successful base_uri["echo"].post(payload){|response, request, result, &block| if response.code == 200 return true else return false end } end |
#fetch ⇒ Object
GET /modalities, # GET /modalities/id
12 13 14 |
# File 'lib/orthanc/modalities.rb', line 12 def fetch # Fetch API response handle_response(base_uri.get) end |
#find(payload = {}) ⇒ Object
POST /modalities/dicom/find
38 39 40 41 42 43 44 45 46 |
# File 'lib/orthanc/modalities.rb', line 38 def find(payload = {}) # C-Echo SCU. Return true if successful base_uri["find"].post(payload){|response, request, result, &block| if response.code == 200 return handle_response(response) else return false end } end |
#find_patient(payload = {}) ⇒ Object
POST /modalities/dicom/find-patient
49 50 51 52 53 54 55 56 57 |
# File 'lib/orthanc/modalities.rb', line 49 def find_patient(payload = {}) # eg. '{"PatientName":"JOD*","PatientSex":"M"}' base_uri["find-patient"].post(payload){|response, request, result, &block| if response.code == 200 return handle_response(response) else return false end } end |
#find_series(payload = {}) ⇒ Object
POST /modalities/dicom/find-series
60 61 62 63 64 65 66 67 68 |
# File 'lib/orthanc/modalities.rb', line 60 def find_series(payload = {}) # eg. '{"PatientID":"0555643F"}' base_uri["find-series"].post(payload){|response, request, result, &block| if response.code == 200 return handle_response(response) else return false end } end |
#find_study(payload = {}) ⇒ Object
POST /modalities/dicom/find-study
71 72 73 74 75 76 77 78 79 |
# File 'lib/orthanc/modalities.rb', line 71 def find_study(payload = {}) # eg. '{"PatientID":"0555643F","StudyInstanceUID":"1.2.840.113704.1.111.2768.1239195678.57"}' base_uri["find-study"].post(payload){|response, request, result, &block| if response.code == 200 return handle_response(response) else return false end } end |
#modify(payload = {}) ⇒ Object
PUT /modalities/dicom
22 23 24 |
# File 'lib/orthanc/modalities.rb', line 22 def modify(payload = {}) handle_response(base_uri["modalities/#{dicom}"].put(payload)) end |
#store(payload = {}) ⇒ Object
POST /modalities/dicom/store
82 83 84 85 86 87 88 89 90 |
# File 'lib/orthanc/modalities.rb', line 82 def store(payload = {}) # POST body = UUID series, UUID instance, or raw DICOM file base_uri["store"].post(payload){|response, request, result, &block| if response.code == 200 return true else return false end } end |