# dcm4che2 Toolkit with the elegance of Ruby
# Read File Example - Ron Sweeney
require 'java'
include_class 'java.io.BufferedInputStream'
include_class 'java.io.FileInputStream'
include_class 'org.dcm4che2.io.DicomInputStream'
include_class 'org.dcm4che2.data.BasicDicomObject'
def PrintTag(tagvalue)
dcm = BasicDicomObject.new
din = DicomInputStream.new(BufferedInputStream.new(FileInputStream.new("c:\\MR.dcm")))
din.readDicomObject(dcm, -1)
dicomvalue = dcm.getString(tagvalue)
return dicomvalue
end
puts "Patient Name: " + PrintTag(0x00100010)
puts "Modality Type: " + PrintTag(0x00080060)