Dashboard > dcm4che-2.x > dcm4che2 DICOM Toolkit > Accessing dcm4che2 Toolkit with Jruby
Accessing dcm4che2 Toolkit with Jruby Log In | Sign Up   View a printable version of the current page.

Added by Ron Sweeney , last edited by Ron Sweeney on Oct 01, 2007
Labels: 
(None)

Here is a quick example on how to access the dcm4che2 Toolkit with JRuby.

# 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)
Powered by a free Atlassian Confluence Open Source Project License granted to dcm4che. Evaluate Confluence today.
Powered by Atlassian Confluence 2.7.1, the Enterprise Wiki. Bug/feature request - Atlassian news - Contact administrators