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

Added by Brian Alexander , last edited by Brian Alexander on May 23, 2008
Labels: 
(None)

Groovy is a very elegant way of scripting dcm4che2:

import org.dcm4che2.data.*
import org.dcm4che2.io.*

// open stream and ensure that it is closed properly
new DicomInputStream(/d:\foo.dcm/ as File).withStream {dicomInputSteam ->
    // read the object from input stream
    def dicomObject = dicomInputSteam.readDicomObject()
    
    // iterate through all elements and print the element
    dicomObject.each {dicomElement ->
        println dicomElement
    }
}
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