GDCM 3.0.24
DumpCSA.cs
/*=========================================================================
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.
=========================================================================*/
/*
* Usage:
* $ bin/DumpCSA.exe input.dcm
*/
using System;
using gdcm;
public class DumpCSA
{
public static int Main(string[] args)
{
string filename = args[0];
gdcm.Reader reader = new gdcm.Reader();
reader.SetFileName( filename );
if (!reader.Read()) return 1;
gdcm.File f = reader.GetFile();
string[] expectedSiemensTags = new string[] { "B_value" , "AcquisitionMatrixText" };
{
if (ds.FindDataElement(gtag))
{
using (DataElement de = ds.GetDataElement(gtag))
{
if (de != null && !de.IsEmpty())
{
using (CSAHeader csa = new CSAHeader())
{
if (csa.LoadFromDataElement(de))
{
foreach (string str in expectedSiemensTags)
{
if (csa.FindCSAElementByName(str))
{
using (CSAElement elem = csa.GetCSAElementByName(str))
{
if (elem != null)
{
System.Console.WriteLine( elem.toString() );
}
}
}
}
}
}
}
}
}
}
return 0;
}
}
Class to represent a CSA Element.
Definition gdcmCSAElement.h:30
Class for CSAHeader.
Definition gdcmCSAHeader.h:64
static const PrivateTag & GetCSAImageHeaderInfoTag()
bool FindCSAElementByName(const char *name)
const CSAElement & GetCSAElementByName(const char *name)
bool LoadFromDataElement(DataElement const &de)
Decode the CSAHeader from element 'de'.
Class to represent a Data Element either Implicit or Explicit.
Definition gdcmDataElement.h:59
bool IsEmpty() const
Check if Data Element is empty.
Definition gdcmDataElement.h:106
Class to represent a Data Set (which contains Data Elements)
Definition gdcmDataSet.h:56
const DataElement & GetDataElement(const Tag &t) const
Definition gdcmDataSet.h:188
bool FindDataElement(const PrivateTag &t) const
Look up if private tag 't' is present in the dataset:
a DICOM File
Definition gdcmFile.h:34
const DataSet & GetDataSet() const
Get Data Set.
Definition gdcmFile.h:57
Class to represent a Private DICOM Data Element (Attribute) Tag (Group, Element, Owner)
Definition gdcmPrivateTag.h:39
Reader ala DOM (Document Object Model)
Definition gdcmReader.h:54
const File & GetFile() const
Set/Get File.
Definition gdcmReader.h:72
virtual bool Read()
Main function to read a file.
void SetFileName(const char *filename_native)
Class to do system operation.
Definition gdcmSystem.h:27
Definition gdcmASN1.h:21