GDCM: HelloSimple.java

GDCM 3.2.5

HelloSimple.java
/*=========================================================================
Program: GDCM (Grassroots DICOM). A DICOM library
Copyright (c) 2006-2011 Mathieu Malaterre
All rights reserved.
See Copyright.txt or http://gdcm.sourceforge.net/Copyright.html for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notice for more information.
=========================================================================*/
/*
* Compilation:
* $ CLASSPATH=gdcm.jar javac ../../gdcm/Examples/Java/HelloSimple.java -d .
*
* Usage:
* $ LD_LIBRARY_PATH=. CLASSPATH=gdcm.jar:. java HelloSimple gdcmData/012345.002.050.dcm
*/
import gdcm.*;
public class HelloSimple
{
public static void main(String[] args) throws Exception
{
String filename = args[0];
Reader reader = new Reader();
reader.SetFileName( filename );
boolean ret = reader.Read();
if( !ret )
{
throw new Exception("Could not read: " + filename );
}
File f = reader.GetFile();
DataSet ds = f.GetDataSet();
System.out.println( ds.toString() );
System.out.println("Success reading: " + filename );
}
}
gdcm
Definition gdcmASN1.h:21