[Gdcm-hackers] gdcm-git:Grassroots DICOM branch release updated. 572741198fa09ec2656353314d9cce8d63
Cross-platform DICOM implementation
Brought to you by:
malat
|
From: Mathieu M. <ma...@us...> - 2020-04-27 12:53:29
|
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "Grassroots DICOM".
The branch, release has been updated
via 572741198fa09ec2656353314d9cce8d63f90c23 (commit)
from 1edcc6abfcf70f09816b63b74efc2ad4df5853d7 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
https://sourceforge.net/p/gdcm/gdcm/ci/572741198fa09ec2656353314d9cce8d63f90c23/
commit 572741198fa09ec2656353314d9cce8d63f90c23
Author: Mathieu Malaterre <mat...@gm...>
Date: Mon Apr 27 14:53:07 2020 +0200
Add a simply example in Java
diff --git a/Examples/Java/CMakeLists.txt b/Examples/Java/CMakeLists.txt
index 1acd96335..337e53eba 100644
--- a/Examples/Java/CMakeLists.txt
+++ b/Examples/Java/CMakeLists.txt
@@ -15,6 +15,7 @@ set(examples
DecompressImage
ScanDirectory
ReadFiles
+ SimplePrint
FileAnonymize
)
foreach(example ${examples})
diff --git a/Examples/Java/SimplePrint.java b/Examples/Java/SimplePrint.java
new file mode 100644
index 000000000..e32e9b9c9
--- /dev/null
+++ b/Examples/Java/SimplePrint.java
@@ -0,0 +1,72 @@
+/*=========================================================================
+
+ 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/SimplePrint.java -d .
+ *
+ * Usage:
+ * $ LD_LIBRARY_PATH=. CLASSPATH=gdcm.jar:. java SimplePrint gdcmData/012345.002.050.dcm
+ */
+import gdcm.*;
+
+public class SimplePrint
+{
+ public static void RecurseDataSet(File f, DataSet ds, String indent)
+ {
+ JavaDataSet cds = new JavaDataSet(ds);
+ while(!cds.IsAtEnd())
+ {
+ DataElement de = cds.GetCurrent();
+ // Compute VR from the toplevel file, and the currently processed dataset:
+ VR vr = DataSetHelper.ComputeVR(f, ds, de.GetTag() );
+
+ if( vr.Compatible( new VR(VR.VRType.SQ) ) )
+ {
+ long uvl = de.GetVL().GetValueLength(); // Test cast is ok
+ System.out.println( indent + de.GetTag().toString() + ":" + uvl ); // why not ?
+ //SequenceOfItems sq = de.GetSequenceOfItems();
+ // GetValueAsSQ handle more cases than GetSequenceOfItems
+ SmartPtrSQ sq = de.GetValueAsSQ();
+ long n = sq.GetNumberOfItems();
+ for( long i = 1; i <= n; i++) // item starts at 1, not 0
+ {
+ Item item = sq.GetItem( i );
+ DataSet nested = item.GetNestedDataSet();
+ RecurseDataSet( f, nested, indent + " " );
+ }
+ }
+ else
+ {
+ System.out.println( indent + de.toString() );
+ }
+ cds.Next();
+ }
+ }
+
+ 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();
+
+ RecurseDataSet( f, ds, "" );
+ }
+}
-----------------------------------------------------------------------
Summary of changes:
Examples/Java/CMakeLists.txt | 1 +
.../SimplePrint.cs => Java/SimplePrint.java} | 39 +++++++++-------------
2 files changed, 17 insertions(+), 23 deletions(-)
copy Examples/{Csharp/SimplePrint.cs => Java/SimplePrint.java} (63%)
hooks/post-receive
--
Grassroots DICOM
|