GDCM
2.2.0
Main Page
Related Pages
Namespaces
Classes
Files
Examples
PublicDict.cxx
/*=========================================================================
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.
=========================================================================*/
/*
* Dummy example to show GDCM Dict(s) API (Part 6) + Collected Private Attributes:
*/
#include "
gdcmGlobal.h
"
#include "
gdcmDicts.h
"
#include "
gdcmDict.h
"
#include "
gdcmCSAHeader.h
"
#include "
gdcmPrivateTag.h
"
int
main(
int
,
char
*[])
{
const
gdcm::Global
& g =
gdcm::Global::GetInstance
();
// sum of all knowledge !
const
gdcm::Dicts
&dicts = g.
GetDicts
();
const
gdcm::Dict
&pub = dicts.
GetPublicDict
();
// Part 6
//std::cout << pub << std::endl;
// 3 differents way to access the same information
// 1. From the public dict only:
gdcm::Tag
patient_name(0x10,0x10);
const
gdcm::DictEntry
&entry1 = pub.
GetDictEntry
(patient_name);
std::cout << entry1 << std::endl;
// 2. From all dicts:
const
gdcm::DictEntry
&entry2 = dicts.
GetDictEntry
(patient_name);
std::cout << entry2 << std::endl;
// 3. This solution is the most flexible solution as you can request using the same
// API either a public tag or a private tag
const
char
*strowner = 0;
const
gdcm::DictEntry
&entry3 = dicts.
GetDictEntry
(patient_name,strowner);
std::cout << entry3 << std::endl;
// Private attributes:
// try with a private tag now:
const
gdcm::PrivateTag
&private_tag =
gdcm::CSAHeader::GetCSAImageHeaderInfoTag
();
//std::cout << private_tag << std::endl;
const
gdcm::DictEntry
&entry4 = dicts.
GetDictEntry
(private_tag,private_tag.
GetOwner
());
std::cout << entry4 << std::endl;
// Let's pretend that private lookup is on 0x10xx elements:
gdcm::PrivateTag
dummy = private_tag;
dummy.
SetElement
( 0x1000 + dummy.
GetElement
() );
const
gdcm::DictEntry
&entry5 = dicts.
GetDictEntry
(dummy,dummy.
GetOwner
());
std::cout << entry5 << std::endl;
return
0;
}
Generated on Wed Jun 13 2012 20:40:36 for GDCM by
1.8.1