Skip to content

Instantly share code, notes, and snippets.

@sween
Created June 17, 2009 10:56
Show Gist options
  • Save sween/131185 to your computer and use it in GitHub Desktop.
Save sween/131185 to your computer and use it in GitHub Desktop.
# 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)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment