1 /*=========================================================================
4 Module: $RCSfile: gdcmDictGroupName.cxx,v $
6 Date: $Date: 2007/05/23 14:18:09 $
7 Version: $Revision: 1.8 $
9 Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
10 l'Image). All rights reserved. See Doc/License.txt or
11 http://www.creatis.insa-lyon.fr/Public/Gdcm/License.html for details.
13 This software is distributed WITHOUT ANY WARRANTY; without even
14 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
15 PURPOSE. See the above copyright notices for more information.
17 =========================================================================*/
19 #include "gdcmDictGroupName.h"
21 #include "gdcmDictSet.h"
22 #include "gdcmDebug.h"
28 namespace GDCM_NAME_SPACE
30 //-----------------------------------------------------------------------------
31 /// \brief auto generated function, to fill up the 'Group Name'
32 /// Dictionnary, if relevant file is not found on user's disk
33 void FillDefaultDictGroupName(DictGroupNameHT &groupName);
35 //-----------------------------------------------------------------------------
36 // Constructor / Destructor
40 DictGroupName::DictGroupName()
42 std::string filename = DictSet::BuildDictPath() + DICT_GROUP_NAME;
43 std::ifstream from(filename.c_str());
46 gdcmWarningMacro("Can't open dictionary" << filename.c_str());
47 FillDefaultDictGroupName(groupName);
61 from.getline(buff, 1024, '"');
62 from.getline(buff, 1024, '"');
65 groupName[key] = value;
67 from.getline(buff, 1024, '\n');
76 DictGroupName::~DictGroupName()
81 //-----------------------------------------------------------------------------
83 /// \returns the formerly NIH defined ACR-NEMA group name
84 const TagName &DictGroupName::GetName(uint16_t group)
86 DictGroupNameHT::const_iterator it = groupName.find(group);
87 if ( it == groupName.end() )
94 //-----------------------------------------------------------------------------
97 //-----------------------------------------------------------------------------
100 //-----------------------------------------------------------------------------
104 * @param os The output stream to be written to.
106 void DictGroupName::Print(std::ostream &os,std::string const &)
108 std::ostringstream s;
110 for (DictGroupNameHT::iterator it = groupName.begin(); it != groupName.end(); ++it)
112 s << "DictGroupName : 0x" << std::hex << std::setw(4) << it->first
113 << std::dec << " = " << it->second << std::endl;
118 //-----------------------------------------------------------------------------
119 } // end namespace gdcm