dicom 0.9.1 → 0.9.2

Sign up to get free protection for your applications and to get access to all the features.
data/lib/dicom/parent.rb CHANGED
@@ -20,7 +20,7 @@ module DICOM
20
20
  #
21
21
  # === Parameters
22
22
  #
23
- # * <tt>tag</tt> -- A tag string which identifies the data element to be returned (Exception: In the case where an Item is wanted, an index (Fixnum) is used instead).
23
+ # * <tt>tag_or_index</tt> -- A tag string which identifies the data element to be returned (Exception: In the case where an Item is wanted, an index (Fixnum) is used instead).
24
24
  #
25
25
  # === Examples
26
26
  #
@@ -29,8 +29,9 @@ module DICOM
29
29
  # # Extract the first Item from a Sequence:
30
30
  # first_item = obj["3006,0020"][1]
31
31
  #
32
- def [](tag)
33
- return @tags[tag]
32
+ def [](tag_or_index)
33
+ formatted = tag_or_index.is_a?(String) ? tag_or_index.upcase : tag_or_index
34
+ return @tags[formatted]
34
35
  end
35
36
 
36
37
  # Adds a Element or Sequence instance to self (where self can be either a DObject or an Item).
@@ -282,7 +283,7 @@ module DICOM
282
283
  # process_name(obj["0010,0010"]) if obj.exists?("0010,0010")
283
284
  #
284
285
  def exists?(tag)
285
- if @tags[tag]
286
+ if self[tag]
286
287
  return true
287
288
  else
288
289
  return false
@@ -300,7 +301,7 @@ module DICOM
300
301
  raise ArgumentError, "Expected String, got #{group_string.class}." unless group_string.is_a?(String)
301
302
  found = Array.new
302
303
  children.each do |child|
303
- found << child if child.tag.group == group_string
304
+ found << child if child.tag.group == group_string.upcase
304
305
  end
305
306
  return found
306
307
  end
@@ -597,7 +598,7 @@ module DICOM
597
598
  raise ArgumentError, "Expected String or Integer, got #{tag.class}."
598
599
  end
599
600
  # We need to delete the specified child element's parent reference in addition to removing it from the tag Hash.
600
- element = @tags[tag]
601
+ element = self[tag]
601
602
  if element
602
603
  element.parent = nil unless options[:no_follow]
603
604
  @tags.delete(tag)
@@ -762,10 +763,10 @@ module DICOM
762
763
  raise ArgumentError, "Expected String or Integer, got #{tag.class}."
763
764
  end
764
765
  if exists?(tag)
765
- if @tags[tag].is_parent?
766
+ if self[tag].is_parent?
766
767
  raise ArgumentError, "Illegal parameter '#{tag}'. Parent elements, like the referenced '#{@tags[tag].class}', have no value. Only Element tags are valid."
767
768
  else
768
- return @tags[tag].value
769
+ return self[tag].value
769
770
  end
770
771
  else
771
772
  return nil
@@ -38,7 +38,7 @@ module DICOM
38
38
  # Set common parent variables:
39
39
  initialize_parent
40
40
  # Set instance variables:
41
- @tag = tag
41
+ @tag = tag.upcase
42
42
  @value = nil
43
43
  @bin = nil
44
44
  # We may beed to retrieve name and vr from the library:
data/lib/dicom/version.rb CHANGED
@@ -1,6 +1,6 @@
1
1
  module DICOM
2
2
 
3
3
  # The ruby-dicom version string.
4
- VERSION = "0.9.1"
4
+ VERSION = "0.9.2"
5
5
 
6
6
  end
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: dicom
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 0.9.1
5
+ version: 0.9.2
6
6
  platform: ruby
7
7
  authors:
8
8
  - Christoffer Lervag
@@ -10,7 +10,7 @@ autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
12
 
13
- date: 2011-05-27 00:00:00 Z
13
+ date: 2011-10-09 00:00:00 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: bundler
@@ -53,7 +53,7 @@ dependencies:
53
53
  requirements:
54
54
  - - ">="
55
55
  - !ruby/object:Gem::Version
56
- version: "0"
56
+ version: 0.6.0.0
57
57
  type: :development
58
58
  version_requirements: *id004
59
59
  - !ruby/object:Gem::Dependency
@@ -64,7 +64,7 @@ dependencies:
64
64
  requirements:
65
65
  - - ">="
66
66
  - !ruby/object:Gem::Version
67
- version: "0"
67
+ version: 2.12.0
68
68
  type: :development
69
69
  version_requirements: *id005
70
70
  - !ruby/object:Gem::Dependency
@@ -105,6 +105,7 @@ files:
105
105
  - lib/dicom/image_processor_r_magick.rb
106
106
  - lib/dicom/item.rb
107
107
  - lib/dicom/link.rb
108
+ - lib/dicom/logging.rb
108
109
  - lib/dicom/parent.rb
109
110
  - lib/dicom/ruby_extensions.rb
110
111
  - lib/dicom/sequence.rb