id
int32
0
24.9k
repo
stringlengths
5
58
path
stringlengths
9
168
func_name
stringlengths
9
130
original_string
stringlengths
66
10.5k
language
stringclasses
1 value
code
stringlengths
66
10.5k
code_tokens
list
docstring
stringlengths
8
16k
docstring_tokens
list
sha
stringlengths
40
40
url
stringlengths
94
266
22,300
dicom/ruby-dicom
lib/dicom/anonymizer.rb
DICOM.Anonymizer.anonymize
def anonymize(dicom) dicom = Array[dicom] unless dicom.respond_to?(:to_ary) if @tags.length > 0 prepare_anonymization dicom.each do |dcm| anonymize_dcm(dcm.to_dcm) end else logger.warn("No tags have been selected for anonymization. Aborting anonymization.") ...
ruby
def anonymize(dicom) dicom = Array[dicom] unless dicom.respond_to?(:to_ary) if @tags.length > 0 prepare_anonymization dicom.each do |dcm| anonymize_dcm(dcm.to_dcm) end else logger.warn("No tags have been selected for anonymization. Aborting anonymization.") ...
[ "def", "anonymize", "(", "dicom", ")", "dicom", "=", "Array", "[", "dicom", "]", "unless", "dicom", ".", "respond_to?", "(", ":to_ary", ")", "if", "@tags", ".", "length", ">", "0", "prepare_anonymization", "dicom", ".", "each", "do", "|", "dcm", "|", "...
Anonymizes the given DObject or array of DICOM objects with the settings of this Anonymizer instance. @param [DObject, Array<DObject>] dicom single or multiple DICOM objects @return [Array<DObject>] an array of the anonymized DICOM objects
[ "Anonymizes", "the", "given", "DObject", "or", "array", "of", "DICOM", "objects", "with", "the", "settings", "of", "this", "Anonymizer", "instance", "." ]
3ffcfe21edc8dcd31298f945781990789fc832ab
https://github.com/dicom/ruby-dicom/blob/3ffcfe21edc8dcd31298f945781990789fc832ab/lib/dicom/anonymizer.rb#L141-L155
22,301
dicom/ruby-dicom
lib/dicom/anonymizer.rb
DICOM.Anonymizer.delete_tag
def delete_tag(tag) raise ArgumentError, "Expected String, got #{tag.class}." unless tag.is_a?(String) raise ArgumentError, "Expected a valid tag of format 'GGGG,EEEE', got #{tag}." unless tag.tag? @delete[tag] = true end
ruby
def delete_tag(tag) raise ArgumentError, "Expected String, got #{tag.class}." unless tag.is_a?(String) raise ArgumentError, "Expected a valid tag of format 'GGGG,EEEE', got #{tag}." unless tag.tag? @delete[tag] = true end
[ "def", "delete_tag", "(", "tag", ")", "raise", "ArgumentError", ",", "\"Expected String, got #{tag.class}.\"", "unless", "tag", ".", "is_a?", "(", "String", ")", "raise", "ArgumentError", ",", "\"Expected a valid tag of format 'GGGG,EEEE', got #{tag}.\"", "unless", "tag", ...
Specifies that the given tag is to be completely deleted from the anonymized DICOM objects. @param [String] tag a data element tag @example Completely delete the Patient's Name tag from the DICOM files a.delete_tag('0010,0010')
[ "Specifies", "that", "the", "given", "tag", "is", "to", "be", "completely", "deleted", "from", "the", "anonymized", "DICOM", "objects", "." ]
3ffcfe21edc8dcd31298f945781990789fc832ab
https://github.com/dicom/ruby-dicom/blob/3ffcfe21edc8dcd31298f945781990789fc832ab/lib/dicom/anonymizer.rb#L186-L190
22,302
dicom/ruby-dicom
lib/dicom/anonymizer.rb
DICOM.Anonymizer.set_tag
def set_tag(tag, options={}) raise ArgumentError, "Expected String, got #{tag.class}." unless tag.is_a?(String) raise ArgumentError, "Expected a valid tag of format 'GGGG,EEEE', got #{tag}." unless tag.tag? pos = @tags.index(tag) if pos # Update existing values: @values[pos] = op...
ruby
def set_tag(tag, options={}) raise ArgumentError, "Expected String, got #{tag.class}." unless tag.is_a?(String) raise ArgumentError, "Expected a valid tag of format 'GGGG,EEEE', got #{tag}." unless tag.tag? pos = @tags.index(tag) if pos # Update existing values: @values[pos] = op...
[ "def", "set_tag", "(", "tag", ",", "options", "=", "{", "}", ")", "raise", "ArgumentError", ",", "\"Expected String, got #{tag.class}.\"", "unless", "tag", ".", "is_a?", "(", "String", ")", "raise", "ArgumentError", ",", "\"Expected a valid tag of format 'GGGG,EEEE', ...
Sets the anonymization settings for the specified tag. If the tag is already present in the list of tags to be anonymized, its settings are updated, and if not, a new tag entry is created. @param [String] tag a data element tag @param [Hash] options the anonymization settings for the specified tag @option options ...
[ "Sets", "the", "anonymization", "settings", "for", "the", "specified", "tag", ".", "If", "the", "tag", "is", "already", "present", "in", "the", "list", "of", "tags", "to", "be", "anonymized", "its", "settings", "are", "updated", "and", "if", "not", "a", ...
3ffcfe21edc8dcd31298f945781990789fc832ab
https://github.com/dicom/ruby-dicom/blob/3ffcfe21edc8dcd31298f945781990789fc832ab/lib/dicom/anonymizer.rb#L246-L260
22,303
dicom/ruby-dicom
lib/dicom/anonymizer.rb
DICOM.Anonymizer.value
def value(tag) raise ArgumentError, "Expected String, got #{tag.class}." unless tag.is_a?(String) raise ArgumentError, "Expected a valid tag of format 'GGGG,EEEE', got #{tag}." unless tag.tag? pos = @tags.index(tag) if pos return @values[pos] else logger.warn("The specified...
ruby
def value(tag) raise ArgumentError, "Expected String, got #{tag.class}." unless tag.is_a?(String) raise ArgumentError, "Expected a valid tag of format 'GGGG,EEEE', got #{tag}." unless tag.tag? pos = @tags.index(tag) if pos return @values[pos] else logger.warn("The specified...
[ "def", "value", "(", "tag", ")", "raise", "ArgumentError", ",", "\"Expected String, got #{tag.class}.\"", "unless", "tag", ".", "is_a?", "(", "String", ")", "raise", "ArgumentError", ",", "\"Expected a valid tag of format 'GGGG,EEEE', got #{tag}.\"", "unless", "tag", ".",...
Gives the value which will be used when anonymizing this tag. @note If enumeration is selected for a string type tag, a number will be appended in addition to the string that is returned here. @param [String] tag a data element tag @return [String, Integer, Float, NilClass] the replacement value for the specifi...
[ "Gives", "the", "value", "which", "will", "be", "used", "when", "anonymizing", "this", "tag", "." ]
3ffcfe21edc8dcd31298f945781990789fc832ab
https://github.com/dicom/ruby-dicom/blob/3ffcfe21edc8dcd31298f945781990789fc832ab/lib/dicom/anonymizer.rb#L278-L288
22,304
dicom/ruby-dicom
lib/dicom/anonymizer.rb
DICOM.Anonymizer.anonymize_dcm
def anonymize_dcm(dcm) # Extract the data element parents to investigate: parents = element_parents(dcm) parents.each do |parent| # Anonymize the desired tags: @tags.each_index do |j| if parent.exists?(@tags[j]) element = parent[@tags[j]] if element.is...
ruby
def anonymize_dcm(dcm) # Extract the data element parents to investigate: parents = element_parents(dcm) parents.each do |parent| # Anonymize the desired tags: @tags.each_index do |j| if parent.exists?(@tags[j]) element = parent[@tags[j]] if element.is...
[ "def", "anonymize_dcm", "(", "dcm", ")", "# Extract the data element parents to investigate:", "parents", "=", "element_parents", "(", "dcm", ")", "parents", ".", "each", "do", "|", "parent", "|", "# Anonymize the desired tags:", "@tags", ".", "each_index", "do", "|",...
Performs anonymization on a DICOM object. @param [DObject] dcm a DICOM object
[ "Performs", "anonymization", "on", "a", "DICOM", "object", "." ]
3ffcfe21edc8dcd31298f945781990789fc832ab
https://github.com/dicom/ruby-dicom/blob/3ffcfe21edc8dcd31298f945781990789fc832ab/lib/dicom/anonymizer.rb#L298-L347
22,305
dicom/ruby-dicom
lib/dicom/anonymizer.rb
DICOM.Anonymizer.anonymize_file
def anonymize_file(file) # Temporarily adjust the ruby-dicom log threshold (to suppress messages from the DObject class): @original_level = logger.level logger.level = @logger_level dcm = DObject.read(file) logger.level = @original_level anonymize_dcm(dcm) dcm end
ruby
def anonymize_file(file) # Temporarily adjust the ruby-dicom log threshold (to suppress messages from the DObject class): @original_level = logger.level logger.level = @logger_level dcm = DObject.read(file) logger.level = @original_level anonymize_dcm(dcm) dcm end
[ "def", "anonymize_file", "(", "file", ")", "# Temporarily adjust the ruby-dicom log threshold (to suppress messages from the DObject class):", "@original_level", "=", "logger", ".", "level", "logger", ".", "level", "=", "@logger_level", "dcm", "=", "DObject", ".", "read", "...
Performs anonymization of a DICOM file. @param [String] file a DICOM file path
[ "Performs", "anonymization", "of", "a", "DICOM", "file", "." ]
3ffcfe21edc8dcd31298f945781990789fc832ab
https://github.com/dicom/ruby-dicom/blob/3ffcfe21edc8dcd31298f945781990789fc832ab/lib/dicom/anonymizer.rb#L353-L361
22,306
dicom/ruby-dicom
lib/dicom/anonymizer.rb
DICOM.Anonymizer.default_value
def default_value(tag) name, vr = LIBRARY.name_and_vr(tag) conversion = VALUE_CONVERSION[vr] case conversion when :to_i then return 0 when :to_f then return 0.0 else # Assume type is string and return an empty string: return '' end end
ruby
def default_value(tag) name, vr = LIBRARY.name_and_vr(tag) conversion = VALUE_CONVERSION[vr] case conversion when :to_i then return 0 when :to_f then return 0.0 else # Assume type is string and return an empty string: return '' end end
[ "def", "default_value", "(", "tag", ")", "name", ",", "vr", "=", "LIBRARY", ".", "name_and_vr", "(", "tag", ")", "conversion", "=", "VALUE_CONVERSION", "[", "vr", "]", "case", "conversion", "when", ":to_i", "then", "return", "0", "when", ":to_f", "then", ...
Determines a default value to use for anonymizing the given tag. @param [String] tag a data element tag @return [String, Integer, Float] the default replacement value for a given tag
[ "Determines", "a", "default", "value", "to", "use", "for", "anonymizing", "the", "given", "tag", "." ]
3ffcfe21edc8dcd31298f945781990789fc832ab
https://github.com/dicom/ruby-dicom/blob/3ffcfe21edc8dcd31298f945781990789fc832ab/lib/dicom/anonymizer.rb#L387-L397
22,307
dicom/ruby-dicom
lib/dicom/anonymizer.rb
DICOM.Anonymizer.destination
def destination(dcm) # Separate the path from the source file string: file_start = dcm.source.rindex(File.basename(dcm.source)) if file_start == 0 source_dir = "." else source_dir = dcm.source[0..(file_start-1)] end source_folders = source_dir.split(File::SEPARATOR) ...
ruby
def destination(dcm) # Separate the path from the source file string: file_start = dcm.source.rindex(File.basename(dcm.source)) if file_start == 0 source_dir = "." else source_dir = dcm.source[0..(file_start-1)] end source_folders = source_dir.split(File::SEPARATOR) ...
[ "def", "destination", "(", "dcm", ")", "# Separate the path from the source file string:", "file_start", "=", "dcm", ".", "source", ".", "rindex", "(", "File", ".", "basename", "(", "dcm", ".", "source", ")", ")", "if", "file_start", "==", "0", "source_dir", "...
Creates a write path for the given DICOM object, based on the object's original file path and the write_path attribute. @param [DObject] dcm a DICOM object @return [String] the destination directory path
[ "Creates", "a", "write", "path", "for", "the", "given", "DICOM", "object", "based", "on", "the", "object", "s", "original", "file", "path", "and", "the", "write_path", "attribute", "." ]
3ffcfe21edc8dcd31298f945781990789fc832ab
https://github.com/dicom/ruby-dicom/blob/3ffcfe21edc8dcd31298f945781990789fc832ab/lib/dicom/anonymizer.rb#L405-L429
22,308
dicom/ruby-dicom
lib/dicom/anonymizer.rb
DICOM.Anonymizer.enumerated_value
def enumerated_value(original, j) # Is enumeration requested for this tag? if @enumerations[j] if @audit_trail # Check if the UID has been encountered already: replacement = @audit_trail.replacement(@tags[j], at_value(original)) unless replacement # This ori...
ruby
def enumerated_value(original, j) # Is enumeration requested for this tag? if @enumerations[j] if @audit_trail # Check if the UID has been encountered already: replacement = @audit_trail.replacement(@tags[j], at_value(original)) unless replacement # This ori...
[ "def", "enumerated_value", "(", "original", ",", "j", ")", "# Is enumeration requested for this tag?", "if", "@enumerations", "[", "j", "]", "if", "@audit_trail", "# Check if the UID has been encountered already:", "replacement", "=", "@audit_trail", ".", "replacement", "("...
Handles the enumeration for the given data element tag. If its value has been encountered before, its corresponding enumerated replacement value is retrieved, and if a new original value is encountered, a new enumerated replacement value is found by increasing an index by 1. @param [String, Integer, Float] origina...
[ "Handles", "the", "enumeration", "for", "the", "given", "data", "element", "tag", ".", "If", "its", "value", "has", "been", "encountered", "before", "its", "corresponding", "enumerated", "replacement", "value", "is", "retrieved", "and", "if", "a", "new", "orig...
3ffcfe21edc8dcd31298f945781990789fc832ab
https://github.com/dicom/ruby-dicom/blob/3ffcfe21edc8dcd31298f945781990789fc832ab/lib/dicom/anonymizer.rb#L477-L517
22,309
dicom/ruby-dicom
lib/dicom/anonymizer.rb
DICOM.Anonymizer.replace_uids
def replace_uids(parents) parents.each do |parent| parent.each_element do |element| if element.vr == ('UI') and !@static_uids[element.tag] original = element.value if original && original.length > 0 # We have a UID value, go ahead and replace it: ...
ruby
def replace_uids(parents) parents.each do |parent| parent.each_element do |element| if element.vr == ('UI') and !@static_uids[element.tag] original = element.value if original && original.length > 0 # We have a UID value, go ahead and replace it: ...
[ "def", "replace_uids", "(", "parents", ")", "parents", ".", "each", "do", "|", "parent", "|", "parent", ".", "each_element", "do", "|", "element", "|", "if", "element", ".", "vr", "==", "(", "'UI'", ")", "and", "!", "@static_uids", "[", "element", ".",...
Replaces the UIDs of the given DICOM object. @note Empty UIDs are ignored (we don't generate new UIDs for these). @note If AuditTrail is set, the relationship between old and new UIDs are preserved, and the relations between files in a study/series should remain valid. @param [Array<DObject, Item>] parents dicom...
[ "Replaces", "the", "UIDs", "of", "the", "given", "DICOM", "object", "." ]
3ffcfe21edc8dcd31298f945781990789fc832ab
https://github.com/dicom/ruby-dicom/blob/3ffcfe21edc8dcd31298f945781990789fc832ab/lib/dicom/anonymizer.rb#L550-L576
22,310
dicom/ruby-dicom
lib/dicom/anonymizer.rb
DICOM.Anonymizer.set_defaults
def set_defaults # Some UIDs should not be remapped even if uid anonymization has been requested: @static_uids = { # Private related: '0002,0100' => true, '0004,1432' => true, # Coding scheme related: '0008,010C' => true, '0008,010D' => true, # Transfe...
ruby
def set_defaults # Some UIDs should not be remapped even if uid anonymization has been requested: @static_uids = { # Private related: '0002,0100' => true, '0004,1432' => true, # Coding scheme related: '0008,010C' => true, '0008,010D' => true, # Transfe...
[ "def", "set_defaults", "# Some UIDs should not be remapped even if uid anonymization has been requested:", "@static_uids", "=", "{", "# Private related:", "'0002,0100'", "=>", "true", ",", "'0004,1432'", "=>", "true", ",", "# Coding scheme related:", "'0008,010C'", "=>", "true", ...
Sets up some default information variables that are used by the Anonymizer.
[ "Sets", "up", "some", "default", "information", "variables", "that", "are", "used", "by", "the", "Anonymizer", "." ]
3ffcfe21edc8dcd31298f945781990789fc832ab
https://github.com/dicom/ruby-dicom/blob/3ffcfe21edc8dcd31298f945781990789fc832ab/lib/dicom/anonymizer.rb#L580-L639
22,311
dicom/ruby-dicom
lib/dicom/anonymizer.rb
DICOM.Anonymizer.write
def write(dcm) if @write_path # The DICOM object is to be written to a separate directory. If the # original and the new directories have a common root, this is taken into # consideration when determining the object's write path: path = destination(dcm) if @random_file_name...
ruby
def write(dcm) if @write_path # The DICOM object is to be written to a separate directory. If the # original and the new directories have a common root, this is taken into # consideration when determining the object's write path: path = destination(dcm) if @random_file_name...
[ "def", "write", "(", "dcm", ")", "if", "@write_path", "# The DICOM object is to be written to a separate directory. If the", "# original and the new directories have a common root, this is taken into", "# consideration when determining the object's write path:", "path", "=", "destination", ...
Writes a DICOM object to file. @param [DObject] dcm a DICOM object
[ "Writes", "a", "DICOM", "object", "to", "file", "." ]
3ffcfe21edc8dcd31298f945781990789fc832ab
https://github.com/dicom/ruby-dicom/blob/3ffcfe21edc8dcd31298f945781990789fc832ab/lib/dicom/anonymizer.rb#L657-L673
22,312
dicom/ruby-dicom
lib/dicom/element.rb
DICOM.Element.value=
def value=(new_value) if VALUE_CONVERSION[@vr] == :to_s # Unless this is actually the Character Set data element, # get the character set (note that it may not be available): character_set = (@tag != '0008,0005' && top_parent.is_a?(DObject)) ? top_parent.value('0008,0005') : nil # ...
ruby
def value=(new_value) if VALUE_CONVERSION[@vr] == :to_s # Unless this is actually the Character Set data element, # get the character set (note that it may not be available): character_set = (@tag != '0008,0005' && top_parent.is_a?(DObject)) ? top_parent.value('0008,0005') : nil # ...
[ "def", "value", "=", "(", "new_value", ")", "if", "VALUE_CONVERSION", "[", "@vr", "]", "==", ":to_s", "# Unless this is actually the Character Set data element,", "# get the character set (note that it may not be available):", "character_set", "=", "(", "@tag", "!=", "'0008,0...
Sets the value of the Element instance. In addition to updating the value attribute, the specified value is encoded to binary and used to update the Element's bin and length attributes too. @note The specified value must be of a type that is compatible with the Element's value representation (vr). @param [String,...
[ "Sets", "the", "value", "of", "the", "Element", "instance", "." ]
3ffcfe21edc8dcd31298f945781990789fc832ab
https://github.com/dicom/ruby-dicom/blob/3ffcfe21edc8dcd31298f945781990789fc832ab/lib/dicom/element.rb#L231-L254
22,313
calabash/calabash
lib/calabash/ios/console_helpers.rb
Calabash.ConsoleHelpers.console_attach
def console_attach(uia_strategy=nil) Calabash::Application.default = Calabash::IOS::Application.default_from_environment identifier = Calabash::IOS::Device.default_identifier_for_application(Calabash::Application.default) server = Calabash::IOS::Server.default device = Calabash::IOS::Device.n...
ruby
def console_attach(uia_strategy=nil) Calabash::Application.default = Calabash::IOS::Application.default_from_environment identifier = Calabash::IOS::Device.default_identifier_for_application(Calabash::Application.default) server = Calabash::IOS::Server.default device = Calabash::IOS::Device.n...
[ "def", "console_attach", "(", "uia_strategy", "=", "nil", ")", "Calabash", "::", "Application", ".", "default", "=", "Calabash", "::", "IOS", "::", "Application", ".", "default_from_environment", "identifier", "=", "Calabash", "::", "IOS", "::", "Device", ".", ...
Attach the current Calabash run-loop to a console. @example You have encountered a failing cucumber Scenario. You open the console and want to start investigating the cause of the failure. Use > console_attach to connect to the current run-loop so you can perform gestures. @param [Symbol] uia_strategy ...
[ "Attach", "the", "current", "Calabash", "run", "-", "loop", "to", "a", "console", "." ]
fac1ce9fcff6e2460c6e72a9b89d93a91a1bc745
https://github.com/calabash/calabash/blob/fac1ce9fcff6e2460c6e72a9b89d93a91a1bc745/lib/calabash/ios/console_helpers.rb#L48-L71
22,314
calabash/calabash
lib/calabash/device.rb
Calabash.Device.pan_between
def pan_between(query_from, query_to, options={}) ensure_query_class_or_nil(query_from) ensure_query_class_or_nil(query_to) gesture_options = options.dup gesture_options[:timeout] ||= Calabash::Gestures::DEFAULT_GESTURE_WAIT_TIMEOUT _pan_between(query_from, query_to, gesture_options) ...
ruby
def pan_between(query_from, query_to, options={}) ensure_query_class_or_nil(query_from) ensure_query_class_or_nil(query_to) gesture_options = options.dup gesture_options[:timeout] ||= Calabash::Gestures::DEFAULT_GESTURE_WAIT_TIMEOUT _pan_between(query_from, query_to, gesture_options) ...
[ "def", "pan_between", "(", "query_from", ",", "query_to", ",", "options", "=", "{", "}", ")", "ensure_query_class_or_nil", "(", "query_from", ")", "ensure_query_class_or_nil", "(", "query_to", ")", "gesture_options", "=", "options", ".", "dup", "gesture_options", ...
Performs a `pan` between two elements. @see Calabash::Gestures#pan_between @!visibility private
[ "Performs", "a", "pan", "between", "two", "elements", "." ]
fac1ce9fcff6e2460c6e72a9b89d93a91a1bc745
https://github.com/calabash/calabash/blob/fac1ce9fcff6e2460c6e72a9b89d93a91a1bc745/lib/calabash/device.rb#L182-L191
22,315
calabash/calabash
lib/calabash/device.rb
Calabash.Device.flick_between
def flick_between(query_from, query_to, options={}) ensure_query_class_or_nil(query_from) ensure_query_class_or_nil(query_to) gesture_options = options.dup gesture_options[:timeout] ||= Calabash::Gestures::DEFAULT_GESTURE_WAIT_TIMEOUT _flick_between(query_from, query_to, gesture_options...
ruby
def flick_between(query_from, query_to, options={}) ensure_query_class_or_nil(query_from) ensure_query_class_or_nil(query_to) gesture_options = options.dup gesture_options[:timeout] ||= Calabash::Gestures::DEFAULT_GESTURE_WAIT_TIMEOUT _flick_between(query_from, query_to, gesture_options...
[ "def", "flick_between", "(", "query_from", ",", "query_to", ",", "options", "=", "{", "}", ")", "ensure_query_class_or_nil", "(", "query_from", ")", "ensure_query_class_or_nil", "(", "query_to", ")", "gesture_options", "=", "options", ".", "dup", "gesture_options", ...
Performs a `flick` between two elements. @!visibility private
[ "Performs", "a", "flick", "between", "two", "elements", "." ]
fac1ce9fcff6e2460c6e72a9b89d93a91a1bc745
https://github.com/calabash/calabash/blob/fac1ce9fcff6e2460c6e72a9b89d93a91a1bc745/lib/calabash/device.rb#L195-L204
22,316
calabash/calabash
lib/calabash/web.rb
Calabash.Web.evaluate_javascript_in
def evaluate_javascript_in(query, javascript) wait_for_view(query, timeout: Calabash::Gestures::DEFAULT_GESTURE_WAIT_TIMEOUT) _evaluate_javascript_in(query, javascript) end
ruby
def evaluate_javascript_in(query, javascript) wait_for_view(query, timeout: Calabash::Gestures::DEFAULT_GESTURE_WAIT_TIMEOUT) _evaluate_javascript_in(query, javascript) end
[ "def", "evaluate_javascript_in", "(", "query", ",", "javascript", ")", "wait_for_view", "(", "query", ",", "timeout", ":", "Calabash", "::", "Gestures", "::", "DEFAULT_GESTURE_WAIT_TIMEOUT", ")", "_evaluate_javascript_in", "(", "query", ",", "javascript", ")", "end"...
Evaluate javascript in a Web View. On iOS, an implicit return is inserted, on Android an explicit return is needed. @example # iOS cal.evaluate_javascript_in("UIWebView", "2+2") # Android cal.evaluate_javascript_in("WebView", "return 2+2") @example # iOS cal.evaluate_javascript_in("WKWebView", ...
[ "Evaluate", "javascript", "in", "a", "Web", "View", ".", "On", "iOS", "an", "implicit", "return", "is", "inserted", "on", "Android", "an", "explicit", "return", "is", "needed", "." ]
fac1ce9fcff6e2460c6e72a9b89d93a91a1bc745
https://github.com/calabash/calabash/blob/fac1ce9fcff6e2460c6e72a9b89d93a91a1bc745/lib/calabash/web.rb#L30-L35
22,317
calabash/calabash
lib/calabash/text.rb
Calabash.Text.wait_for_keyboard
def wait_for_keyboard(timeout: nil) keyboard_timeout = keyboard_wait_timeout(timeout) message = "Timed out after #{keyboard_timeout} seconds waiting for the keyboard to appear" wait_for(message, timeout: keyboard_timeout) do keyboard_visible? end end
ruby
def wait_for_keyboard(timeout: nil) keyboard_timeout = keyboard_wait_timeout(timeout) message = "Timed out after #{keyboard_timeout} seconds waiting for the keyboard to appear" wait_for(message, timeout: keyboard_timeout) do keyboard_visible? end end
[ "def", "wait_for_keyboard", "(", "timeout", ":", "nil", ")", "keyboard_timeout", "=", "keyboard_wait_timeout", "(", "timeout", ")", "message", "=", "\"Timed out after #{keyboard_timeout} seconds waiting for the keyboard to appear\"", "wait_for", "(", "message", ",", "timeout"...
Waits for a keyboard to appear. @see Calabash::Wait.default_options @param [Number] timeout How long to wait for the keyboard. @raise [Calabash::Wait::TimeoutError] Raises error if no keyboard appears.
[ "Waits", "for", "a", "keyboard", "to", "appear", "." ]
fac1ce9fcff6e2460c6e72a9b89d93a91a1bc745
https://github.com/calabash/calabash/blob/fac1ce9fcff6e2460c6e72a9b89d93a91a1bc745/lib/calabash/text.rb#L125-L131
22,318
calabash/calabash
lib/calabash/text.rb
Calabash.Text.wait_for_no_keyboard
def wait_for_no_keyboard(timeout: nil) keyboard_timeout = keyboard_wait_timeout(timeout) message = "Timed out after #{keyboard_timeout} seconds waiting for the keyboard to disappear" wait_for(message, timeout: keyboard_timeout) do !keyboard_visible? end end
ruby
def wait_for_no_keyboard(timeout: nil) keyboard_timeout = keyboard_wait_timeout(timeout) message = "Timed out after #{keyboard_timeout} seconds waiting for the keyboard to disappear" wait_for(message, timeout: keyboard_timeout) do !keyboard_visible? end end
[ "def", "wait_for_no_keyboard", "(", "timeout", ":", "nil", ")", "keyboard_timeout", "=", "keyboard_wait_timeout", "(", "timeout", ")", "message", "=", "\"Timed out after #{keyboard_timeout} seconds waiting for the keyboard to disappear\"", "wait_for", "(", "message", ",", "ti...
Waits for the keyboard to disappear. @see Calabash::Wait.default_options @param [Number] timeout How log to wait for the keyboard to disappear. @raise [Calabash::Wait::TimeoutError] Raises error if any keyboard is visible after the `timeout`.
[ "Waits", "for", "the", "keyboard", "to", "disappear", "." ]
fac1ce9fcff6e2460c6e72a9b89d93a91a1bc745
https://github.com/calabash/calabash/blob/fac1ce9fcff6e2460c6e72a9b89d93a91a1bc745/lib/calabash/text.rb#L140-L146
22,319
dicom/ruby-dicom
lib/dicom/d_client.rb
DICOM.DClient.find_series
def find_series(query_params={}) # Study Root Query/Retrieve Information Model - FIND: set_default_presentation_context("1.2.840.10008.5.1.4.1.2.2.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...
ruby
def find_series(query_params={}) # Study Root Query/Retrieve Information Model - FIND: set_default_presentation_context("1.2.840.10008.5.1.4.1.2.2.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...
[ "def", "find_series", "(", "query_params", "=", "{", "}", ")", "# Study Root Query/Retrieve Information Model - FIND:", "set_default_presentation_context", "(", "\"1.2.840.10008.5.1.4.1.2.2.1\"", ")", "# Every query attribute with a value != nil (required) will be sent in the dicom query."...
Queries a service class provider for series that match the specified criteria. === Instance level attributes for this query: * '0008,0060' (Modality) * '0020,000E' (Series Instance UID) * '0020,0011' (Series Number) In addition to the above listed attributes, a number of "optional" attributes may be specified....
[ "Queries", "a", "service", "class", "provider", "for", "series", "that", "match", "the", "specified", "criteria", "." ]
3ffcfe21edc8dcd31298f945781990789fc832ab
https://github.com/dicom/ruby-dicom/blob/3ffcfe21edc8dcd31298f945781990789fc832ab/lib/dicom/d_client.rb#L177-L196
22,320
dicom/ruby-dicom
lib/dicom/d_client.rb
DICOM.DClient.move_image
def move_image(destination, options={}) # Study Root Query/Retrieve Information Model - MOVE: set_default_presentation_context("1.2.840.10008.5.1.4.1.2.2.2") # Transfer the current options to the data_elements hash: set_command_fragment_move(destination) # Prepare data elements for this op...
ruby
def move_image(destination, options={}) # Study Root Query/Retrieve Information Model - MOVE: set_default_presentation_context("1.2.840.10008.5.1.4.1.2.2.2") # Transfer the current options to the data_elements hash: set_command_fragment_move(destination) # Prepare data elements for this op...
[ "def", "move_image", "(", "destination", ",", "options", "=", "{", "}", ")", "# Study Root Query/Retrieve Information Model - MOVE:", "set_default_presentation_context", "(", "\"1.2.840.10008.5.1.4.1.2.2.2\"", ")", "# Transfer the current options to the data_elements hash:", "set_com...
Moves a single image to a DICOM server. This DICOM node must be a third party (i.e. not the client instance you are requesting the move with!). === Instance level attributes for this procedure: * '0008,0018' (SOP Instance UID) * '0008,0052' (Query/Retrieve Level) * '0020,000D' (Study Instance UID) * '0020,000...
[ "Moves", "a", "single", "image", "to", "a", "DICOM", "server", "." ]
3ffcfe21edc8dcd31298f945781990789fc832ab
https://github.com/dicom/ruby-dicom/blob/3ffcfe21edc8dcd31298f945781990789fc832ab/lib/dicom/d_client.rb#L296-L305
22,321
dicom/ruby-dicom
lib/dicom/d_client.rb
DICOM.DClient.move_study
def move_study(destination, options={}) # Study Root Query/Retrieve Information Model - MOVE: set_default_presentation_context("1.2.840.10008.5.1.4.1.2.2.2") # Transfer the current options to the data_elements hash: set_command_fragment_move(destination) # Prepare data elements for this op...
ruby
def move_study(destination, options={}) # Study Root Query/Retrieve Information Model - MOVE: set_default_presentation_context("1.2.840.10008.5.1.4.1.2.2.2") # Transfer the current options to the data_elements hash: set_command_fragment_move(destination) # Prepare data elements for this op...
[ "def", "move_study", "(", "destination", ",", "options", "=", "{", "}", ")", "# Study Root Query/Retrieve Information Model - MOVE:", "set_default_presentation_context", "(", "\"1.2.840.10008.5.1.4.1.2.2.2\"", ")", "# Transfer the current options to the data_elements hash:", "set_com...
Move an entire study to a DICOM server. This DICOM node must be a third party (i.e. not the client instance you are requesting the move with!). === Instance level attributes for this procedure: * '0008,0052' (Query/Retrieve Level) * '0010,0020' (Patient ID) * '0020,000D' (Study Instance UID) @param [String] ...
[ "Move", "an", "entire", "study", "to", "a", "DICOM", "server", "." ]
3ffcfe21edc8dcd31298f945781990789fc832ab
https://github.com/dicom/ruby-dicom/blob/3ffcfe21edc8dcd31298f945781990789fc832ab/lib/dicom/d_client.rb#L325-L334
22,322
dicom/ruby-dicom
lib/dicom/d_client.rb
DICOM.DClient.available_transfer_syntaxes
def available_transfer_syntaxes(transfer_syntax) case transfer_syntax when IMPLICIT_LITTLE_ENDIAN return [IMPLICIT_LITTLE_ENDIAN, EXPLICIT_LITTLE_ENDIAN] when EXPLICIT_LITTLE_ENDIAN return [EXPLICIT_LITTLE_ENDIAN, IMPLICIT_LITTLE_ENDIAN] when EXPLICIT_BIG_ENDIAN return [E...
ruby
def available_transfer_syntaxes(transfer_syntax) case transfer_syntax when IMPLICIT_LITTLE_ENDIAN return [IMPLICIT_LITTLE_ENDIAN, EXPLICIT_LITTLE_ENDIAN] when EXPLICIT_LITTLE_ENDIAN return [EXPLICIT_LITTLE_ENDIAN, IMPLICIT_LITTLE_ENDIAN] when EXPLICIT_BIG_ENDIAN return [E...
[ "def", "available_transfer_syntaxes", "(", "transfer_syntax", ")", "case", "transfer_syntax", "when", "IMPLICIT_LITTLE_ENDIAN", "return", "[", "IMPLICIT_LITTLE_ENDIAN", ",", "EXPLICIT_LITTLE_ENDIAN", "]", "when", "EXPLICIT_LITTLE_ENDIAN", "return", "[", "EXPLICIT_LITTLE_ENDIAN"...
Returns an array of supported transfer syntaxes for the specified transfer syntax. For compressed transfer syntaxes, we currently do not support reencoding these to other syntaxes.
[ "Returns", "an", "array", "of", "supported", "transfer", "syntaxes", "for", "the", "specified", "transfer", "syntax", ".", "For", "compressed", "transfer", "syntaxes", "we", "currently", "do", "not", "support", "reencoding", "these", "to", "other", "syntaxes", "...
3ffcfe21edc8dcd31298f945781990789fc832ab
https://github.com/dicom/ruby-dicom/blob/3ffcfe21edc8dcd31298f945781990789fc832ab/lib/dicom/d_client.rb#L395-L406
22,323
dicom/ruby-dicom
lib/dicom/d_client.rb
DICOM.DClient.establish_association
def establish_association # Reset some variables: @association = false @request_approved = false # Initiate the association: @link.build_association_request(@presentation_contexts, @user_information) @link.start_session(@host_ip, @port) @link.transmit info = @link.receive...
ruby
def establish_association # Reset some variables: @association = false @request_approved = false # Initiate the association: @link.build_association_request(@presentation_contexts, @user_information) @link.start_session(@host_ip, @port) @link.transmit info = @link.receive...
[ "def", "establish_association", "# Reset some variables:", "@association", "=", "false", "@request_approved", "=", "false", "# Initiate the association:", "@link", ".", "build_association_request", "(", "@presentation_contexts", ",", "@user_information", ")", "@link", ".", "s...
Opens a TCP session with the server, and handles the association request as well as the response.
[ "Opens", "a", "TCP", "session", "with", "the", "server", "and", "handles", "the", "association", "request", "as", "well", "as", "the", "response", "." ]
3ffcfe21edc8dcd31298f945781990789fc832ab
https://github.com/dicom/ruby-dicom/blob/3ffcfe21edc8dcd31298f945781990789fc832ab/lib/dicom/d_client.rb#L410-L432
22,324
dicom/ruby-dicom
lib/dicom/d_client.rb
DICOM.DClient.establish_release
def establish_release @release = false if @abort @link.stop_session logger.info("Association has been closed. (#{@host_ae}, #{@host_ip})") else unless @link.session.closed? @link.build_release_request @link.transmit info = @link.receive_single_tran...
ruby
def establish_release @release = false if @abort @link.stop_session logger.info("Association has been closed. (#{@host_ae}, #{@host_ip})") else unless @link.session.closed? @link.build_release_request @link.transmit info = @link.receive_single_tran...
[ "def", "establish_release", "@release", "=", "false", "if", "@abort", "@link", ".", "stop_session", "logger", ".", "info", "(", "\"Association has been closed. (#{@host_ae}, #{@host_ip})\"", ")", "else", "unless", "@link", ".", "session", ".", "closed?", "@link", ".",...
Handles the release request along with the response, as well as closing the TCP connection.
[ "Handles", "the", "release", "request", "along", "with", "the", "response", "as", "well", "as", "closing", "the", "TCP", "connection", "." ]
3ffcfe21edc8dcd31298f945781990789fc832ab
https://github.com/dicom/ruby-dicom/blob/3ffcfe21edc8dcd31298f945781990789fc832ab/lib/dicom/d_client.rb#L436-L457
22,325
dicom/ruby-dicom
lib/dicom/d_client.rb
DICOM.DClient.load_files
def load_files(files_or_objects) files_or_objects = [files_or_objects] unless files_or_objects.is_a?(Array) status = true message = "" objects = Array.new abstracts = Array.new id = 1 @presentation_contexts = Hash.new files_or_objects.each do |file_or_object| if f...
ruby
def load_files(files_or_objects) files_or_objects = [files_or_objects] unless files_or_objects.is_a?(Array) status = true message = "" objects = Array.new abstracts = Array.new id = 1 @presentation_contexts = Hash.new files_or_objects.each do |file_or_object| if f...
[ "def", "load_files", "(", "files_or_objects", ")", "files_or_objects", "=", "[", "files_or_objects", "]", "unless", "files_or_objects", ".", "is_a?", "(", "Array", ")", "status", "=", "true", "message", "=", "\"\"", "objects", "=", "Array", ".", "new", "abstra...
Loads one or more DICOM files. Returns an array of DObject instances, an array of unique abstract syntaxes found among the files, a status boolean and a message string. === Parameters * <tt>files_or_objects</tt> -- A single file path or an array of paths, or a DObject or an array of DObject instances.
[ "Loads", "one", "or", "more", "DICOM", "files", ".", "Returns", "an", "array", "of", "DObject", "instances", "an", "array", "of", "unique", "abstract", "syntaxes", "found", "among", "the", "files", "a", "status", "boolean", "and", "a", "message", "string", ...
3ffcfe21edc8dcd31298f945781990789fc832ab
https://github.com/dicom/ruby-dicom/blob/3ffcfe21edc8dcd31298f945781990789fc832ab/lib/dicom/d_client.rb#L474-L532
22,326
dicom/ruby-dicom
lib/dicom/d_client.rb
DICOM.DClient.perform_echo
def perform_echo # Open a DICOM link: establish_association if association_established? if request_approved? # Continue with our echo, since the request was accepted. # Set the query command elements array: set_command_fragment_echo @link.build_command_f...
ruby
def perform_echo # Open a DICOM link: establish_association if association_established? if request_approved? # Continue with our echo, since the request was accepted. # Set the query command elements array: set_command_fragment_echo @link.build_command_f...
[ "def", "perform_echo", "# Open a DICOM link:", "establish_association", "if", "association_established?", "if", "request_approved?", "# Continue with our echo, since the request was accepted.", "# Set the query command elements array:", "set_command_fragment_echo", "@link", ".", "build_com...
Handles the communication involved in a DICOM C-ECHO. Build the necessary strings and send the command and data element that makes up the echo request. Listens for and interpretes the incoming echo response.
[ "Handles", "the", "communication", "involved", "in", "a", "DICOM", "C", "-", "ECHO", ".", "Build", "the", "necessary", "strings", "and", "send", "the", "command", "and", "data", "element", "that", "makes", "up", "the", "echo", "request", ".", "Listens", "f...
3ffcfe21edc8dcd31298f945781990789fc832ab
https://github.com/dicom/ruby-dicom/blob/3ffcfe21edc8dcd31298f945781990789fc832ab/lib/dicom/d_client.rb#L538-L556
22,327
dicom/ruby-dicom
lib/dicom/d_client.rb
DICOM.DClient.perform_get
def perform_get(path) # Open a DICOM link: establish_association if association_established? if request_approved? # Continue with our operation, since the request was accepted. @link.build_command_fragment(PDU_DATA, presentation_context_id, COMMAND_LAST_FRAGMENT, @command_e...
ruby
def perform_get(path) # Open a DICOM link: establish_association if association_established? if request_approved? # Continue with our operation, since the request was accepted. @link.build_command_fragment(PDU_DATA, presentation_context_id, COMMAND_LAST_FRAGMENT, @command_e...
[ "def", "perform_get", "(", "path", ")", "# Open a DICOM link:", "establish_association", "if", "association_established?", "if", "request_approved?", "# Continue with our operation, since the request was accepted.", "@link", ".", "build_command_fragment", "(", "PDU_DATA", ",", "p...
Handles the communication involved in a DICOM C-GET. Builds and sends command & data fragment, then receives the incoming file data. -- FIXME: This method has never actually been tested, since it is difficult to find a host that accepts a c-get-rq.
[ "Handles", "the", "communication", "involved", "in", "a", "DICOM", "C", "-", "GET", ".", "Builds", "and", "sends", "command", "&", "data", "fragment", "then", "receives", "the", "incoming", "file", "data", "." ]
3ffcfe21edc8dcd31298f945781990789fc832ab
https://github.com/dicom/ruby-dicom/blob/3ffcfe21edc8dcd31298f945781990789fc832ab/lib/dicom/d_client.rb#L590-L610
22,328
dicom/ruby-dicom
lib/dicom/d_client.rb
DICOM.DClient.perform_send
def perform_send(objects) objects.each_with_index do |dcm, index| # Gather necessary information from the object (SOP Class & Instance UID): sop_class = dcm.value("0008,0016") sop_instance = dcm.value("0008,0018") if sop_class and sop_instance # Only send the image if its...
ruby
def perform_send(objects) objects.each_with_index do |dcm, index| # Gather necessary information from the object (SOP Class & Instance UID): sop_class = dcm.value("0008,0016") sop_instance = dcm.value("0008,0018") if sop_class and sop_instance # Only send the image if its...
[ "def", "perform_send", "(", "objects", ")", "objects", ".", "each_with_index", "do", "|", "dcm", ",", "index", "|", "# Gather necessary information from the object (SOP Class & Instance UID):", "sop_class", "=", "dcm", ".", "value", "(", "\"0008,0016\"", ")", "sop_insta...
Handles the communication involved in DICOM C-STORE. For each file, builds and sends command fragment, then builds and sends the data fragments that conveys the information from the selected DICOM file.
[ "Handles", "the", "communication", "involved", "in", "DICOM", "C", "-", "STORE", ".", "For", "each", "file", "builds", "and", "sends", "command", "fragment", "then", "builds", "and", "sends", "the", "data", "fragments", "that", "conveys", "the", "information",...
3ffcfe21edc8dcd31298f945781990789fc832ab
https://github.com/dicom/ruby-dicom/blob/3ffcfe21edc8dcd31298f945781990789fc832ab/lib/dicom/d_client.rb#L639-L679
22,329
dicom/ruby-dicom
lib/dicom/d_client.rb
DICOM.DClient.process_presentation_context_response
def process_presentation_context_response(presentation_contexts) # Storing approved syntaxes in an Hash with the syntax as key and the value being an array with presentation context ID and the transfer syntax chosen by the SCP. @approved_syntaxes = Hash.new rejected = Hash.new # Reset the presen...
ruby
def process_presentation_context_response(presentation_contexts) # Storing approved syntaxes in an Hash with the syntax as key and the value being an array with presentation context ID and the transfer syntax chosen by the SCP. @approved_syntaxes = Hash.new rejected = Hash.new # Reset the presen...
[ "def", "process_presentation_context_response", "(", "presentation_contexts", ")", "# Storing approved syntaxes in an Hash with the syntax as key and the value being an array with presentation context ID and the transfer syntax chosen by the SCP.", "@approved_syntaxes", "=", "Hash", ".", "new", ...
Processes the presentation contexts that are received in the association response to extract the transfer syntaxes which have been accepted for the various abstract syntaxes. === Parameters * <tt>presentation_contexts</tt> -- An array where each index contains a presentation context hash.
[ "Processes", "the", "presentation", "contexts", "that", "are", "received", "in", "the", "association", "response", "to", "extract", "the", "transfer", "syntaxes", "which", "have", "been", "accepted", "for", "the", "various", "abstract", "syntaxes", "." ]
3ffcfe21edc8dcd31298f945781990789fc832ab
https://github.com/dicom/ruby-dicom/blob/3ffcfe21edc8dcd31298f945781990789fc832ab/lib/dicom/d_client.rb#L688-L730
22,330
dicom/ruby-dicom
lib/dicom/d_client.rb
DICOM.DClient.process_returned_data
def process_returned_data(segments) # Reset command results arrays: @command_results = Array.new @data_results = Array.new # Try to extract data: segments.each do |info| if info[:valid] # Determine if it is command or data: if info[:presentation_context_flag] ==...
ruby
def process_returned_data(segments) # Reset command results arrays: @command_results = Array.new @data_results = Array.new # Try to extract data: segments.each do |info| if info[:valid] # Determine if it is command or data: if info[:presentation_context_flag] ==...
[ "def", "process_returned_data", "(", "segments", ")", "# Reset command results arrays:", "@command_results", "=", "Array", ".", "new", "@data_results", "=", "Array", ".", "new", "# Try to extract data:", "segments", ".", "each", "do", "|", "info", "|", "if", "info",...
Processes the array of information hashes that was returned from the interaction with the SCP and transfers it to the instance variables where command and data results are stored.
[ "Processes", "the", "array", "of", "information", "hashes", "that", "was", "returned", "from", "the", "interaction", "with", "the", "SCP", "and", "transfers", "it", "to", "the", "instance", "variables", "where", "command", "and", "data", "results", "are", "sto...
3ffcfe21edc8dcd31298f945781990789fc832ab
https://github.com/dicom/ruby-dicom/blob/3ffcfe21edc8dcd31298f945781990789fc832ab/lib/dicom/d_client.rb#L735-L750
22,331
dicom/ruby-dicom
lib/dicom/d_client.rb
DICOM.DClient.set_default_presentation_context
def set_default_presentation_context(abstract_syntax) raise ArgumentError, "Expected String, got #{abstract_syntax.class}" unless abstract_syntax.is_a?(String) id = 1 transfer_syntaxes = [IMPLICIT_LITTLE_ENDIAN, EXPLICIT_LITTLE_ENDIAN, EXPLICIT_BIG_ENDIAN] item = {:transfer_syntaxes => transfer_...
ruby
def set_default_presentation_context(abstract_syntax) raise ArgumentError, "Expected String, got #{abstract_syntax.class}" unless abstract_syntax.is_a?(String) id = 1 transfer_syntaxes = [IMPLICIT_LITTLE_ENDIAN, EXPLICIT_LITTLE_ENDIAN, EXPLICIT_BIG_ENDIAN] item = {:transfer_syntaxes => transfer_...
[ "def", "set_default_presentation_context", "(", "abstract_syntax", ")", "raise", "ArgumentError", ",", "\"Expected String, got #{abstract_syntax.class}\"", "unless", "abstract_syntax", ".", "is_a?", "(", "String", ")", "id", "=", "1", "transfer_syntaxes", "=", "[", "IMPLI...
Creates the presentation context used for the non-file-transmission association requests..
[ "Creates", "the", "presentation", "context", "used", "for", "the", "non", "-", "file", "-", "transmission", "association", "requests", ".." ]
3ffcfe21edc8dcd31298f945781990789fc832ab
https://github.com/dicom/ruby-dicom/blob/3ffcfe21edc8dcd31298f945781990789fc832ab/lib/dicom/d_client.rb#L867-L874
22,332
dicom/ruby-dicom
lib/dicom/d_client.rb
DICOM.DClient.set_data_elements
def set_data_elements(options) @data_elements = [] options.keys.sort.each do |tag| @data_elements << [ tag, options[tag] ] unless options[tag].nil? end end
ruby
def set_data_elements(options) @data_elements = [] options.keys.sort.each do |tag| @data_elements << [ tag, options[tag] ] unless options[tag].nil? end end
[ "def", "set_data_elements", "(", "options", ")", "@data_elements", "=", "[", "]", "options", ".", "keys", ".", "sort", ".", "each", "do", "|", "tag", "|", "@data_elements", "<<", "[", "tag", ",", "options", "[", "tag", "]", "]", "unless", "options", "[...
Sets the data_elements instance array with the given options.
[ "Sets", "the", "data_elements", "instance", "array", "with", "the", "given", "options", "." ]
3ffcfe21edc8dcd31298f945781990789fc832ab
https://github.com/dicom/ruby-dicom/blob/3ffcfe21edc8dcd31298f945781990789fc832ab/lib/dicom/d_client.rb#L910-L915
22,333
calabash/calabash
lib/calabash/console_helpers.rb
Calabash.ConsoleHelpers.reload_git_files
def reload_git_files files_to_reload = (`git status`.lines.grep(/modified/).map{|l| l.split(" ").last.gsub('../', '')} + `git ls-files --others --exclude-standard`.lines).map(&:chomp) $LOADED_FEATURES.each do |file| files_to_reload.each do |reload_name| if file.end...
ruby
def reload_git_files files_to_reload = (`git status`.lines.grep(/modified/).map{|l| l.split(" ").last.gsub('../', '')} + `git ls-files --others --exclude-standard`.lines).map(&:chomp) $LOADED_FEATURES.each do |file| files_to_reload.each do |reload_name| if file.end...
[ "def", "reload_git_files", "files_to_reload", "=", "(", "`", "`", ".", "lines", ".", "grep", "(", "/", "/", ")", ".", "map", "{", "|", "l", "|", "l", ".", "split", "(", "\" \"", ")", ".", "last", ".", "gsub", "(", "'../'", ",", "''", ")", "}", ...
Reloads all required files that have git changes
[ "Reloads", "all", "required", "files", "that", "have", "git", "changes" ]
fac1ce9fcff6e2460c6e72a9b89d93a91a1bc745
https://github.com/calabash/calabash/blob/fac1ce9fcff6e2460c6e72a9b89d93a91a1bc745/lib/calabash/console_helpers.rb#L9-L25
22,334
calabash/calabash
lib/calabash/console_helpers.rb
Calabash.ConsoleHelpers.cal_methods
def cal_methods c = Class.new(BasicObject) do include Calabash end ConsoleHelpers.puts_unbound_methods(c, 'cal.') true end
ruby
def cal_methods c = Class.new(BasicObject) do include Calabash end ConsoleHelpers.puts_unbound_methods(c, 'cal.') true end
[ "def", "cal_methods", "c", "=", "Class", ".", "new", "(", "BasicObject", ")", "do", "include", "Calabash", "end", "ConsoleHelpers", ".", "puts_unbound_methods", "(", "c", ",", "'cal.'", ")", "true", "end" ]
Outputs all calabash methods
[ "Outputs", "all", "calabash", "methods" ]
fac1ce9fcff6e2460c6e72a9b89d93a91a1bc745
https://github.com/calabash/calabash/blob/fac1ce9fcff6e2460c6e72a9b89d93a91a1bc745/lib/calabash/console_helpers.rb#L28-L35
22,335
calabash/calabash
lib/calabash/console_helpers.rb
Calabash.ConsoleHelpers.cal_method
def cal_method(method) c = Class.new(BasicObject) do include Calabash end ConsoleHelpers.puts_unbound_method(c, method.to_sym, 'cal.') true end
ruby
def cal_method(method) c = Class.new(BasicObject) do include Calabash end ConsoleHelpers.puts_unbound_method(c, method.to_sym, 'cal.') true end
[ "def", "cal_method", "(", "method", ")", "c", "=", "Class", ".", "new", "(", "BasicObject", ")", "do", "include", "Calabash", "end", "ConsoleHelpers", ".", "puts_unbound_method", "(", "c", ",", "method", ".", "to_sym", ",", "'cal.'", ")", "true", "end" ]
Outputs a calabash method
[ "Outputs", "a", "calabash", "method" ]
fac1ce9fcff6e2460c6e72a9b89d93a91a1bc745
https://github.com/calabash/calabash/blob/fac1ce9fcff6e2460c6e72a9b89d93a91a1bc745/lib/calabash/console_helpers.rb#L38-L45
22,336
calabash/calabash
lib/calabash/console_helpers.rb
Calabash.ConsoleHelpers.cal_ios_methods
def cal_ios_methods c = Class.new(BasicObject) do include Calabash::IOSInternal end ConsoleHelpers.puts_unbound_methods(c, 'cal_ios.') true end
ruby
def cal_ios_methods c = Class.new(BasicObject) do include Calabash::IOSInternal end ConsoleHelpers.puts_unbound_methods(c, 'cal_ios.') true end
[ "def", "cal_ios_methods", "c", "=", "Class", ".", "new", "(", "BasicObject", ")", "do", "include", "Calabash", "::", "IOSInternal", "end", "ConsoleHelpers", ".", "puts_unbound_methods", "(", "c", ",", "'cal_ios.'", ")", "true", "end" ]
Outputs all calabash iOS methods
[ "Outputs", "all", "calabash", "iOS", "methods" ]
fac1ce9fcff6e2460c6e72a9b89d93a91a1bc745
https://github.com/calabash/calabash/blob/fac1ce9fcff6e2460c6e72a9b89d93a91a1bc745/lib/calabash/console_helpers.rb#L48-L55
22,337
calabash/calabash
lib/calabash/console_helpers.rb
Calabash.ConsoleHelpers.cal_android_methods
def cal_android_methods c = Class.new(BasicObject) do include Calabash::AndroidInternal end ConsoleHelpers.puts_unbound_methods(c, 'cal_android.') true end
ruby
def cal_android_methods c = Class.new(BasicObject) do include Calabash::AndroidInternal end ConsoleHelpers.puts_unbound_methods(c, 'cal_android.') true end
[ "def", "cal_android_methods", "c", "=", "Class", ".", "new", "(", "BasicObject", ")", "do", "include", "Calabash", "::", "AndroidInternal", "end", "ConsoleHelpers", ".", "puts_unbound_methods", "(", "c", ",", "'cal_android.'", ")", "true", "end" ]
Outputs all calabash Android methods
[ "Outputs", "all", "calabash", "Android", "methods" ]
fac1ce9fcff6e2460c6e72a9b89d93a91a1bc745
https://github.com/calabash/calabash/blob/fac1ce9fcff6e2460c6e72a9b89d93a91a1bc745/lib/calabash/console_helpers.rb#L68-L75
22,338
calabash/calabash
lib/calabash/console_helpers.rb
Calabash.ConsoleHelpers.tree
def tree ConsoleHelpers.dump(Calabash::Internal.with_current_target {|target| target.dump}) true end
ruby
def tree ConsoleHelpers.dump(Calabash::Internal.with_current_target {|target| target.dump}) true end
[ "def", "tree", "ConsoleHelpers", ".", "dump", "(", "Calabash", "::", "Internal", ".", "with_current_target", "{", "|", "target", "|", "target", ".", "dump", "}", ")", "true", "end" ]
Outputs all visible elements as a tree.
[ "Outputs", "all", "visible", "elements", "as", "a", "tree", "." ]
fac1ce9fcff6e2460c6e72a9b89d93a91a1bc745
https://github.com/calabash/calabash/blob/fac1ce9fcff6e2460c6e72a9b89d93a91a1bc745/lib/calabash/console_helpers.rb#L88-L91
22,339
calabash/calabash
lib/calabash/console_helpers.rb
Calabash.ConsoleHelpers.verbose
def verbose if Calabash::Logger.log_levels.include?(:debug) puts Color.blue('Debug logging is already turned on.') else Calabash::Logger.log_levels << :debug puts Color.blue('Turned on debug logging.') end true end
ruby
def verbose if Calabash::Logger.log_levels.include?(:debug) puts Color.blue('Debug logging is already turned on.') else Calabash::Logger.log_levels << :debug puts Color.blue('Turned on debug logging.') end true end
[ "def", "verbose", "if", "Calabash", "::", "Logger", ".", "log_levels", ".", "include?", "(", ":debug", ")", "puts", "Color", ".", "blue", "(", "'Debug logging is already turned on.'", ")", "else", "Calabash", "::", "Logger", ".", "log_levels", "<<", ":debug", ...
Turn on debug logging.
[ "Turn", "on", "debug", "logging", "." ]
fac1ce9fcff6e2460c6e72a9b89d93a91a1bc745
https://github.com/calabash/calabash/blob/fac1ce9fcff6e2460c6e72a9b89d93a91a1bc745/lib/calabash/console_helpers.rb#L147-L156
22,340
calabash/calabash
lib/calabash/console_helpers.rb
Calabash.ConsoleHelpers.quiet
def quiet if Calabash::Logger.log_levels.include?(:debug) puts Color.blue('Turned off debug logging.') Calabash::Logger.log_levels.delete(:debug) else puts Color.blue('Debug logging is already turned off.') end true end
ruby
def quiet if Calabash::Logger.log_levels.include?(:debug) puts Color.blue('Turned off debug logging.') Calabash::Logger.log_levels.delete(:debug) else puts Color.blue('Debug logging is already turned off.') end true end
[ "def", "quiet", "if", "Calabash", "::", "Logger", ".", "log_levels", ".", "include?", "(", ":debug", ")", "puts", "Color", ".", "blue", "(", "'Turned off debug logging.'", ")", "Calabash", "::", "Logger", ".", "log_levels", ".", "delete", "(", ":debug", ")",...
Turn off debug logging.
[ "Turn", "off", "debug", "logging", "." ]
fac1ce9fcff6e2460c6e72a9b89d93a91a1bc745
https://github.com/calabash/calabash/blob/fac1ce9fcff6e2460c6e72a9b89d93a91a1bc745/lib/calabash/console_helpers.rb#L159-L168
22,341
dicom/ruby-dicom
lib/dicom/stream.rb
DICOM.Stream.decode
def decode(length, type) raise ArgumentError, "Invalid argument length. Expected Integer, got #{length.class}" unless length.is_a?(Integer) raise ArgumentError, "Invalid argument type. Expected string, got #{type.class}" unless type.is_a?(String) value = nil if (@index + length) <= @string.lengt...
ruby
def decode(length, type) raise ArgumentError, "Invalid argument length. Expected Integer, got #{length.class}" unless length.is_a?(Integer) raise ArgumentError, "Invalid argument type. Expected string, got #{type.class}" unless type.is_a?(String) value = nil if (@index + length) <= @string.lengt...
[ "def", "decode", "(", "length", ",", "type", ")", "raise", "ArgumentError", ",", "\"Invalid argument length. Expected Integer, got #{length.class}\"", "unless", "length", ".", "is_a?", "(", "Integer", ")", "raise", "ArgumentError", ",", "\"Invalid argument type. Expected st...
Decodes a section of the instance string. The instance index is offset in accordance with the length read. @note If multiple numbers are decoded, these are returned in an array. @param [Integer] length the string length to be decoded @param [String] type the type (vr) of data to decode @return [String, Integer, F...
[ "Decodes", "a", "section", "of", "the", "instance", "string", ".", "The", "instance", "index", "is", "offset", "in", "accordance", "with", "the", "length", "read", "." ]
3ffcfe21edc8dcd31298f945781990789fc832ab
https://github.com/dicom/ruby-dicom/blob/3ffcfe21edc8dcd31298f945781990789fc832ab/lib/dicom/stream.rb#L63-L92
22,342
dicom/ruby-dicom
lib/dicom/stream.rb
DICOM.Stream.decode_tag
def decode_tag length = 4 tag = nil if (@index + length) <= @string.length # There are sufficient bytes remaining to extract a full tag: str = @string.slice(@index, length).unpack(@hex)[0].upcase if @equal_endian tag = "#{str[2..3]}#{str[0..1]},#{str[6..7]}#{str[4..5]...
ruby
def decode_tag length = 4 tag = nil if (@index + length) <= @string.length # There are sufficient bytes remaining to extract a full tag: str = @string.slice(@index, length).unpack(@hex)[0].upcase if @equal_endian tag = "#{str[2..3]}#{str[0..1]},#{str[6..7]}#{str[4..5]...
[ "def", "decode_tag", "length", "=", "4", "tag", "=", "nil", "if", "(", "@index", "+", "length", ")", "<=", "@string", ".", "length", "# There are sufficient bytes remaining to extract a full tag:", "str", "=", "@string", ".", "slice", "(", "@index", ",", "length...
Decodes 4 bytes of the instance string and formats it as a ruby-dicom tag string. @return [String, NilClass] a formatted tag string ('GGGG,EEEE'), or nil (e.g. if at end of string)
[ "Decodes", "4", "bytes", "of", "the", "instance", "string", "and", "formats", "it", "as", "a", "ruby", "-", "dicom", "tag", "string", "." ]
3ffcfe21edc8dcd31298f945781990789fc832ab
https://github.com/dicom/ruby-dicom/blob/3ffcfe21edc8dcd31298f945781990789fc832ab/lib/dicom/stream.rb#L111-L126
22,343
dicom/ruby-dicom
lib/dicom/stream.rb
DICOM.Stream.encode
def encode(value, type) raise ArgumentError, "Invalid argument type. Expected string, got #{type.class}" unless type.is_a?(String) value = [value] unless value.is_a?(Array) return value.pack(vr_to_str(type)) end
ruby
def encode(value, type) raise ArgumentError, "Invalid argument type. Expected string, got #{type.class}" unless type.is_a?(String) value = [value] unless value.is_a?(Array) return value.pack(vr_to_str(type)) end
[ "def", "encode", "(", "value", ",", "type", ")", "raise", "ArgumentError", ",", "\"Invalid argument type. Expected string, got #{type.class}\"", "unless", "type", ".", "is_a?", "(", "String", ")", "value", "=", "[", "value", "]", "unless", "value", ".", "is_a?", ...
Encodes a given value to a binary string. @param [String, Integer, Float, Array] value a formatted value (String, Integer, etc..) or an array of numbers @param [String] type the type (vr) of data to encode @return [String] an encoded binary string
[ "Encodes", "a", "given", "value", "to", "a", "binary", "string", "." ]
3ffcfe21edc8dcd31298f945781990789fc832ab
https://github.com/dicom/ruby-dicom/blob/3ffcfe21edc8dcd31298f945781990789fc832ab/lib/dicom/stream.rb#L134-L138
22,344
dicom/ruby-dicom
lib/dicom/stream.rb
DICOM.Stream.encode_string_with_trailing_spaces
def encode_string_with_trailing_spaces(string, target_length) length = string.length if length < target_length return "#{[string].pack(@str)}#{['20'*(target_length-length)].pack(@hex)}" elsif length == target_length return [string].pack(@str) else raise "The specified str...
ruby
def encode_string_with_trailing_spaces(string, target_length) length = string.length if length < target_length return "#{[string].pack(@str)}#{['20'*(target_length-length)].pack(@hex)}" elsif length == target_length return [string].pack(@str) else raise "The specified str...
[ "def", "encode_string_with_trailing_spaces", "(", "string", ",", "target_length", ")", "length", "=", "string", ".", "length", "if", "length", "<", "target_length", "return", "\"#{[string].pack(@str)}#{['20'*(target_length-length)].pack(@hex)}\"", "elsif", "length", "==", "...
Appends a string with trailling spaces to achieve a target length, and encodes it to a binary string. @param [String] string a string to be padded @param [Integer] target_length the target length of the string @return [String] an encoded binary string
[ "Appends", "a", "string", "with", "trailling", "spaces", "to", "achieve", "a", "target", "length", "and", "encodes", "it", "to", "a", "binary", "string", "." ]
3ffcfe21edc8dcd31298f945781990789fc832ab
https://github.com/dicom/ruby-dicom/blob/3ffcfe21edc8dcd31298f945781990789fc832ab/lib/dicom/stream.rb#L166-L175
22,345
dicom/ruby-dicom
lib/dicom/stream.rb
DICOM.Stream.encode_value
def encode_value(value, vr) if vr == 'AT' bin = encode_tag(value) else # Make sure the value is in an array: value = [value] unless value.is_a?(Array) # Get the proper pack string: type = vr_to_str(vr) # Encode: bin = value.pack(type) # Add an ...
ruby
def encode_value(value, vr) if vr == 'AT' bin = encode_tag(value) else # Make sure the value is in an array: value = [value] unless value.is_a?(Array) # Get the proper pack string: type = vr_to_str(vr) # Encode: bin = value.pack(type) # Add an ...
[ "def", "encode_value", "(", "value", ",", "vr", ")", "if", "vr", "==", "'AT'", "bin", "=", "encode_tag", "(", "value", ")", "else", "# Make sure the value is in an array:", "value", "=", "[", "value", "]", "unless", "value", ".", "is_a?", "(", "Array", ")"...
Encodes a value, and if the the resulting binary string has an odd length, appends a proper padding byte to make it even length. @param [String, Integer, Float, Array] value a formatted value (String, Integer, etc..) or an array of numbers @param [String] vr the value representation of data to encode @return [Stri...
[ "Encodes", "a", "value", "and", "if", "the", "the", "resulting", "binary", "string", "has", "an", "odd", "length", "appends", "a", "proper", "padding", "byte", "to", "make", "it", "even", "length", "." ]
3ffcfe21edc8dcd31298f945781990789fc832ab
https://github.com/dicom/ruby-dicom/blob/3ffcfe21edc8dcd31298f945781990789fc832ab/lib/dicom/stream.rb#L195-L209
22,346
calabash/calabash
lib/calabash/interactions.rb
Calabash.Interactions.backdoor
def backdoor(name, *arguments) Calabash::Internal.with_current_target {|target| target.backdoor(name, *arguments)} end
ruby
def backdoor(name, *arguments) Calabash::Internal.with_current_target {|target| target.backdoor(name, *arguments)} end
[ "def", "backdoor", "(", "name", ",", "*", "arguments", ")", "Calabash", "::", "Internal", ".", "with_current_target", "{", "|", "target", "|", "target", ".", "backdoor", "(", "name", ",", "arguments", ")", "}", "end" ]
Invoke a method in your application. This is an escape hatch for calling an arbitrary hook inside (the test build) of your app. Commonly used to "go around" the UI for speed purposes or reset the app to a good known state. For iOS this method calls a method on the app's AppDelegate object. For Android this met...
[ "Invoke", "a", "method", "in", "your", "application", "." ]
fac1ce9fcff6e2460c6e72a9b89d93a91a1bc745
https://github.com/calabash/calabash/blob/fac1ce9fcff6e2460c6e72a9b89d93a91a1bc745/lib/calabash/interactions.rb#L128-L130
22,347
dicom/ruby-dicom
lib/dicom/d_server.rb
DICOM.DServer.add_abstract_syntax
def add_abstract_syntax(uid) lib_uid = LIBRARY.uid(uid) raise "Invalid/unknown UID: #{uid}" unless lib_uid @accepted_abstract_syntaxes[uid] = lib_uid.name end
ruby
def add_abstract_syntax(uid) lib_uid = LIBRARY.uid(uid) raise "Invalid/unknown UID: #{uid}" unless lib_uid @accepted_abstract_syntaxes[uid] = lib_uid.name end
[ "def", "add_abstract_syntax", "(", "uid", ")", "lib_uid", "=", "LIBRARY", ".", "uid", "(", "uid", ")", "raise", "\"Invalid/unknown UID: #{uid}\"", "unless", "lib_uid", "@accepted_abstract_syntaxes", "[", "uid", "]", "=", "lib_uid", ".", "name", "end" ]
Creates a DServer instance. @note To customize logging behaviour, refer to the Logging module documentation. @param [Integer] port the network port to be used @param [Hash] options the options to use for the DICOM server @option options [String] :file_handler a customized FileHandler class to use instead of the d...
[ "Creates", "a", "DServer", "instance", "." ]
3ffcfe21edc8dcd31298f945781990789fc832ab
https://github.com/dicom/ruby-dicom/blob/3ffcfe21edc8dcd31298f945781990789fc832ab/lib/dicom/d_server.rb#L89-L93
22,348
dicom/ruby-dicom
lib/dicom/d_server.rb
DICOM.DServer.add_transfer_syntax
def add_transfer_syntax(uid) lib_uid = LIBRARY.uid(uid) raise "Invalid/unknown UID: #{uid}" unless lib_uid @accepted_transfer_syntaxes[uid] = lib_uid.name end
ruby
def add_transfer_syntax(uid) lib_uid = LIBRARY.uid(uid) raise "Invalid/unknown UID: #{uid}" unless lib_uid @accepted_transfer_syntaxes[uid] = lib_uid.name end
[ "def", "add_transfer_syntax", "(", "uid", ")", "lib_uid", "=", "LIBRARY", ".", "uid", "(", "uid", ")", "raise", "\"Invalid/unknown UID: #{uid}\"", "unless", "lib_uid", "@accepted_transfer_syntaxes", "[", "uid", "]", "=", "lib_uid", ".", "name", "end" ]
Adds a transfer syntax to the list of transfer syntaxes that the server will accept. @param [String] uid a transfer syntax UID
[ "Adds", "a", "transfer", "syntax", "to", "the", "list", "of", "transfer", "syntaxes", "that", "the", "server", "will", "accept", "." ]
3ffcfe21edc8dcd31298f945781990789fc832ab
https://github.com/dicom/ruby-dicom/blob/3ffcfe21edc8dcd31298f945781990789fc832ab/lib/dicom/d_server.rb#L99-L103
22,349
dicom/ruby-dicom
lib/dicom/d_server.rb
DICOM.DServer.print_abstract_syntaxes
def print_abstract_syntaxes # Determine length of longest key to ensure pretty print: max_uid = @accepted_abstract_syntaxes.keys.collect{|k| k.length}.max puts "Abstract syntaxes which are accepted by this SCP:" @accepted_abstract_syntaxes.sort.each do |pair| puts "#{pair[0]}#{' '*(max_u...
ruby
def print_abstract_syntaxes # Determine length of longest key to ensure pretty print: max_uid = @accepted_abstract_syntaxes.keys.collect{|k| k.length}.max puts "Abstract syntaxes which are accepted by this SCP:" @accepted_abstract_syntaxes.sort.each do |pair| puts "#{pair[0]}#{' '*(max_u...
[ "def", "print_abstract_syntaxes", "# Determine length of longest key to ensure pretty print:", "max_uid", "=", "@accepted_abstract_syntaxes", ".", "keys", ".", "collect", "{", "|", "k", "|", "k", ".", "length", "}", ".", "max", "puts", "\"Abstract syntaxes which are accepte...
Prints the list of accepted abstract syntaxes to the screen.
[ "Prints", "the", "list", "of", "accepted", "abstract", "syntaxes", "to", "the", "screen", "." ]
3ffcfe21edc8dcd31298f945781990789fc832ab
https://github.com/dicom/ruby-dicom/blob/3ffcfe21edc8dcd31298f945781990789fc832ab/lib/dicom/d_server.rb#L107-L114
22,350
calabash/calabash
lib/calabash/wait.rb
Calabash.Wait.wait_for_view
def wait_for_view(query, timeout: Calabash::Wait.default_options[:timeout], timeout_message: nil, retry_frequency: Calabash::Wait.default_options[:retry_frequency]) if query.nil? raise ArgumentError, 'Query cannot be nil' end t...
ruby
def wait_for_view(query, timeout: Calabash::Wait.default_options[:timeout], timeout_message: nil, retry_frequency: Calabash::Wait.default_options[:retry_frequency]) if query.nil? raise ArgumentError, 'Query cannot be nil' end t...
[ "def", "wait_for_view", "(", "query", ",", "timeout", ":", "Calabash", "::", "Wait", ".", "default_options", "[", ":timeout", "]", ",", "timeout_message", ":", "nil", ",", "retry_frequency", ":", "Calabash", "::", "Wait", ".", "default_options", "[", ":retry_f...
Waits for `query` to match one or more views. @example cal.wait_for_view({marked: 'mark'}) @example cal.wait_for_view({marked: 'login'}, timeout_message: "Did not see login button") @example text = cal.wait_for_view("myview")['text'] @see Calabash::Wait#wait_for for optional parameters ...
[ "Waits", "for", "query", "to", "match", "one", "or", "more", "views", "." ]
fac1ce9fcff6e2460c6e72a9b89d93a91a1bc745
https://github.com/calabash/calabash/blob/fac1ce9fcff6e2460c6e72a9b89d93a91a1bc745/lib/calabash/wait.rb#L187-L206
22,351
calabash/calabash
lib/calabash/wait.rb
Calabash.Wait.wait_for_views
def wait_for_views(*queries, timeout: Calabash::Wait.default_options[:timeout], timeout_message: nil, retry_frequency: Calabash::Wait.default_options[:retry_frequency]) if queries.nil? || queries.any?(&:nil?) raise ArgumentError, 'Query ...
ruby
def wait_for_views(*queries, timeout: Calabash::Wait.default_options[:timeout], timeout_message: nil, retry_frequency: Calabash::Wait.default_options[:retry_frequency]) if queries.nil? || queries.any?(&:nil?) raise ArgumentError, 'Query ...
[ "def", "wait_for_views", "(", "*", "queries", ",", "timeout", ":", "Calabash", "::", "Wait", ".", "default_options", "[", ":timeout", "]", ",", "timeout_message", ":", "nil", ",", "retry_frequency", ":", "Calabash", "::", "Wait", ".", "default_options", "[", ...
Waits for all `queries` to simultaneously match at least one view. @example cal.wait_for_views({id: 'foo'}, {id: 'bar'}) @see Calabash::Wait#wait_for for optional parameters @param [String, Hash, Calabash::Query] queries List of queries or a query. @return The returned value is undefined @raise [ViewNotFoun...
[ "Waits", "for", "all", "queries", "to", "simultaneously", "match", "at", "least", "one", "view", "." ]
fac1ce9fcff6e2460c6e72a9b89d93a91a1bc745
https://github.com/calabash/calabash/blob/fac1ce9fcff6e2460c6e72a9b89d93a91a1bc745/lib/calabash/wait.rb#L220-L242
22,352
calabash/calabash
lib/calabash/wait.rb
Calabash.Wait.wait_for_no_view
def wait_for_no_view(query, timeout: Calabash::Wait.default_options[:timeout], timeout_message: nil, retry_frequency: Calabash::Wait.default_options[:retry_frequency]) if query.nil? raise ArgumentError, 'Query cannot be nil' ...
ruby
def wait_for_no_view(query, timeout: Calabash::Wait.default_options[:timeout], timeout_message: nil, retry_frequency: Calabash::Wait.default_options[:retry_frequency]) if query.nil? raise ArgumentError, 'Query cannot be nil' ...
[ "def", "wait_for_no_view", "(", "query", ",", "timeout", ":", "Calabash", "::", "Wait", ".", "default_options", "[", ":timeout", "]", ",", "timeout_message", ":", "nil", ",", "retry_frequency", ":", "Calabash", "::", "Wait", ".", "default_options", "[", ":retr...
Waits for `query` not to match any views @example cal.wait_for_no_view({marked: 'mark'}) @example cal.wait_for_no_view({marked: 'login'}, timeout_message: "Login button did not disappear") @see Calabash::Wait#wait_for for optional parameters @param [String, Hash, Calabash::Query] query Que...
[ "Waits", "for", "query", "not", "to", "match", "any", "views" ]
fac1ce9fcff6e2460c6e72a9b89d93a91a1bc745
https://github.com/calabash/calabash/blob/fac1ce9fcff6e2460c6e72a9b89d93a91a1bc745/lib/calabash/wait.rb#L257-L275
22,353
calabash/calabash
lib/calabash/wait.rb
Calabash.Wait.wait_for_no_views
def wait_for_no_views(*queries, timeout: Calabash::Wait.default_options[:timeout], timeout_message: nil, retry_frequency: Calabash::Wait.default_options[:retry_frequency]) if queries.nil? || queries.any?(&:nil?) raise ArgumentEr...
ruby
def wait_for_no_views(*queries, timeout: Calabash::Wait.default_options[:timeout], timeout_message: nil, retry_frequency: Calabash::Wait.default_options[:retry_frequency]) if queries.nil? || queries.any?(&:nil?) raise ArgumentEr...
[ "def", "wait_for_no_views", "(", "*", "queries", ",", "timeout", ":", "Calabash", "::", "Wait", ".", "default_options", "[", ":timeout", "]", ",", "timeout_message", ":", "nil", ",", "retry_frequency", ":", "Calabash", "::", "Wait", ".", "default_options", "["...
Waits for all `queries` to simultaneously match no views @example cal.wait_for_no_views({id: 'foo'}, {id: 'bar'}) @see Calabash::Wait#wait_for for optional parameters @param [String, Hash, Calabash::Query] queries List of queries or a query. @raise [ViewNotFoundError] If `queries` do not all match at least o...
[ "Waits", "for", "all", "queries", "to", "simultaneously", "match", "no", "views" ]
fac1ce9fcff6e2460c6e72a9b89d93a91a1bc745
https://github.com/calabash/calabash/blob/fac1ce9fcff6e2460c6e72a9b89d93a91a1bc745/lib/calabash/wait.rb#L288-L306
22,354
calabash/calabash
lib/calabash/wait.rb
Calabash.Wait.view_exists?
def view_exists?(query) if query.nil? raise ArgumentError, 'Query cannot be nil' end result = query(query) !result.empty? end
ruby
def view_exists?(query) if query.nil? raise ArgumentError, 'Query cannot be nil' end result = query(query) !result.empty? end
[ "def", "view_exists?", "(", "query", ")", "if", "query", ".", "nil?", "raise", "ArgumentError", ",", "'Query cannot be nil'", "end", "result", "=", "query", "(", "query", ")", "!", "result", ".", "empty?", "end" ]
Does the given `query` match at least one view? @param [String, Hash, Calabash::Query] query Query to match view @return [Boolean] Returns true if the `query` matches at least one view @raise [ArgumentError] If given an invalid `query`
[ "Does", "the", "given", "query", "match", "at", "least", "one", "view?" ]
fac1ce9fcff6e2460c6e72a9b89d93a91a1bc745
https://github.com/calabash/calabash/blob/fac1ce9fcff6e2460c6e72a9b89d93a91a1bc745/lib/calabash/wait.rb#L313-L321
22,355
calabash/calabash
lib/calabash/wait.rb
Calabash.Wait.views_exist?
def views_exist?(*queries) if queries.nil? || queries.any?(&:nil?) raise ArgumentError, 'Query cannot be nil' end results = queries.map{|query| view_exists?(query)} results.all? end
ruby
def views_exist?(*queries) if queries.nil? || queries.any?(&:nil?) raise ArgumentError, 'Query cannot be nil' end results = queries.map{|query| view_exists?(query)} results.all? end
[ "def", "views_exist?", "(", "*", "queries", ")", "if", "queries", ".", "nil?", "||", "queries", ".", "any?", "(", ":nil?", ")", "raise", "ArgumentError", ",", "'Query cannot be nil'", "end", "results", "=", "queries", ".", "map", "{", "|", "query", "|", ...
Does the given `queries` all match at least one view? @param [String, Hash, Calabash::Query] queries List of queries or a query @return [Boolean] Returns true if the `queries` all match at least one view @raise [ArgumentError] If given an invalid list of queries
[ "Does", "the", "given", "queries", "all", "match", "at", "least", "one", "view?" ]
fac1ce9fcff6e2460c6e72a9b89d93a91a1bc745
https://github.com/calabash/calabash/blob/fac1ce9fcff6e2460c6e72a9b89d93a91a1bc745/lib/calabash/wait.rb#L330-L338
22,356
calabash/calabash
lib/calabash/wait.rb
Calabash.Wait.expect_view
def expect_view(query) if query.nil? raise ArgumentError, 'Query cannot be nil' end unless view_exists?(query) raise ViewNotFoundError, "No view matched #{Wait.parse_query_list(query)}" end true end
ruby
def expect_view(query) if query.nil? raise ArgumentError, 'Query cannot be nil' end unless view_exists?(query) raise ViewNotFoundError, "No view matched #{Wait.parse_query_list(query)}" end true end
[ "def", "expect_view", "(", "query", ")", "if", "query", ".", "nil?", "raise", "ArgumentError", ",", "'Query cannot be nil'", "end", "unless", "view_exists?", "(", "query", ")", "raise", "ViewNotFoundError", ",", "\"No view matched #{Wait.parse_query_list(query)}\"", "en...
Expect `query` to match at least one view. Raise an exception if it does not. @param [String, Hash, Calabash::Query] query Query to match a view @raise [ArgumentError] If given an invalid `query` @raise [ViewNotFoundError] If `query` does not match at least one view
[ "Expect", "query", "to", "match", "at", "least", "one", "view", ".", "Raise", "an", "exception", "if", "it", "does", "not", "." ]
fac1ce9fcff6e2460c6e72a9b89d93a91a1bc745
https://github.com/calabash/calabash/blob/fac1ce9fcff6e2460c6e72a9b89d93a91a1bc745/lib/calabash/wait.rb#L346-L357
22,357
calabash/calabash
lib/calabash/wait.rb
Calabash.Wait.expect_views
def expect_views(*queries) if queries.nil? || queries.any?(&:nil?) raise ArgumentError, 'Query cannot be nil' end unless views_exist?(*queries) raise ViewNotFoundError, "Not all queries #{Wait.parse_query_list(queries)} matched a view" end true end
ruby
def expect_views(*queries) if queries.nil? || queries.any?(&:nil?) raise ArgumentError, 'Query cannot be nil' end unless views_exist?(*queries) raise ViewNotFoundError, "Not all queries #{Wait.parse_query_list(queries)} matched a view" end true end
[ "def", "expect_views", "(", "*", "queries", ")", "if", "queries", ".", "nil?", "||", "queries", ".", "any?", "(", ":nil?", ")", "raise", "ArgumentError", ",", "'Query cannot be nil'", "end", "unless", "views_exist?", "(", "queries", ")", "raise", "ViewNotFound...
Expect `queries` to each match at least one view. Raise an exception if they do not. @param [String, Hash, Calabash::Query] queries List of queries or a query. @raise [ArgumentError] If given an invalid list of queries @raise [ViewNotFoundError] If `queries` do not all match at least one view.
[ "Expect", "queries", "to", "each", "match", "at", "least", "one", "view", ".", "Raise", "an", "exception", "if", "they", "do", "not", "." ]
fac1ce9fcff6e2460c6e72a9b89d93a91a1bc745
https://github.com/calabash/calabash/blob/fac1ce9fcff6e2460c6e72a9b89d93a91a1bc745/lib/calabash/wait.rb#L369-L380
22,358
calabash/calabash
lib/calabash/wait.rb
Calabash.Wait.do_not_expect_view
def do_not_expect_view(query) if query.nil? raise ArgumentError, 'Query cannot be nil' end if view_exists?(query) raise ViewFoundError, "A view matched #{Wait.parse_query_list(query)}" end true end
ruby
def do_not_expect_view(query) if query.nil? raise ArgumentError, 'Query cannot be nil' end if view_exists?(query) raise ViewFoundError, "A view matched #{Wait.parse_query_list(query)}" end true end
[ "def", "do_not_expect_view", "(", "query", ")", "if", "query", ".", "nil?", "raise", "ArgumentError", ",", "'Query cannot be nil'", "end", "if", "view_exists?", "(", "query", ")", "raise", "ViewFoundError", ",", "\"A view matched #{Wait.parse_query_list(query)}\"", "end...
Expect `query` to match no views. Raise an exception if it does. @param [String, Hash, Calabash::Query] query Query to match a view @raise [ArgumentError] If given an invalid `query` @raise [ViewFoundError] If `query` matches any views.
[ "Expect", "query", "to", "match", "no", "views", ".", "Raise", "an", "exception", "if", "it", "does", "." ]
fac1ce9fcff6e2460c6e72a9b89d93a91a1bc745
https://github.com/calabash/calabash/blob/fac1ce9fcff6e2460c6e72a9b89d93a91a1bc745/lib/calabash/wait.rb#L389-L399
22,359
calabash/calabash
lib/calabash/wait.rb
Calabash.Wait.do_not_expect_views
def do_not_expect_views(*queries) if queries.nil? || queries.any?(&:nil?) raise ArgumentError, 'Query cannot be nil' end if queries.map{|query| view_exists?(query)}.any? raise ViewFoundError, "Some views matched #{Wait.parse_query_list(queries)}" end true ...
ruby
def do_not_expect_views(*queries) if queries.nil? || queries.any?(&:nil?) raise ArgumentError, 'Query cannot be nil' end if queries.map{|query| view_exists?(query)}.any? raise ViewFoundError, "Some views matched #{Wait.parse_query_list(queries)}" end true ...
[ "def", "do_not_expect_views", "(", "*", "queries", ")", "if", "queries", ".", "nil?", "||", "queries", ".", "any?", "(", ":nil?", ")", "raise", "ArgumentError", ",", "'Query cannot be nil'", "end", "if", "queries", ".", "map", "{", "|", "query", "|", "view...
Expect `queries` to each match no views. Raise an exception if they do. @param [String, Hash, Calabash::Query] queries List of queries or a query. @raise [ArgumentError] If given an invalid list of queries @raise [ViewFoundError] If one of `queries` matched any views
[ "Expect", "queries", "to", "each", "match", "no", "views", ".", "Raise", "an", "exception", "if", "they", "do", "." ]
fac1ce9fcff6e2460c6e72a9b89d93a91a1bc745
https://github.com/calabash/calabash/blob/fac1ce9fcff6e2460c6e72a9b89d93a91a1bc745/lib/calabash/wait.rb#L409-L420
22,360
calabash/calabash
lib/calabash/wait.rb
Calabash.Wait.wait_for_text
def wait_for_text(text, timeout: Calabash::Wait.default_options[:timeout], timeout_message: nil, retry_frequency: Calabash::Wait.default_options[:retry_frequency]) wait_for_view("* {text CONTAINS[c] '#{text}'}", timeout: timeou...
ruby
def wait_for_text(text, timeout: Calabash::Wait.default_options[:timeout], timeout_message: nil, retry_frequency: Calabash::Wait.default_options[:retry_frequency]) wait_for_view("* {text CONTAINS[c] '#{text}'}", timeout: timeou...
[ "def", "wait_for_text", "(", "text", ",", "timeout", ":", "Calabash", "::", "Wait", ".", "default_options", "[", ":timeout", "]", ",", "timeout_message", ":", "nil", ",", "retry_frequency", ":", "Calabash", "::", "Wait", ".", "default_options", "[", ":retry_fr...
Waits for a view containing `text`. @see Calabash::Wait#wait_for_view @param text [String] Text to look for @return [Object] The view matched by the text query
[ "Waits", "for", "a", "view", "containing", "text", "." ]
fac1ce9fcff6e2460c6e72a9b89d93a91a1bc745
https://github.com/calabash/calabash/blob/fac1ce9fcff6e2460c6e72a9b89d93a91a1bc745/lib/calabash/wait.rb#L430-L439
22,361
calabash/calabash
lib/calabash/wait.rb
Calabash.Wait.wait_for_no_text
def wait_for_no_text(text, timeout: Calabash::Wait.default_options[:timeout], timeout_message: nil, retry_frequency: Calabash::Wait.default_options[:retry_frequency]) wait_for_no_view("* {text CONTAINS[c] '#{text}'}", ...
ruby
def wait_for_no_text(text, timeout: Calabash::Wait.default_options[:timeout], timeout_message: nil, retry_frequency: Calabash::Wait.default_options[:retry_frequency]) wait_for_no_view("* {text CONTAINS[c] '#{text}'}", ...
[ "def", "wait_for_no_text", "(", "text", ",", "timeout", ":", "Calabash", "::", "Wait", ".", "default_options", "[", ":timeout", "]", ",", "timeout_message", ":", "nil", ",", "retry_frequency", ":", "Calabash", "::", "Wait", ".", "default_options", "[", ":retry...
Waits for no views containing `text`. @see Calabash::Wait#wait_for_view @param text [String] Text to look for @return [Object] The view matched by the text query
[ "Waits", "for", "no", "views", "containing", "text", "." ]
fac1ce9fcff6e2460c6e72a9b89d93a91a1bc745
https://github.com/calabash/calabash/blob/fac1ce9fcff6e2460c6e72a9b89d93a91a1bc745/lib/calabash/wait.rb#L447-L456
22,362
dicom/ruby-dicom
lib/dicom/audit_trail.rb
DICOM.AuditTrail.add_record
def add_record(tag, original, replacement) @dictionary[tag] = Hash.new unless @dictionary.key?(tag) @dictionary[tag][original] = replacement end
ruby
def add_record(tag, original, replacement) @dictionary[tag] = Hash.new unless @dictionary.key?(tag) @dictionary[tag][original] = replacement end
[ "def", "add_record", "(", "tag", ",", "original", ",", "replacement", ")", "@dictionary", "[", "tag", "]", "=", "Hash", ".", "new", "unless", "@dictionary", ".", "key?", "(", "tag", ")", "@dictionary", "[", "tag", "]", "[", "original", "]", "=", "repla...
Creates a new AuditTrail instance. Adds a tag record to the log. @param [String] tag the tag string (e.q. '0010,0010') @param [String, Integer, Float] original the original value (e.q. 'John Doe') @param [String, Integer, Float] replacement the replacement value (e.q. 'Patient1')
[ "Creates", "a", "new", "AuditTrail", "instance", "." ]
3ffcfe21edc8dcd31298f945781990789fc832ab
https://github.com/dicom/ruby-dicom/blob/3ffcfe21edc8dcd31298f945781990789fc832ab/lib/dicom/audit_trail.rb#L41-L44
22,363
dicom/ruby-dicom
lib/dicom/audit_trail.rb
DICOM.AuditTrail.original
def original(tag, replacement) original = nil if @dictionary.key?(tag) original = @dictionary[tag].key(replacement) end return original end
ruby
def original(tag, replacement) original = nil if @dictionary.key?(tag) original = @dictionary[tag].key(replacement) end return original end
[ "def", "original", "(", "tag", ",", "replacement", ")", "original", "=", "nil", "if", "@dictionary", ".", "key?", "(", "tag", ")", "original", "=", "@dictionary", "[", "tag", "]", ".", "key", "(", "replacement", ")", "end", "return", "original", "end" ]
Retrieves the original value used for the given combination of tag & replacement value. @param [String] tag the tag string (e.q. '0010,0010') @param [String, Integer, Float] replacement the replacement value (e.q. 'Patient1') @return [String, Integer, Float] the original value of the given tag
[ "Retrieves", "the", "original", "value", "used", "for", "the", "given", "combination", "of", "tag", "&", "replacement", "value", "." ]
3ffcfe21edc8dcd31298f945781990789fc832ab
https://github.com/dicom/ruby-dicom/blob/3ffcfe21edc8dcd31298f945781990789fc832ab/lib/dicom/audit_trail.rb#L60-L66
22,364
dicom/ruby-dicom
lib/dicom/audit_trail.rb
DICOM.AuditTrail.replacement
def replacement(tag, original) replacement = nil replacement = @dictionary[tag][original] if @dictionary.key?(tag) return replacement end
ruby
def replacement(tag, original) replacement = nil replacement = @dictionary[tag][original] if @dictionary.key?(tag) return replacement end
[ "def", "replacement", "(", "tag", ",", "original", ")", "replacement", "=", "nil", "replacement", "=", "@dictionary", "[", "tag", "]", "[", "original", "]", "if", "@dictionary", ".", "key?", "(", "tag", ")", "return", "replacement", "end" ]
Retrieves the replacement value used for the given combination of tag & original value. @param [String] tag the tag string (e.q. '0010,0010') @param [String, Integer, Float] original the original value (e.q. 'John Doe') @return [String, Integer, Float] the replacement value of the given tag
[ "Retrieves", "the", "replacement", "value", "used", "for", "the", "given", "combination", "of", "tag", "&", "original", "value", "." ]
3ffcfe21edc8dcd31298f945781990789fc832ab
https://github.com/dicom/ruby-dicom/blob/3ffcfe21edc8dcd31298f945781990789fc832ab/lib/dicom/audit_trail.rb#L87-L91
22,365
dicom/ruby-dicom
lib/dicom/d_object.rb
DICOM.DObject.encode_segments
def encode_segments(max_size, transfer_syntax=IMPLICIT_LITTLE_ENDIAN) raise ArgumentError, "Invalid argument. Expected an Integer, got #{max_size.class}." unless max_size.is_a?(Integer) raise ArgumentError, "Argument too low (#{max_size}), please specify a bigger Integer." unless max_size > 16 raise "...
ruby
def encode_segments(max_size, transfer_syntax=IMPLICIT_LITTLE_ENDIAN) raise ArgumentError, "Invalid argument. Expected an Integer, got #{max_size.class}." unless max_size.is_a?(Integer) raise ArgumentError, "Argument too low (#{max_size}), please specify a bigger Integer." unless max_size > 16 raise "...
[ "def", "encode_segments", "(", "max_size", ",", "transfer_syntax", "=", "IMPLICIT_LITTLE_ENDIAN", ")", "raise", "ArgumentError", ",", "\"Invalid argument. Expected an Integer, got #{max_size.class}.\"", "unless", "max_size", ".", "is_a?", "(", "Integer", ")", "raise", "Argu...
Encodes the DICOM object into a series of binary string segments with a specified maximum length. Returns the encoded binary strings in an array. @param [Integer] max_size the maximum allowed size of the binary data strings to be encoded @param [String] transfer_syntax the transfer syntax string to be used when en...
[ "Encodes", "the", "DICOM", "object", "into", "a", "series", "of", "binary", "string", "segments", "with", "a", "specified", "maximum", "length", "." ]
3ffcfe21edc8dcd31298f945781990789fc832ab
https://github.com/dicom/ruby-dicom/blob/3ffcfe21edc8dcd31298f945781990789fc832ab/lib/dicom/d_object.rb#L230-L235
22,366
dicom/ruby-dicom
lib/dicom/d_object.rb
DICOM.DObject.summary
def summary # FIXME: Perhaps this method should be split up in one or two separate methods # which just builds the information arrays, and a third method for printing this to the screen. sys_info = Array.new info = Array.new # Version of Ruby DICOM used: sys_info << "Ruby DICOM versi...
ruby
def summary # FIXME: Perhaps this method should be split up in one or two separate methods # which just builds the information arrays, and a third method for printing this to the screen. sys_info = Array.new info = Array.new # Version of Ruby DICOM used: sys_info << "Ruby DICOM versi...
[ "def", "summary", "# FIXME: Perhaps this method should be split up in one or two separate methods", "# which just builds the information arrays, and a third method for printing this to the screen.", "sys_info", "=", "Array", ".", "new", "info", "=", "Array", ".", "new", "# Version of Rub...
Gathers key information about the DObject as well as some system data, and prints this information to the screen. This information includes properties like encoding, byte order, modality and various image properties. @return [Array<String>] strings describing the properties of the DICOM object
[ "Gathers", "key", "information", "about", "the", "DObject", "as", "well", "as", "some", "system", "data", "and", "prints", "this", "information", "to", "the", "screen", ".", "This", "information", "includes", "properties", "like", "encoding", "byte", "order", ...
3ffcfe21edc8dcd31298f945781990789fc832ab
https://github.com/dicom/ruby-dicom/blob/3ffcfe21edc8dcd31298f945781990789fc832ab/lib/dicom/d_object.rb#L261-L336
22,367
dicom/ruby-dicom
lib/dicom/d_object.rb
DICOM.DObject.transfer_syntax=
def transfer_syntax=(new_syntax) # Verify old and new transfer syntax: new_uid = LIBRARY.uid(new_syntax) old_uid = LIBRARY.uid(transfer_syntax) raise ArgumentError, "Invalid/unknown transfer syntax specified: #{new_syntax}" unless new_uid && new_uid.transfer_syntax? raise ArgumentError, "I...
ruby
def transfer_syntax=(new_syntax) # Verify old and new transfer syntax: new_uid = LIBRARY.uid(new_syntax) old_uid = LIBRARY.uid(transfer_syntax) raise ArgumentError, "Invalid/unknown transfer syntax specified: #{new_syntax}" unless new_uid && new_uid.transfer_syntax? raise ArgumentError, "I...
[ "def", "transfer_syntax", "=", "(", "new_syntax", ")", "# Verify old and new transfer syntax:", "new_uid", "=", "LIBRARY", ".", "uid", "(", "new_syntax", ")", "old_uid", "=", "LIBRARY", ".", "uid", "(", "transfer_syntax", ")", "raise", "ArgumentError", ",", "\"Inv...
Changes the transfer syntax Element of the DObject instance, and performs re-encoding of all numerical values if a switch of endianness is implied. @note This method does not change the compressed state of the pixel data element. Changing the transfer syntax between an uncompressed and compressed state will NOT cha...
[ "Changes", "the", "transfer", "syntax", "Element", "of", "the", "DObject", "instance", "and", "performs", "re", "-", "encoding", "of", "all", "numerical", "values", "if", "a", "switch", "of", "endianness", "is", "implied", "." ]
3ffcfe21edc8dcd31298f945781990789fc832ab
https://github.com/dicom/ruby-dicom/blob/3ffcfe21edc8dcd31298f945781990789fc832ab/lib/dicom/d_object.rb#L365-L381
22,368
dicom/ruby-dicom
lib/dicom/d_object.rb
DICOM.DObject.write
def write(file_name, options={}) raise ArgumentError, "Invalid file_name. Expected String, got #{file_name.class}." unless file_name.is_a?(String) @include_empty_parents = options[:include_empty_parents] insert_missing_meta unless options[:ignore_meta] write_elements(:file_name => file_name, :si...
ruby
def write(file_name, options={}) raise ArgumentError, "Invalid file_name. Expected String, got #{file_name.class}." unless file_name.is_a?(String) @include_empty_parents = options[:include_empty_parents] insert_missing_meta unless options[:ignore_meta] write_elements(:file_name => file_name, :si...
[ "def", "write", "(", "file_name", ",", "options", "=", "{", "}", ")", "raise", "ArgumentError", ",", "\"Invalid file_name. Expected String, got #{file_name.class}.\"", "unless", "file_name", ".", "is_a?", "(", "String", ")", "@include_empty_parents", "=", "options", "...
Writes the DICOM object to file. @note The goal of the Ruby DICOM library is to yield maximum conformance with the DICOM standard when outputting DICOM files. Therefore, when encoding the DICOM file, manipulation of items such as the meta group, group lengths and header signature may occur. Therefore, the file tha...
[ "Writes", "the", "DICOM", "object", "to", "file", "." ]
3ffcfe21edc8dcd31298f945781990789fc832ab
https://github.com/dicom/ruby-dicom/blob/3ffcfe21edc8dcd31298f945781990789fc832ab/lib/dicom/d_object.rb#L398-L403
22,369
dicom/ruby-dicom
lib/dicom/d_object.rb
DICOM.DObject.meta_group_length
def meta_group_length group_length = 0 meta_elements = group(META_GROUP) tag = 4 vr = 2 meta_elements.each do |element| case element.vr when "OB","OW","OF","SQ","UN","UT" length = 6 else length = 2 end group_length += tag ...
ruby
def meta_group_length group_length = 0 meta_elements = group(META_GROUP) tag = 4 vr = 2 meta_elements.each do |element| case element.vr when "OB","OW","OF","SQ","UN","UT" length = 6 else length = 2 end group_length += tag ...
[ "def", "meta_group_length", "group_length", "=", "0", "meta_elements", "=", "group", "(", "META_GROUP", ")", "tag", "=", "4", "vr", "=", "2", "meta_elements", ".", "each", "do", "|", "element", "|", "case", "element", ".", "vr", "when", "\"OB\"", ",", "\...
Determines the length of the meta group in the DObject instance. @return [Integer] the length of the file meta group string
[ "Determines", "the", "length", "of", "the", "meta", "group", "in", "the", "DObject", "instance", "." ]
3ffcfe21edc8dcd31298f945781990789fc832ab
https://github.com/dicom/ruby-dicom/blob/3ffcfe21edc8dcd31298f945781990789fc832ab/lib/dicom/d_object.rb#L438-L453
22,370
dicom/ruby-dicom
lib/dicom/image_item.rb
DICOM.ImageItem.add_element
def add_element(tag, value, options={}) add(e = Element.new(tag, value, options)) e end
ruby
def add_element(tag, value, options={}) add(e = Element.new(tag, value, options)) e end
[ "def", "add_element", "(", "tag", ",", "value", ",", "options", "=", "{", "}", ")", "add", "(", "e", "=", "Element", ".", "new", "(", "tag", ",", "value", ",", "options", ")", ")", "e", "end" ]
Creates an Element with the given arguments and connects it to self. @param [String] tag an element tag @param [String, Integer, Float, Array, NilClass] value an element value @param [Hash] options any options used for creating the element (see Element.new documentation)
[ "Creates", "an", "Element", "with", "the", "given", "arguments", "and", "connects", "it", "to", "self", "." ]
3ffcfe21edc8dcd31298f945781990789fc832ab
https://github.com/dicom/ruby-dicom/blob/3ffcfe21edc8dcd31298f945781990789fc832ab/lib/dicom/image_item.rb#L23-L26
22,371
dicom/ruby-dicom
lib/dicom/image_item.rb
DICOM.ImageItem.add_sequence
def add_sequence(tag, options={}) add(s = Sequence.new(tag, options)) s end
ruby
def add_sequence(tag, options={}) add(s = Sequence.new(tag, options)) s end
[ "def", "add_sequence", "(", "tag", ",", "options", "=", "{", "}", ")", "add", "(", "s", "=", "Sequence", ".", "new", "(", "tag", ",", "options", ")", ")", "s", "end" ]
Creates a Sequence with the given arguments and connects it to self. @param [String] tag a sequence tag @param [Hash] options any options used for creating the sequence (see Sequence.new documentation)
[ "Creates", "a", "Sequence", "with", "the", "given", "arguments", "and", "connects", "it", "to", "self", "." ]
3ffcfe21edc8dcd31298f945781990789fc832ab
https://github.com/dicom/ruby-dicom/blob/3ffcfe21edc8dcd31298f945781990789fc832ab/lib/dicom/image_item.rb#L33-L36
22,372
dicom/ruby-dicom
lib/dicom/image_item.rb
DICOM.ImageItem.color?
def color? # "Photometric Interpretation" is contained in the data element "0028,0004": begin photometric = photometry if photometric.include?('COLOR') or photometric.include?('RGB') or photometric.include?('YBR') return true else return false end re...
ruby
def color? # "Photometric Interpretation" is contained in the data element "0028,0004": begin photometric = photometry if photometric.include?('COLOR') or photometric.include?('RGB') or photometric.include?('YBR') return true else return false end re...
[ "def", "color?", "# \"Photometric Interpretation\" is contained in the data element \"0028,0004\":", "begin", "photometric", "=", "photometry", "if", "photometric", ".", "include?", "(", "'COLOR'", ")", "or", "photometric", ".", "include?", "(", "'RGB'", ")", "or", "photo...
Checks if colored pixel data is present. @return [Boolean] true if the object contains colored pixels, and false if not
[ "Checks", "if", "colored", "pixel", "data", "is", "present", "." ]
3ffcfe21edc8dcd31298f945781990789fc832ab
https://github.com/dicom/ruby-dicom/blob/3ffcfe21edc8dcd31298f945781990789fc832ab/lib/dicom/image_item.rb#L42-L54
22,373
dicom/ruby-dicom
lib/dicom/image_item.rb
DICOM.ImageItem.decode_pixels
def decode_pixels(bin, stream=@stream) raise ArgumentError, "Expected String, got #{bin.class}." unless bin.is_a?(String) pixels = false # We need to know what kind of bith depth and integer type the pixel data is saved with: bit_depth_element = self['0028,0100'] pixel_representation_eleme...
ruby
def decode_pixels(bin, stream=@stream) raise ArgumentError, "Expected String, got #{bin.class}." unless bin.is_a?(String) pixels = false # We need to know what kind of bith depth and integer type the pixel data is saved with: bit_depth_element = self['0028,0100'] pixel_representation_eleme...
[ "def", "decode_pixels", "(", "bin", ",", "stream", "=", "@stream", ")", "raise", "ArgumentError", ",", "\"Expected String, got #{bin.class}.\"", "unless", "bin", ".", "is_a?", "(", "String", ")", "pixels", "=", "false", "# We need to know what kind of bith depth and int...
Unpacks pixel values from a binary pixel string. The decode is performed using values defined in the image related elements of the DObject instance. @param [String] bin a binary string containing the pixels to be decoded @param [Stream] stream a Stream instance to be used for decoding the pixels (optional) @return...
[ "Unpacks", "pixel", "values", "from", "a", "binary", "pixel", "string", ".", "The", "decode", "is", "performed", "using", "values", "defined", "in", "the", "image", "related", "elements", "of", "the", "DObject", "instance", "." ]
3ffcfe21edc8dcd31298f945781990789fc832ab
https://github.com/dicom/ruby-dicom/blob/3ffcfe21edc8dcd31298f945781990789fc832ab/lib/dicom/image_item.rb#L76-L92
22,374
dicom/ruby-dicom
lib/dicom/image_item.rb
DICOM.ImageItem.encode_pixels
def encode_pixels(pixels, stream=@stream) raise ArgumentError, "Expected Array, got #{pixels.class}." unless pixels.is_a?(Array) bin = false # We need to know what kind of bith depth and integer type the pixel data is saved with: bit_depth_element = self['0028,0100'] pixel_representation_e...
ruby
def encode_pixels(pixels, stream=@stream) raise ArgumentError, "Expected Array, got #{pixels.class}." unless pixels.is_a?(Array) bin = false # We need to know what kind of bith depth and integer type the pixel data is saved with: bit_depth_element = self['0028,0100'] pixel_representation_e...
[ "def", "encode_pixels", "(", "pixels", ",", "stream", "=", "@stream", ")", "raise", "ArgumentError", ",", "\"Expected Array, got #{pixels.class}.\"", "unless", "pixels", ".", "is_a?", "(", "Array", ")", "bin", "=", "false", "# We need to know what kind of bith depth and...
Packs a pixel value array to a binary pixel string. The encoding is performed using values defined in the image related elements of the DObject instance. @param [Array<Integer>] pixels an array containing the pixel values to be encoded @param [Stream] stream a Stream instance to be used for encoding the pixels (opt...
[ "Packs", "a", "pixel", "value", "array", "to", "a", "binary", "pixel", "string", ".", "The", "encoding", "is", "performed", "using", "values", "defined", "in", "the", "image", "related", "elements", "of", "the", "DObject", "instance", "." ]
3ffcfe21edc8dcd31298f945781990789fc832ab
https://github.com/dicom/ruby-dicom/blob/3ffcfe21edc8dcd31298f945781990789fc832ab/lib/dicom/image_item.rb#L101-L115
22,375
dicom/ruby-dicom
lib/dicom/image_item.rb
DICOM.ImageItem.images
def images(options={}) images = Array.new if exists?(PIXEL_TAG) # Gather the pixel data strings, and pick a single frame if indicated by options: strings = image_strings(split_to_frames=true) strings = [strings[options[:frame]]] if options[:frame] if compression? # ...
ruby
def images(options={}) images = Array.new if exists?(PIXEL_TAG) # Gather the pixel data strings, and pick a single frame if indicated by options: strings = image_strings(split_to_frames=true) strings = [strings[options[:frame]]] if options[:frame] if compression? # ...
[ "def", "images", "(", "options", "=", "{", "}", ")", "images", "=", "Array", ".", "new", "if", "exists?", "(", "PIXEL_TAG", ")", "# Gather the pixel data strings, and pick a single frame if indicated by options:", "strings", "=", "image_strings", "(", "split_to_frames",...
Extracts an array of image objects, created from the encoded pixel data using the image related elements in the DICOM object. @note Creates an array of image objects in accordance with the selected image processor. Available processors are :rmagick and :mini_magick. @param [Hash] options the options to use for ext...
[ "Extracts", "an", "array", "of", "image", "objects", "created", "from", "the", "encoded", "pixel", "data", "using", "the", "image", "related", "elements", "in", "the", "DICOM", "object", "." ]
3ffcfe21edc8dcd31298f945781990789fc832ab
https://github.com/dicom/ruby-dicom/blob/3ffcfe21edc8dcd31298f945781990789fc832ab/lib/dicom/image_item.rb#L164-L198
22,376
dicom/ruby-dicom
lib/dicom/image_item.rb
DICOM.ImageItem.image_to_file
def image_to_file(file) raise ArgumentError, "Expected #{String}, got #{file.class}." unless file.is_a?(String) # Split the file name in case of multiple fragments: parts = file.split('.') if parts.length > 1 base = parts[0..-2].join extension = '.' + parts.last else ...
ruby
def image_to_file(file) raise ArgumentError, "Expected #{String}, got #{file.class}." unless file.is_a?(String) # Split the file name in case of multiple fragments: parts = file.split('.') if parts.length > 1 base = parts[0..-2].join extension = '.' + parts.last else ...
[ "def", "image_to_file", "(", "file", ")", "raise", "ArgumentError", ",", "\"Expected #{String}, got #{file.class}.\"", "unless", "file", ".", "is_a?", "(", "String", ")", "# Split the file name in case of multiple fragments:", "parts", "=", "file", ".", "split", "(", "'...
Dumps the binary content of the Pixel Data element to the specified file. If the DICOM object contains multi-fragment pixel data, each fragment will be dumped to separate files (e.q. 'fragment-0.dat', 'fragment-1.dat'). @param [String] file a string which specifies the file path to use when dumping the pixel data ...
[ "Dumps", "the", "binary", "content", "of", "the", "Pixel", "Data", "element", "to", "the", "specified", "file", "." ]
3ffcfe21edc8dcd31298f945781990789fc832ab
https://github.com/dicom/ruby-dicom/blob/3ffcfe21edc8dcd31298f945781990789fc832ab/lib/dicom/image_item.rb#L251-L273
22,377
dicom/ruby-dicom
lib/dicom/image_item.rb
DICOM.ImageItem.pixels
def pixels(options={}) pixels = nil if exists?(PIXEL_TAG) # For now we only support returning pixel data of the first frame, if the image is located in multiple pixel data items: if compression? pixels = decompress(image_strings.first) else pixels = decode_pixels(...
ruby
def pixels(options={}) pixels = nil if exists?(PIXEL_TAG) # For now we only support returning pixel data of the first frame, if the image is located in multiple pixel data items: if compression? pixels = decompress(image_strings.first) else pixels = decode_pixels(...
[ "def", "pixels", "(", "options", "=", "{", "}", ")", "pixels", "=", "nil", "if", "exists?", "(", "PIXEL_TAG", ")", "# For now we only support returning pixel data of the first frame, if the image is located in multiple pixel data items:", "if", "compression?", "pixels", "=", ...
Extracts the Pixel Data values in an ordinary Ruby Array. Returns nil if no pixel data is present, and false if it fails to retrieve pixel data which is present. The returned array does not carry the dimensions of the pixel data: It is put in a one dimensional Array (vector). @param [Hash] options the options to ...
[ "Extracts", "the", "Pixel", "Data", "values", "in", "an", "ordinary", "Ruby", "Array", ".", "Returns", "nil", "if", "no", "pixel", "data", "is", "present", "and", "false", "if", "it", "fails", "to", "retrieve", "pixel", "data", "which", "is", "present", ...
3ffcfe21edc8dcd31298f945781990789fc832ab
https://github.com/dicom/ruby-dicom/blob/3ffcfe21edc8dcd31298f945781990789fc832ab/lib/dicom/image_item.rb#L392-L417
22,378
dicom/ruby-dicom
lib/dicom/image_item.rb
DICOM.ImageItem.decode_rle
def decode_rle(cols, rows, string) # FIXME: Remove cols and rows (were only added for debugging). pixels = Array.new # RLE header specifying the number of segments: header = string[0...64].unpack('L*') image_segments = Array.new # Extracting all start and endpoints of the different s...
ruby
def decode_rle(cols, rows, string) # FIXME: Remove cols and rows (were only added for debugging). pixels = Array.new # RLE header specifying the number of segments: header = string[0...64].unpack('L*') image_segments = Array.new # Extracting all start and endpoints of the different s...
[ "def", "decode_rle", "(", "cols", ",", "rows", ",", "string", ")", "# FIXME: Remove cols and rows (were only added for debugging).", "pixels", "=", "Array", ".", "new", "# RLE header specifying the number of segments:", "header", "=", "string", "[", "0", "...", "64", "]...
Performs a run length decoding on the input stream. @note For details on RLE encoding, refer to the DICOM standard, PS3.5, Section 8.2.2 as well as Annex G. @param [Integer] cols number of colums of the encoded image @param [Integer] rows number of rows of the encoded image @param [Integer] string the encoded pix...
[ "Performs", "a", "run", "length", "decoding", "on", "the", "input", "stream", "." ]
3ffcfe21edc8dcd31298f945781990789fc832ab
https://github.com/dicom/ruby-dicom/blob/3ffcfe21edc8dcd31298f945781990789fc832ab/lib/dicom/image_item.rb#L491-L536
22,379
dicom/ruby-dicom
lib/dicom/image_item.rb
DICOM.ImageItem.process_presentation_values
def process_presentation_values(pixel_data, min_allowed, max_allowed, level=nil) # Process pixel data for presentation according to the image information in the DICOM object: center, width, intercept, slope = window_level_values # Have image leveling been requested? if level # If custom ...
ruby
def process_presentation_values(pixel_data, min_allowed, max_allowed, level=nil) # Process pixel data for presentation according to the image information in the DICOM object: center, width, intercept, slope = window_level_values # Have image leveling been requested? if level # If custom ...
[ "def", "process_presentation_values", "(", "pixel_data", ",", "min_allowed", ",", "max_allowed", ",", "level", "=", "nil", ")", "# Process pixel data for presentation according to the image information in the DICOM object:", "center", ",", "width", ",", "intercept", ",", "slo...
Converts original pixel data values to presentation values. @param [Array<Integer>] pixel_data an array of pixel values (integers) @param [Integer] min_allowed the minimum value allowed in the pixel data @param [Integer] max_allowed the maximum value allowed in the pixel data @param [Boolean, Array<Integer>] level...
[ "Converts", "original", "pixel", "data", "values", "to", "presentation", "values", "." ]
3ffcfe21edc8dcd31298f945781990789fc832ab
https://github.com/dicom/ruby-dicom/blob/3ffcfe21edc8dcd31298f945781990789fc832ab/lib/dicom/image_item.rb#L609-L655
22,380
dicom/ruby-dicom
lib/dicom/image_item.rb
DICOM.ImageItem.process_presentation_values_narray
def process_presentation_values_narray(pixel_data, min_allowed, max_allowed, level=nil) # Process pixel data for presentation according to the image information in the DICOM object: center, width, intercept, slope = window_level_values # Have image leveling been requested? if level # If ...
ruby
def process_presentation_values_narray(pixel_data, min_allowed, max_allowed, level=nil) # Process pixel data for presentation according to the image information in the DICOM object: center, width, intercept, slope = window_level_values # Have image leveling been requested? if level # If ...
[ "def", "process_presentation_values_narray", "(", "pixel_data", ",", "min_allowed", ",", "max_allowed", ",", "level", "=", "nil", ")", "# Process pixel data for presentation according to the image information in the DICOM object:", "center", ",", "width", ",", "intercept", ",",...
Converts original pixel data values to presentation values, using the efficient NArray library. @note If a Ruby Array is supplied, the method returns a one-dimensional NArray object (i.e. no columns & rows). @note If a NArray is supplied, the NArray is returned with its original dimensions. @param [Array<Integer>,...
[ "Converts", "original", "pixel", "data", "values", "to", "presentation", "values", "using", "the", "efficient", "NArray", "library", "." ]
3ffcfe21edc8dcd31298f945781990789fc832ab
https://github.com/dicom/ruby-dicom/blob/3ffcfe21edc8dcd31298f945781990789fc832ab/lib/dicom/image_item.rb#L668-L716
22,381
dicom/ruby-dicom
lib/dicom/image_item.rb
DICOM.ImageItem.read_image
def read_image(pixel_data, columns, rows, options={}) raise ArgumentError, "Expected Array for pixel_data, got #{pixel_data.class}" unless pixel_data.is_a?(Array) raise ArgumentError, "Expected Integer for columns, got #{columns.class}" unless columns.is_a?(Integer) raise ArgumentError, "Expected Rows...
ruby
def read_image(pixel_data, columns, rows, options={}) raise ArgumentError, "Expected Array for pixel_data, got #{pixel_data.class}" unless pixel_data.is_a?(Array) raise ArgumentError, "Expected Integer for columns, got #{columns.class}" unless columns.is_a?(Integer) raise ArgumentError, "Expected Rows...
[ "def", "read_image", "(", "pixel_data", ",", "columns", ",", "rows", ",", "options", "=", "{", "}", ")", "raise", "ArgumentError", ",", "\"Expected Array for pixel_data, got #{pixel_data.class}\"", "unless", "pixel_data", ".", "is_a?", "(", "Array", ")", "raise", ...
Creates an image object from the specified pixel value array, performing presentation value processing if requested. @note Definitions for Window Center and Width can be found in the DICOM standard, PS 3.3 C.11.2.1.2 @param [Array<Integer>] pixel_data an array of pixel values @param [Integer] columns the number o...
[ "Creates", "an", "image", "object", "from", "the", "specified", "pixel", "value", "array", "performing", "presentation", "value", "processing", "if", "requested", "." ]
3ffcfe21edc8dcd31298f945781990789fc832ab
https://github.com/dicom/ruby-dicom/blob/3ffcfe21edc8dcd31298f945781990789fc832ab/lib/dicom/image_item.rb#L732-L751
22,382
dicom/ruby-dicom
lib/dicom/image_item.rb
DICOM.ImageItem.window_level_values
def window_level_values center = (self['0028,1050'].is_a?(Element) == true ? self['0028,1050'].value.to_i : nil) width = (self['0028,1051'].is_a?(Element) == true ? self['0028,1051'].value.to_i : nil) intercept = (self['0028,1052'].is_a?(Element) == true ? self['0028,1052'].value.to_i : 0) slope...
ruby
def window_level_values center = (self['0028,1050'].is_a?(Element) == true ? self['0028,1050'].value.to_i : nil) width = (self['0028,1051'].is_a?(Element) == true ? self['0028,1051'].value.to_i : nil) intercept = (self['0028,1052'].is_a?(Element) == true ? self['0028,1052'].value.to_i : 0) slope...
[ "def", "window_level_values", "center", "=", "(", "self", "[", "'0028,1050'", "]", ".", "is_a?", "(", "Element", ")", "==", "true", "?", "self", "[", "'0028,1050'", "]", ".", "value", ".", "to_i", ":", "nil", ")", "width", "=", "(", "self", "[", "'00...
Collects the window level values needed to convert the original pixel values to presentation values. @note If some of these values are missing in the DObject instance, default values are used instead for intercept and slope, while center and width are set to nil. No errors are raised. @return [Array<Integer, ...
[ "Collects", "the", "window", "level", "values", "needed", "to", "convert", "the", "original", "pixel", "values", "to", "presentation", "values", "." ]
3ffcfe21edc8dcd31298f945781990789fc832ab
https://github.com/dicom/ruby-dicom/blob/3ffcfe21edc8dcd31298f945781990789fc832ab/lib/dicom/image_item.rb#L813-L819
22,383
dicom/ruby-dicom
lib/dicom/image_item.rb
DICOM.ImageItem.write_pixels
def write_pixels(bin) if self.exists?(PIXEL_TAG) # Update existing Data Element: self[PIXEL_TAG].bin = bin else # Create new Data Element: pixel_element = Element.new(PIXEL_TAG, bin, :encoded => true, :parent => self) end end
ruby
def write_pixels(bin) if self.exists?(PIXEL_TAG) # Update existing Data Element: self[PIXEL_TAG].bin = bin else # Create new Data Element: pixel_element = Element.new(PIXEL_TAG, bin, :encoded => true, :parent => self) end end
[ "def", "write_pixels", "(", "bin", ")", "if", "self", ".", "exists?", "(", "PIXEL_TAG", ")", "# Update existing Data Element:", "self", "[", "PIXEL_TAG", "]", ".", "bin", "=", "bin", "else", "# Create new Data Element:", "pixel_element", "=", "Element", ".", "ne...
Transfers a pre-encoded binary string to the pixel data element, either by overwriting the existing element value, or creating a new "Pixel Data" element. @param [String] bin a binary string containing encoded pixel data
[ "Transfers", "a", "pre", "-", "encoded", "binary", "string", "to", "the", "pixel", "data", "element", "either", "by", "overwriting", "the", "existing", "element", "value", "or", "creating", "a", "new", "Pixel", "Data", "element", "." ]
3ffcfe21edc8dcd31298f945781990789fc832ab
https://github.com/dicom/ruby-dicom/blob/3ffcfe21edc8dcd31298f945781990789fc832ab/lib/dicom/image_item.rb#L826-L834
22,384
dicom/ruby-dicom
lib/dicom/d_read.rb
DICOM.Parent.parse
def parse(bin, syntax, switched=false, explicit=true) raise ArgumentError, "Invalid argument 'bin'. Expected String, got #{bin.class}." unless bin.is_a?(String) raise ArgumentError, "Invalid argument 'syntax'. Expected String, got #{syntax.class}." unless syntax.is_a?(String) read(bin, signature=false...
ruby
def parse(bin, syntax, switched=false, explicit=true) raise ArgumentError, "Invalid argument 'bin'. Expected String, got #{bin.class}." unless bin.is_a?(String) raise ArgumentError, "Invalid argument 'syntax'. Expected String, got #{syntax.class}." unless syntax.is_a?(String) read(bin, signature=false...
[ "def", "parse", "(", "bin", ",", "syntax", ",", "switched", "=", "false", ",", "explicit", "=", "true", ")", "raise", "ArgumentError", ",", "\"Invalid argument 'bin'. Expected String, got #{bin.class}.\"", "unless", "bin", ".", "is_a?", "(", "String", ")", "raise"...
Loads data from an encoded DICOM string and creates items and elements which are linked to this instance. @param [String] bin an encoded binary string containing DICOM information @param [String] syntax the transfer syntax to use when decoding the DICOM string @param [Boolean] switched indicating whether the trans...
[ "Loads", "data", "from", "an", "encoded", "DICOM", "string", "and", "creates", "items", "and", "elements", "which", "are", "linked", "to", "this", "instance", "." ]
3ffcfe21edc8dcd31298f945781990789fc832ab
https://github.com/dicom/ruby-dicom/blob/3ffcfe21edc8dcd31298f945781990789fc832ab/lib/dicom/d_read.rb#L12-L16
22,385
dicom/ruby-dicom
lib/dicom/d_read.rb
DICOM.Parent.check_duplicate
def check_duplicate(tag, elemental) if @current_parent[tag] gp = @current_parent.parent ? "#{@current_parent.parent.representation} => " : '' p = @current_parent.representation logger.warn("Duplicate #{elemental} (#{tag}) detected at level: #{gp}#{p}") end end
ruby
def check_duplicate(tag, elemental) if @current_parent[tag] gp = @current_parent.parent ? "#{@current_parent.parent.representation} => " : '' p = @current_parent.representation logger.warn("Duplicate #{elemental} (#{tag}) detected at level: #{gp}#{p}") end end
[ "def", "check_duplicate", "(", "tag", ",", "elemental", ")", "if", "@current_parent", "[", "tag", "]", "gp", "=", "@current_parent", ".", "parent", "?", "\"#{@current_parent.parent.representation} => \"", ":", "''", "p", "=", "@current_parent", ".", "representation"...
Checks whether the given tag is a duplicate of an existing tag with this parent. @param [String] tag the tag of the candidate duplicate elemental @param [String] elemental the duplicate elemental type (e.g. Sequence, Element)
[ "Checks", "whether", "the", "given", "tag", "is", "a", "duplicate", "of", "an", "existing", "tag", "with", "this", "parent", "." ]
3ffcfe21edc8dcd31298f945781990789fc832ab
https://github.com/dicom/ruby-dicom/blob/3ffcfe21edc8dcd31298f945781990789fc832ab/lib/dicom/d_read.rb#L27-L33
22,386
dicom/ruby-dicom
lib/dicom/d_read.rb
DICOM.Parent.check_header
def check_header # According to the official DICOM standard, a DICOM file shall contain 128 consequtive (zero) bytes, # followed by 4 bytes that spell the string 'DICM'. Apparently, some providers seems to skip this in their DICOM files. # Check that the string is long enough to contain a valid header...
ruby
def check_header # According to the official DICOM standard, a DICOM file shall contain 128 consequtive (zero) bytes, # followed by 4 bytes that spell the string 'DICM'. Apparently, some providers seems to skip this in their DICOM files. # Check that the string is long enough to contain a valid header...
[ "def", "check_header", "# According to the official DICOM standard, a DICOM file shall contain 128 consequtive (zero) bytes,", "# followed by 4 bytes that spell the string 'DICM'. Apparently, some providers seems to skip this in their DICOM files.", "# Check that the string is long enough to contain a valid...
Checks for the official DICOM header signature. @return [Boolean] true if the proper signature is present, false if not, and nil if the string was shorter then the length of the DICOM signature
[ "Checks", "for", "the", "official", "DICOM", "header", "signature", "." ]
3ffcfe21edc8dcd31298f945781990789fc832ab
https://github.com/dicom/ruby-dicom/blob/3ffcfe21edc8dcd31298f945781990789fc832ab/lib/dicom/d_read.rb#L39-L64
22,387
dicom/ruby-dicom
lib/dicom/d_read.rb
DICOM.Parent.process_data_element
def process_data_element # FIXME: This method has grown a bit messy and isn't very pleasant to read. Cleanup possible? # After having been into a possible unknown sequence with undefined length, we may need to reset # explicitness from implicit to explicit: if !@original_explicit.nil? && @explic...
ruby
def process_data_element # FIXME: This method has grown a bit messy and isn't very pleasant to read. Cleanup possible? # After having been into a possible unknown sequence with undefined length, we may need to reset # explicitness from implicit to explicit: if !@original_explicit.nil? && @explic...
[ "def", "process_data_element", "# FIXME: This method has grown a bit messy and isn't very pleasant to read. Cleanup possible?", "# After having been into a possible unknown sequence with undefined length, we may need to reset", "# explicitness from implicit to explicit:", "if", "!", "@original_explici...
Handles the process of reading a data element from the DICOM string, and creating an element object from the parsed data. @return [Boolean] nil if end of string has been reached (in an expected way), false if the element parse failed, and true if an element was parsed successfully
[ "Handles", "the", "process", "of", "reading", "a", "data", "element", "from", "the", "DICOM", "string", "and", "creating", "an", "element", "object", "from", "the", "parsed", "data", "." ]
3ffcfe21edc8dcd31298f945781990789fc832ab
https://github.com/dicom/ruby-dicom/blob/3ffcfe21edc8dcd31298f945781990789fc832ab/lib/dicom/d_read.rb#L71-L177
22,388
dicom/ruby-dicom
lib/dicom/d_read.rb
DICOM.Parent.read
def read(string, signature=true, options={}) # (Re)Set variables: @str = string @overwrite = options[:overwrite] # Presence of the official DICOM signature: @signature = false # Default explicitness of start of DICOM string (if undefined it defaults to true): @explicit = option...
ruby
def read(string, signature=true, options={}) # (Re)Set variables: @str = string @overwrite = options[:overwrite] # Presence of the official DICOM signature: @signature = false # Default explicitness of start of DICOM string (if undefined it defaults to true): @explicit = option...
[ "def", "read", "(", "string", ",", "signature", "=", "true", ",", "options", "=", "{", "}", ")", "# (Re)Set variables:", "@str", "=", "string", "@overwrite", "=", "options", "[", ":overwrite", "]", "# Presence of the official DICOM signature:", "@signature", "=", ...
Builds a DICOM object by parsing an encoded DICOM string. @param [String] string a binary DICOM string to be parsed @param [Boolean] signature if true (default), the parsing algorithm will look for the DICOM header signature @param [Hash] options the options to use for parsing the DICOM string @option options [Boo...
[ "Builds", "a", "DICOM", "object", "by", "parsing", "an", "encoded", "DICOM", "string", "." ]
3ffcfe21edc8dcd31298f945781990789fc832ab
https://github.com/dicom/ruby-dicom/blob/3ffcfe21edc8dcd31298f945781990789fc832ab/lib/dicom/d_read.rb#L187-L257
22,389
dicom/ruby-dicom
lib/dicom/d_write.rb
DICOM.Parent.add_with_segmentation
def add_with_segmentation(string) # As the encoded DICOM string will be cut in multiple, smaller pieces, we need to monitor the length of our encoded strings: if (string.length + @stream.length) > @max_size split_and_add(string) elsif (30 + @stream.length) > @max_size # End the current...
ruby
def add_with_segmentation(string) # As the encoded DICOM string will be cut in multiple, smaller pieces, we need to monitor the length of our encoded strings: if (string.length + @stream.length) > @max_size split_and_add(string) elsif (30 + @stream.length) > @max_size # End the current...
[ "def", "add_with_segmentation", "(", "string", ")", "# As the encoded DICOM string will be cut in multiple, smaller pieces, we need to monitor the length of our encoded strings:", "if", "(", "string", ".", "length", "+", "@stream", ".", "length", ")", ">", "@max_size", "split_and...
Adds an encoded string to the output stream, while keeping track of the accumulated size of the output stream, splitting it up as necessary, and transferring the encoded string fragments to an array. @param [String] string a pre-encoded string
[ "Adds", "an", "encoded", "string", "to", "the", "output", "stream", "while", "keeping", "track", "of", "the", "accumulated", "size", "of", "the", "output", "stream", "splitting", "it", "up", "as", "necessary", "and", "transferring", "the", "encoded", "string",...
3ffcfe21edc8dcd31298f945781990789fc832ab
https://github.com/dicom/ruby-dicom/blob/3ffcfe21edc8dcd31298f945781990789fc832ab/lib/dicom/d_write.rb#L31-L43
22,390
dicom/ruby-dicom
lib/dicom/d_write.rb
DICOM.Parent.check_encapsulated_image
def check_encapsulated_image(element) # If DICOM object contains encapsulated pixel data, we need some special handling for its items: if element.tag == PIXEL_TAG and element.parent.is_a?(DObject) @enc_image = true if element.length <= 0 end end
ruby
def check_encapsulated_image(element) # If DICOM object contains encapsulated pixel data, we need some special handling for its items: if element.tag == PIXEL_TAG and element.parent.is_a?(DObject) @enc_image = true if element.length <= 0 end end
[ "def", "check_encapsulated_image", "(", "element", ")", "# If DICOM object contains encapsulated pixel data, we need some special handling for its items:", "if", "element", ".", "tag", "==", "PIXEL_TAG", "and", "element", ".", "parent", ".", "is_a?", "(", "DObject", ")", "@...
Toggles the status for enclosed pixel data. @param [Element, Item, Sequence] element a data element
[ "Toggles", "the", "status", "for", "enclosed", "pixel", "data", "." ]
3ffcfe21edc8dcd31298f945781990789fc832ab
https://github.com/dicom/ruby-dicom/blob/3ffcfe21edc8dcd31298f945781990789fc832ab/lib/dicom/d_write.rb#L49-L54
22,391
dicom/ruby-dicom
lib/dicom/d_write.rb
DICOM.Parent.encode_in_segments
def encode_in_segments(max_size, options={}) @max_size = max_size @transfer_syntax = options[:syntax] # Until a DICOM write has completed successfully the status is 'unsuccessful': @write_success = false # Default explicitness of start of DICOM file: @explicit = true # Default ...
ruby
def encode_in_segments(max_size, options={}) @max_size = max_size @transfer_syntax = options[:syntax] # Until a DICOM write has completed successfully the status is 'unsuccessful': @write_success = false # Default explicitness of start of DICOM file: @explicit = true # Default ...
[ "def", "encode_in_segments", "(", "max_size", ",", "options", "=", "{", "}", ")", "@max_size", "=", "max_size", "@transfer_syntax", "=", "options", "[", ":syntax", "]", "# Until a DICOM write has completed successfully the status is 'unsuccessful':", "@write_success", "=", ...
Writes DICOM content to a series of size-limited binary strings, which is returned in an array. This is typically used in preparation of transmitting DICOM objects through network connections. @param [Integer] max_size the maximum segment string length @param [Hash] options the options to use for encoding the DICOM...
[ "Writes", "DICOM", "content", "to", "a", "series", "of", "size", "-", "limited", "binary", "strings", "which", "is", "returned", "in", "an", "array", ".", "This", "is", "typically", "used", "in", "preparation", "of", "transmitting", "DICOM", "objects", "thro...
3ffcfe21edc8dcd31298f945781990789fc832ab
https://github.com/dicom/ruby-dicom/blob/3ffcfe21edc8dcd31298f945781990789fc832ab/lib/dicom/d_write.rb#L64-L86
22,392
dicom/ruby-dicom
lib/dicom/d_write.rb
DICOM.Parent.split_and_add
def split_and_add(string) # Duplicate the string as not to ruin the binary of the data element with our slicing: segment = string.dup append = segment.slice!(0, @[email protected]) # Clear out the stream along with a small part of the string: @segments << @stream.export + append ...
ruby
def split_and_add(string) # Duplicate the string as not to ruin the binary of the data element with our slicing: segment = string.dup append = segment.slice!(0, @[email protected]) # Clear out the stream along with a small part of the string: @segments << @stream.export + append ...
[ "def", "split_and_add", "(", "string", ")", "# Duplicate the string as not to ruin the binary of the data element with our slicing:", "segment", "=", "string", ".", "dup", "append", "=", "segment", ".", "slice!", "(", "0", ",", "@max_size", "-", "@stream", ".", "length"...
Splits a pre-encoded string in parts and adds it to the segments instance array. @param [String] string a pre-encoded string
[ "Splits", "a", "pre", "-", "encoded", "string", "in", "parts", "and", "adds", "it", "to", "the", "segments", "instance", "array", "." ]
3ffcfe21edc8dcd31298f945781990789fc832ab
https://github.com/dicom/ruby-dicom/blob/3ffcfe21edc8dcd31298f945781990789fc832ab/lib/dicom/d_write.rb#L127-L148
22,393
dicom/ruby-dicom
lib/dicom/d_write.rb
DICOM.Parent.write_data_element
def write_data_element(element) # Step 1: Write tag: write_tag(element.tag) # Step 2: Write [VR] and value length: write_vr_length(element.tag, element.vr, element.length) # Step 3: Write value (Insert the already encoded binary string): write_value(element.bin) check_encapsula...
ruby
def write_data_element(element) # Step 1: Write tag: write_tag(element.tag) # Step 2: Write [VR] and value length: write_vr_length(element.tag, element.vr, element.length) # Step 3: Write value (Insert the already encoded binary string): write_value(element.bin) check_encapsula...
[ "def", "write_data_element", "(", "element", ")", "# Step 1: Write tag:", "write_tag", "(", "element", ".", "tag", ")", "# Step 2: Write [VR] and value length:", "write_vr_length", "(", "element", ".", "tag", ",", "element", ".", "vr", ",", "element", ".", "length",...
Encodes and writes a single data element. @param [Element, Item, Sequence] element a data element
[ "Encodes", "and", "writes", "a", "single", "data", "element", "." ]
3ffcfe21edc8dcd31298f945781990789fc832ab
https://github.com/dicom/ruby-dicom/blob/3ffcfe21edc8dcd31298f945781990789fc832ab/lib/dicom/d_write.rb#L154-L162
22,394
dicom/ruby-dicom
lib/dicom/d_write.rb
DICOM.Parent.write_delimiter
def write_delimiter(element) delimiter_tag = (element.tag == ITEM_TAG ? ITEM_DELIMITER : SEQUENCE_DELIMITER) write_tag(delimiter_tag) write_vr_length(delimiter_tag, ITEM_VR, 0) end
ruby
def write_delimiter(element) delimiter_tag = (element.tag == ITEM_TAG ? ITEM_DELIMITER : SEQUENCE_DELIMITER) write_tag(delimiter_tag) write_vr_length(delimiter_tag, ITEM_VR, 0) end
[ "def", "write_delimiter", "(", "element", ")", "delimiter_tag", "=", "(", "element", ".", "tag", "==", "ITEM_TAG", "?", "ITEM_DELIMITER", ":", "SEQUENCE_DELIMITER", ")", "write_tag", "(", "delimiter_tag", ")", "write_vr_length", "(", "delimiter_tag", ",", "ITEM_VR...
Encodes and writes an Item or Sequence delimiter. @param [Item, Sequence] element a parent element
[ "Encodes", "and", "writes", "an", "Item", "or", "Sequence", "delimiter", "." ]
3ffcfe21edc8dcd31298f945781990789fc832ab
https://github.com/dicom/ruby-dicom/blob/3ffcfe21edc8dcd31298f945781990789fc832ab/lib/dicom/d_write.rb#L212-L216
22,395
dicom/ruby-dicom
lib/dicom/d_write.rb
DICOM.Parent.write_elements
def write_elements(options={}) # Check if we are able to create given file: open_file(options[:file_name]) # Go ahead and write if the file was opened successfully: if @file # Initiate necessary variables: @transfer_syntax = options[:syntax] # Until a DICOM write has comp...
ruby
def write_elements(options={}) # Check if we are able to create given file: open_file(options[:file_name]) # Go ahead and write if the file was opened successfully: if @file # Initiate necessary variables: @transfer_syntax = options[:syntax] # Until a DICOM write has comp...
[ "def", "write_elements", "(", "options", "=", "{", "}", ")", "# Check if we are able to create given file:", "open_file", "(", "options", "[", ":file_name", "]", ")", "# Go ahead and write if the file was opened successfully:", "if", "@file", "# Initiate necessary variables:", ...
Handles the encoding of DICOM information to string as well as writing it to file. @param [Hash] options the options to use for encoding the DICOM string @option options [String] :file_name the path & name of the DICOM file which is to be written to disk @option options [Boolean] :signature if true, the 128 byte pr...
[ "Handles", "the", "encoding", "of", "DICOM", "information", "to", "string", "as", "well", "as", "writing", "it", "to", "file", "." ]
3ffcfe21edc8dcd31298f945781990789fc832ab
https://github.com/dicom/ruby-dicom/blob/3ffcfe21edc8dcd31298f945781990789fc832ab/lib/dicom/d_write.rb#L225-L254
22,396
dicom/ruby-dicom
lib/dicom/elemental.rb
DICOM.Elemental.stream
def stream if top_parent.is_a?(DObject) return top_parent.stream else return Stream.new(nil, file_endian=false) end end
ruby
def stream if top_parent.is_a?(DObject) return top_parent.stream else return Stream.new(nil, file_endian=false) end end
[ "def", "stream", "if", "top_parent", ".", "is_a?", "(", "DObject", ")", "return", "top_parent", ".", "stream", "else", "return", "Stream", ".", "new", "(", "nil", ",", "file_endian", "=", "false", ")", "end", "end" ]
Returns a Stream instance which can be used for encoding a value to binary. @note Retrieves the Stream instance of the top parent DObject instance. If this fails, a new Stream instance is created (with little endian encoding assumed).
[ "Returns", "a", "Stream", "instance", "which", "can", "be", "used", "for", "encoding", "a", "value", "to", "binary", "." ]
3ffcfe21edc8dcd31298f945781990789fc832ab
https://github.com/dicom/ruby-dicom/blob/3ffcfe21edc8dcd31298f945781990789fc832ab/lib/dicom/elemental.rb#L93-L99
22,397
dicom/ruby-dicom
lib/dicom/d_library.rb
DICOM.DLibrary.add_element
def add_element(element) raise ArgumentError, "Invalid argument 'element'. Expected DictionaryElement, got #{element.class}" unless element.is_a?(DictionaryElement) # We store the elements in a hash with tag as key and the element instance as value: @elements[element.tag] = element # Populate th...
ruby
def add_element(element) raise ArgumentError, "Invalid argument 'element'. Expected DictionaryElement, got #{element.class}" unless element.is_a?(DictionaryElement) # We store the elements in a hash with tag as key and the element instance as value: @elements[element.tag] = element # Populate th...
[ "def", "add_element", "(", "element", ")", "raise", "ArgumentError", ",", "\"Invalid argument 'element'. Expected DictionaryElement, got #{element.class}\"", "unless", "element", ".", "is_a?", "(", "DictionaryElement", ")", "# We store the elements in a hash with tag as key and the e...
Creates a DLibrary instance. Adds a custom DictionaryElement to the ruby-dicom element dictionary. @param [DictionaryElement] element the custom dictionary element to be added
[ "Creates", "a", "DLibrary", "instance", "." ]
3ffcfe21edc8dcd31298f945781990789fc832ab
https://github.com/dicom/ruby-dicom/blob/3ffcfe21edc8dcd31298f945781990789fc832ab/lib/dicom/d_library.rb#L40-L48
22,398
dicom/ruby-dicom
lib/dicom/d_library.rb
DICOM.DLibrary.add_element_dictionary
def add_element_dictionary(file) File.open(file, :encoding => 'utf-8').each do |record| fields = record.split("\t") add_element(DictionaryElement.new(fields[0], fields[1], fields[2].split(","), fields[3].rstrip, fields[4].rstrip)) end end
ruby
def add_element_dictionary(file) File.open(file, :encoding => 'utf-8').each do |record| fields = record.split("\t") add_element(DictionaryElement.new(fields[0], fields[1], fields[2].split(","), fields[3].rstrip, fields[4].rstrip)) end end
[ "def", "add_element_dictionary", "(", "file", ")", "File", ".", "open", "(", "file", ",", ":encoding", "=>", "'utf-8'", ")", ".", "each", "do", "|", "record", "|", "fields", "=", "record", ".", "split", "(", "\"\\t\"", ")", "add_element", "(", "Dictionar...
Adds a custom dictionary file to the ruby-dicom element dictionary. @note The format of the dictionary is a tab-separated text file with 5 columns: * Tag, Name, VR, VM & Retired status * For samples check out ruby-dicom's element dictionaries in the git repository @param [String] file the path to the dictionar...
[ "Adds", "a", "custom", "dictionary", "file", "to", "the", "ruby", "-", "dicom", "element", "dictionary", "." ]
3ffcfe21edc8dcd31298f945781990789fc832ab
https://github.com/dicom/ruby-dicom/blob/3ffcfe21edc8dcd31298f945781990789fc832ab/lib/dicom/d_library.rb#L57-L62
22,399
dicom/ruby-dicom
lib/dicom/d_library.rb
DICOM.DLibrary.add_uid_dictionary
def add_uid_dictionary(file) File.open(file, :encoding => 'utf-8').each do |record| fields = record.split("\t") add_uid(UID.new(fields[0], fields[1], fields[2].rstrip, fields[3].rstrip)) end end
ruby
def add_uid_dictionary(file) File.open(file, :encoding => 'utf-8').each do |record| fields = record.split("\t") add_uid(UID.new(fields[0], fields[1], fields[2].rstrip, fields[3].rstrip)) end end
[ "def", "add_uid_dictionary", "(", "file", ")", "File", ".", "open", "(", "file", ",", ":encoding", "=>", "'utf-8'", ")", ".", "each", "do", "|", "record", "|", "fields", "=", "record", ".", "split", "(", "\"\\t\"", ")", "add_uid", "(", "UID", ".", "n...
Adds a custom dictionary file to the ruby-dicom uid dictionary. @note The format of the dictionary is a tab-separated text file with 4 columns: * Value, Name, Type & Retired status * For samples check out ruby-dicom's uid dictionaries in the git repository @param [String] file the path to the dictionary file t...
[ "Adds", "a", "custom", "dictionary", "file", "to", "the", "ruby", "-", "dicom", "uid", "dictionary", "." ]
3ffcfe21edc8dcd31298f945781990789fc832ab
https://github.com/dicom/ruby-dicom/blob/3ffcfe21edc8dcd31298f945781990789fc832ab/lib/dicom/d_library.rb#L81-L86