GDCM 3.0.24
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 different ways 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 = nullptr;
const gdcm::DictEntry &entry3 = dicts.GetDictEntry(patient_name,strowner);
std::cout << entry3 << std::endl;
// Private attributes:
// try with a private tag now:
//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( (uint16_t)(0x1000 + dummy.GetElement()) );
const gdcm::DictEntry &entry5 = dicts.GetDictEntry(dummy,dummy.GetOwner());
std::cout << entry5 << std::endl;
return 0;
}
static const PrivateTag & GetCSAImageHeaderInfoTag()
Class to represent an Entry in the Dict.
Definition gdcmDictEntry.h:37
Class to represent a map of DictEntry.
Definition gdcmDict.h:45
const DictEntry & GetDictEntry(const Tag &tag) const
Definition gdcmDict.h:75
Class to manipulate the sum of knowledge (all the dict user load)
Definition gdcmDicts.h:29
const DictEntry & GetDictEntry(const Tag &tag, const char *owner=nullptr) const
THREAD SAFE.
const Dict & GetPublicDict() const
Global.
Definition gdcmGlobal.h:50
Dicts const & GetDicts() const
static Global & GetInstance()
return the singleton instance
Class to represent a Private DICOM Data Element (Attribute) Tag (Group, Element, Owner)
Definition gdcmPrivateTag.h:39
const char * GetOwner() const
Definition gdcmPrivateTag.h:51
Class to represent a DICOM Data Element (Attribute) Tag (Group, Element).
Definition gdcmTag.h:39
void SetElement(uint16_t element)
Sets the 'Element number' of the given Tag.
Definition gdcmTag.h:61
uint16_t GetElement() const
Returns the 'Element number' of the given Tag.
Definition gdcmTag.h:57