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