From 03acf3c119c6657129b8aeae8cb2205e481a105b Mon Sep 17 00:00:00 2001 From: jpr Date: Fri, 7 Jan 2005 08:46:17 +0000 Subject: [PATCH 1/1] Removal of useless and dangerous methods : GetEntryByName, GetEntryVRByName, GetDocEntryByName, SetEntryByName --- src/gdcmDict.h | 8 ++--- src/gdcmDocument.cxx | 85 ++------------------------------------------ src/gdcmDocument.h | 10 ++---- src/gdcmSQItem.h | 6 ++-- 4 files changed, 11 insertions(+), 98 deletions(-) diff --git a/src/gdcmDict.h b/src/gdcmDict.h index cfbdb9e9..4892ed05 100644 --- a/src/gdcmDict.h +++ b/src/gdcmDict.h @@ -3,8 +3,8 @@ Program: gdcm Module: $RCSfile: gdcmDict.h,v $ Language: C++ - Date: $Date: 2005/01/06 20:03:27 $ - Version: $Revision: 1.26 $ + Date: $Date: 2005/01/07 08:46:17 $ + Version: $Revision: 1.27 $ Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de l'Image). All rights reserved. See Doc/License.txt or @@ -40,8 +40,8 @@ typedef std::mapGetDictEntryByName(tagName); - if( !dictEntry ) - { - return GDCM_UNFOUND; - } - - return GetEntryByNumber(dictEntry->GetGroup(),dictEntry->GetElement()); -} - -/** - * \brief Searches within Header Entries (Dicom Elements) parsed with - * the public and private dictionaries - * for the element value representation of a given tag. - * - * Obtaining the VR (Value Representation) might be needed by caller - * to convert the string typed content to caller's native type - * (think of C++ vs Python). The VR is actually of a higher level - * of semantics than just the native C++ type. - * @param tagName name of the searched element. - * @return Corresponding element value representation when it exists, - * and the string GDCM_UNFOUND ("gdcm::Unfound") otherwise. - */ -std::string Document::GetEntryVRByName(TagName const& tagName) -{ - DictEntry *dictEntry = RefPubDict->GetDictEntryByName(tagName); - if( dictEntry == NULL) - { - return GDCM_UNFOUND; - } - - DocEntry *elem = GetDocEntryByNumber(dictEntry->GetGroup(), - dictEntry->GetElement()); - return elem->GetVR(); -} /** * \brief Searches within Header Entries (Dicom Elements) parsed with @@ -871,24 +826,6 @@ int Document::GetEntryLengthByNumber(uint16_t group, uint16_t element) } return elem->GetLength(); } -/** - * \brief Sets the value (string) of the Header Entry (Dicom Element) - * @param content string value of the Dicom Element - * @param tagName name of the searched Dicom Element. - * @return true when found - */ -bool Document::SetEntryByName( std::string const &content, - TagName const &tagName) -{ - DictEntry *dictEntry = RefPubDict->GetDictEntryByName(tagName); - if( !dictEntry ) - { - return false; - } - - return SetEntryByNumber(content,dictEntry->GetGroup(), - dictEntry->GetElement()); -} /** * \brief Accesses an existing DocEntry (i.e. a Dicom Element) @@ -1083,24 +1020,6 @@ void Document::LoadEntryBinArea(BinEntry *element) return false; }*/ -/** - * \brief Searches within the Header Entries for a Dicom Element of - * a given tag. - * @param tagName name of the searched Dicom Element. - * @return Corresponding Dicom Element when it exists, and NULL - * otherwise. - */ -DocEntry *Document::GetDocEntryByName(TagName const &tagName) -{ - DictEntry *dictEntry = RefPubDict->GetDictEntryByName(tagName); - if( !dictEntry ) - { - return NULL; - } - - return GetDocEntryByNumber(dictEntry->GetGroup(),dictEntry->GetElement()); -} - /** * \brief retrieves a Dicom Element (the first one) using (group, element) * \warning (group, element) IS NOT an identifier inside the Dicom Header diff --git a/src/gdcmDocument.h b/src/gdcmDocument.h index e7233eb0..bacbe5cf 100644 --- a/src/gdcmDocument.h +++ b/src/gdcmDocument.h @@ -3,8 +3,8 @@ Program: gdcm Module: $RCSfile: gdcmDocument.h,v $ Language: C++ - Date: $Date: 2005/01/06 20:03:27 $ - Version: $Revision: 1.75 $ + Date: $Date: 2005/01/07 08:46:18 $ + Version: $Revision: 1.76 $ Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de l'Image). All rights reserved. See Doc/License.txt or @@ -110,8 +110,7 @@ public: void WriteContent( std::ofstream *fp, FileType type ); // Content entries - virtual bool SetEntryByName (std::string const &content, - TagName const &tagName ); + virtual bool SetEntryByNumber(std::string const &content, uint16_t group, uint16_t element); virtual bool SetEntryByNumber(uint8_t *content, int lgth, @@ -121,14 +120,11 @@ public: virtual void *GetEntryBinAreaByNumber(uint16_t group, uint16_t elem); - virtual std::string GetEntryByName (TagName const &tagName); - virtual std::string GetEntryVRByName (TagName const &tagName); virtual std::string GetEntryByNumber (uint16_t group, uint16_t elem); virtual std::string GetEntryVRByNumber(uint16_t group, uint16_t elem); virtual int GetEntryLengthByNumber(uint16_t group, uint16_t elem); DocEntry *GetDocEntryByNumber(uint16_t group, uint16_t element); - DocEntry *GetDocEntryByName (TagName const &tagName); ValEntry *GetValEntryByNumber(uint16_t group, uint16_t element); BinEntry *GetBinEntryByNumber(uint16_t group, uint16_t element); diff --git a/src/gdcmSQItem.h b/src/gdcmSQItem.h index 9bce85dd..9874b61d 100644 --- a/src/gdcmSQItem.h +++ b/src/gdcmSQItem.h @@ -3,8 +3,8 @@ Program: gdcm Module: $RCSfile: gdcmSQItem.h,v $ Language: C++ - Date: $Date: 2005/01/06 20:03:28 $ - Version: $Revision: 1.28 $ + Date: $Date: 2005/01/07 08:46:18 $ + Version: $Revision: 1.29 $ Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de l'Image). All rights reserved. See Doc/License.txt or @@ -50,8 +50,6 @@ public: bool RemoveEntryNoDestroy(DocEntry *EntryToRemove); DocEntry *GetDocEntryByNumber(uint16_t group, uint16_t element); - // FIXME method to write - //DocEntry *GetDocEntryByName(std::string Name); bool SetEntryByNumber(std::string const &val, uint16_t group, uint16_t element); -- 2.47.0