module DcmDict::Refine::Internal::HashRefineInternal
Public Instance Methods
Source
# File lib/dcm_dict/refine/internal/hash_refine_internal.rb, line 32 def check_base_data_tag_field! check_tag_ps! check_placeholder_data! self end
Check/update content for data tag field
Source
# File lib/dcm_dict/refine/internal/hash_refine_internal.rb, line 61 def check_base_data_uid_field! uid_value = self[:uid_value] raise "Missing uid_value field" if uid_value.nil_or_empty? fill_nil_or_empty_value(:uid_key) do new_key = uid_value.gsub('.','_') "UID_#{new_key}" end fill_nil_or_empty_value(:uid_sym) { self[:uid_key].tag_key_to_sym } fill_nil_or_empty_value(:uid_name) { "#{self[:uid_value]} (Unknown UID)" } fill_nil_or_empty_value(:uid_type) { :unknown } end
Source
# File lib/dcm_dict/refine/internal/hash_refine_internal.rb, line 46 def check_placeholder_data! # PS3.5: # For some Data Elements, no Name or Keyword or VR or VM is specified; # these are "placeholders" that are not assigned but will not be reused. tag_ps = self[:tag_ps] raise "Missing tag_ps field" if tag_ps.nil_or_empty? fill_nil_or_empty_value(:tag_name) { "Placeholder #{tag_ps}" } fill_nil_or_empty_value(:tag_key) do new_key = tag_ps.gsub(',','_').gsub(/[\(\)]/,'') "Placeholder_#{new_key}" end fill_nil_or_empty_value(:tag_vr) { [:UN] } fill_nil_or_empty_value(:tag_vm) { ['1'] } end
Check for place holder tag data
Source
# File lib/dcm_dict/refine/internal/hash_refine_internal.rb, line 39 def check_tag_ps! tag_ps = self[:tag_ps] raise "Missing tag_ps field" if tag_ps.nil_or_empty? self[:tag_ps] = tag_ps.upcase # fix for ruby 3.4 >> FrozenError: can't modify frozen String end
Check for mandatory :tag_ps key
Source
# File lib/dcm_dict/refine/internal/hash_refine_internal.rb, line 74 def fill_nil_or_empty_value(key) if self[key].nil_or_empty? self[key] = yield end end