gdcmDictEntry.h
Go to the documentation of this file.
/*=========================================================================
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.
=========================================================================*/
#ifndef GDCMDICTENTRY_H
#define GDCMDICTENTRY_H
#include "gdcmVR.h"
#include "gdcmVM.h"
#include <string>
#include <iostream>
#include <iomanip>
namespace gdcm
{
class GDCM_EXPORT DictEntry
{
public:
DictEntry(const char *name = "", const char *keyword = "", VR const &vr = VR::INVALID, VM const &vm = VM::VM0, bool ret = false):
Name(name),
Keyword(keyword),
ValueRepresentation(vr),
ValueMultiplicity(vm),
Retired(ret),
GroupXX(false),
ElementXX(false)
{
}
friend std::ostream& operator<<(std::ostream& _os, const DictEntry &_val);
const VR &GetVR() const { return ValueRepresentation; }
void SetVR(const VR & vr) { ValueRepresentation = vr; }
// bool IsValid() const { return ValueRepresentation != VR::VR_END; }
// !Name.empty() /*&& ValueRepresentation && ValueMultiplicity*/; }
const VM &GetVM() const { return ValueMultiplicity; }
void SetVM(VM const & vm) { ValueMultiplicity = vm; }
const char *GetName() const { return Name.c_str(); }
void SetName(const char* name) { Name = name; }
const char *GetKeyword() const { return Keyword.c_str(); }
void SetKeyword(const char* keyword) { Keyword = keyword; }
bool GetRetired() const { return Retired; }
void SetRetired(bool retired) { Retired = retired; }
// <entry group="50xx" element="0005" vr="US" vm="1" retired="true" version="3">
void SetGroupXX(bool v) { GroupXX = v; }
// <entry group="0020" element="31xx" vr="CS" vm="1-n" retired="true" version="2">
void SetElementXX(bool v) { ElementXX = v; }
bool IsUnique() const { return ElementXX == false && GroupXX == false; }
private:
//
friend class Dict;
static bool CheckKeywordAgainstName(const char *name, const char *keyword);
private:
std::string Name;
std::string Keyword;
VR ValueRepresentation;
VM ValueMultiplicity;
bool Retired : 1;
bool GroupXX : 1;
bool ElementXX : 1;
};
#if 0
class GDCM_EXPORT PrivateDictEntry : public DictEntry
{
public:
PrivateDictEntry(const char *name = "", VR::VRType const &vr = VR::INVALID, VM::VMType const &vm = VM::VM0 , bool ret = false, const char *owner = ""):DictEntry(name,vr,vm,ret),Owner(owner) {}
PrivateDictEntry(const char *name, const char *vr, const char *vm):DictEntry(name,vr,vm) {}
const char *GetOwner() const { return Owner.c_str(); }
void SetOwner(const char *owner) { Owner = owner; }
private:
// SIEMENS MED, GEMS_PETD_01 ...
std::string Owner;
};
#endif
//-----------------------------------------------------------------------------
inline std::ostream& operator<<(std::ostream& os, const DictEntry &val)
{
if( val.Name.empty() )
{
os << "[No name]";
}
else
{
os << val.Name;
}
if( val.Keyword.empty() )
{
os << "[No keyword]";
}
else
{
os << val.Keyword;
}
os << "\t" << val.ValueRepresentation << "\t" << val.ValueMultiplicity;
if( val.Retired )
{
os << "\t(RET)";
}
return os;
}
} // end namespace gdcm
#endif //GDCMDICTENTRY_H
gdcm::DictEntry
Class to represent an Entry in the Dict.
Definition gdcmDictEntry.h:37
gdcm::DictEntry::SetName
void SetName(const char *name)
Definition gdcmDictEntry.h:64
gdcm::DictEntry::SetVR
void SetVR(const VR &vr)
Definition gdcmDictEntry.h:54
gdcm::DictEntry::GetKeyword
const char * GetKeyword() const
same as GetName but without spaces...
Definition gdcmDictEntry.h:67
gdcm::DictEntry::SetElementXX
void SetElementXX(bool v)
Set whether element is shared in multiple elements (Source Image IDs typically).
Definition gdcmDictEntry.h:80
gdcm::DictEntry::GetVR
const VR & GetVR() const
Set/Get VR.
Definition gdcmDictEntry.h:53
gdcm::DictEntry::SetKeyword
void SetKeyword(const char *keyword)
Definition gdcmDictEntry.h:68
gdcm::DictEntry::SetRetired
void SetRetired(bool retired)
Definition gdcmDictEntry.h:72
gdcm::DictEntry::GetRetired
bool GetRetired() const
Set/Get Retired flag.
Definition gdcmDictEntry.h:71
gdcm::DictEntry::SetVM
void SetVM(VM const &vm)
Definition gdcmDictEntry.h:60
gdcm::DictEntry::Dict
friend class Dict
Definition gdcmDictEntry.h:88
gdcm::DictEntry::IsUnique
bool IsUnique() const
Definition gdcmDictEntry.h:84
gdcm::DictEntry::GetName
const char * GetName() const
Set/Get Name.
Definition gdcmDictEntry.h:63
gdcm::DictEntry::DictEntry
DictEntry(const char *name="", const char *keyword="", VR const &vr=VR::INVALID, VM const &vm=VM::VM0, bool ret=false)
Definition gdcmDictEntry.h:39
gdcm::DictEntry::SetGroupXX
void SetGroupXX(bool v)
Set whether element is shared in multiple groups (Curve/Overlay typically).
Definition gdcmDictEntry.h:76
gdcm::DictEntry::GetVM
const VM & GetVM() const
Set/Get VM.
Definition gdcmDictEntry.h:59
gdcm::VM
Value Multiplicity Looking at the DICOMV3 dict only there is very few cases: 1 2 3 4 5 6 8 16 24 1-2 ...
Definition gdcmVM.h:68
gdcm::VM::VMType
VMType
Definition gdcmVM.h:70
gdcm::VM::VM0
@ VM0
Definition gdcmVM.h:71
gdcm::VR
VR class.
Definition gdcmVR.h:55
gdcm::VR::VRType
VRType
Definition gdcmVR.h:57
gdcm::VR::INVALID
@ INVALID
Definition gdcmVR.h:59
gdcmVM.h
gdcmVR.h
GDCM_EXPORT
#define GDCM_EXPORT
Definition gdcmWin32.h:34
gdcm
Definition gdcmASN1.h:21
gdcm::operator<<
std::ostream & operator<<(std::ostream &os, const Directory &d)
Definition gdcmDirectory.h:88