1 /*=========================================================================
4 Module: $RCSfile: gdcmDictEntry.cxx,v $
6 Date: $Date: 2004/07/02 13:55:27 $
7 Version: $Revision: 1.22 $
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.htm 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 "gdcmDictEntry.h"
20 #include "gdcmDebug.h"
22 #include <stdio.h> // FIXME For sprintf
24 //-----------------------------------------------------------------------------
25 // Constructor / Destructor
28 * @param InGroup DICOM-Group Number
29 * @param InElement DICOM-Element Number
30 * @param InVr Value Representatiion
31 * @param InFourth // DO NOT use any longer;
32 * NOT part of the Dicom Standard
33 * @param InName description of the element
36 gdcmDictEntry::gdcmDictEntry(uint16_t InGroup, uint16_t InElement,
37 std::string InVr, std::string InFourth,
45 key = TranslateToKey(group, element); /// \todo Frog MEMORY LEAK.
48 //-----------------------------------------------------------------------------
51 //-----------------------------------------------------------------------------
54 * \brief concatenates 2 uint16_t (supposed to be a Dicom group number
55 * and a Dicom element number)
56 * @param group the Dicom group number used to build the tag
57 * @param element the Dicom element number used to build the tag
58 * @return the built tag
60 gdcmTagKey gdcmDictEntry::TranslateToKey(uint16_t group, uint16_t element)
64 // CLEANME: better call the iostream<< with the hex manipulator on.
65 // This requires some reading of the stdlibC++ sources to make the
66 // proper call (or copy).
67 sprintf(trash, "%04x|%04x", group , element);
68 key = trash; // Convertion through assignement
73 * \brief If-and only if-the V(alue) R(epresentation)
74 * \ is unset then overwrite it.
75 * @param NewVr New V(alue) R(epresentation) to be set.
77 void gdcmDictEntry::SetVR(std::string NewVr)
83 dbg.Error(true, "gdcmDictEntry::SetVR",
84 "Overwriting vr might compromise a dictionary");
88 //-----------------------------------------------------------------------------
91 //-----------------------------------------------------------------------------
94 //-----------------------------------------------------------------------------