Method: DICOM::DClient#find_patients

Defined in:
lib/dicom/d_client.rb

#find_patients(query_params = {}) ⇒ Object

Note:

Caution: Calling this method without parameters will instruct your PACS to return info on ALL patients in the database!

Queries a service class provider for patients that match the specified criteria.

Instance level attributes for this query:

  • ‘0008,0052’ (Query/Retrieve Level)

  • ‘0010,0010’ (Patient’s Name)

  • ‘0010,0020’ (Patient ID)

  • ‘0010,0030’ (Patient’s Birth Date)

  • ‘0010,0040’ (Patient’s Sex)

In addition to the above listed attributes, a number of “optional” attributes may be specified. For a general list of optional object instance level attributes, please refer to the DICOM standard, PS3.4 C.6.1.1.2, Table C.6-1.

Examples:

Find all patients matching the given name

node.find_patients('0010,0010' => 'James*')

Parameters:

  • query_params (Hash) (defaults to: {})

    the query parameters to use

Options Hash (query_params):

  • 'GGGG,EEEE' (String)

    a tag and value pair to be used in the query



137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
# File 'lib/dicom/d_client.rb', line 137

def find_patients(query_params={})
  # Patient Root Query/Retrieve Information Model - FIND:

  set_default_presentation_context("1.2.840.10008.5.1.4.1.2.1.1")
  # Every query attribute with a value != nil (required) will be sent in the dicom query.

  # The query parameters with nil-value (optional) are left out unless specified.

  default_query_params = {
    "0008,0052" => "PATIENT", # Query/Retrieve Level: "PATIENT"

    "0010,0010" => "", # Patient's Name

    "0010,0020" => "" # Patient's ID

  }
  # Raising an error if a non-tag query attribute is used:

  query_params.keys.each do |tag|
    raise ArgumentError, "The supplied tag (#{tag}) is not valid. It must be a string of the form 'GGGG,EEEE'." unless tag.is_a?(String) && tag.tag?
  end
  # Set up the query parameters and carry out the C-FIND:

  set_data_elements(default_query_params.merge(query_params))
  perform_find
  return @data_results
end