GDCM 3.2.1

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