From 033352f8a0d333fc12b7fa625d1819a574f4ddef Mon Sep 17 00:00:00 2001 From: jpr Date: Thu, 20 Jan 2005 11:37:37 +0000 Subject: [PATCH] The following methods > DocEntry *GetDocEntry(uint16_t group, uint16_t elem); > ValEntry *GetValEntry(uint16_t group, uint16_t elem); > BinEntry *GetBinEntry(uint16_t group, uint16_t elem); > SeqEntry *GetSeqEntry(uint16_t group, uint16_t elem); now belong to gdcm:ElementSet class --- src/gdcmDocument.cxx | 92 +---------------------------------------- src/gdcmDocument.h | 17 ++++---- src/gdcmElementSet.cxx | 94 +++++++++++++++++++++++++++++++++++++++++- src/gdcmElementSet.h | 9 +++- 4 files changed, 109 insertions(+), 103 deletions(-) diff --git a/src/gdcmDocument.cxx b/src/gdcmDocument.cxx index 369dc0de..bb3d81df 100644 --- a/src/gdcmDocument.cxx +++ b/src/gdcmDocument.cxx @@ -3,8 +3,8 @@ Program: gdcm Module: $RCSfile: gdcmDocument.cxx,v $ Language: C++ - Date: $Date: 2005/01/20 11:26:17 $ - Version: $Revision: 1.202 $ + Date: $Date: 2005/01/20 11:37:37 $ + Version: $Revision: 1.203 $ Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de l'Image). All rights reserved. See Doc/License.txt or @@ -928,94 +928,6 @@ void Document::LoadEntryBinArea(BinEntry *elem) return false; }*/ -/** - * \brief retrieves a Dicom Element using (group, element) - * @param group Group number of the searched Dicom Element - * @param elem Element number of the searched Dicom Element - * @return - */ -DocEntry *Document::GetDocEntry(uint16_t group, uint16_t elem) -{ - TagKey key = DictEntry::TranslateToKey(group, elem); - if ( !TagHT.count(key)) - { - return NULL; - } - return TagHT.find(key)->second; -} - -/** - * \brief Same as \ref Document::GetDocEntry except it only - * returns a result when the corresponding entry is of type - * ValEntry. - * @param group Group number of the searched Dicom Element - * @param elem Element number of the searched Dicom Element - * @return When present, the corresponding ValEntry. - */ -ValEntry *Document::GetValEntry(uint16_t group, uint16_t elem) -{ - DocEntry *currentEntry = GetDocEntry(group, elem); - if ( !currentEntry ) - { - return 0; - } - if ( ValEntry *entry = dynamic_cast(currentEntry) ) - { - return entry; - } - gdcmVerboseMacro( "Unfound ValEntry."); - - return 0; -} - -/** - * \brief Same as \ref Document::GetDocEntry except it only - * returns a result when the corresponding entry is of type - * BinEntry. - * @param group Group number of the searched Dicom Element - * @param elem Element number of the searched Dicom Element - * @return When present, the corresponding BinEntry. - */ -BinEntry *Document::GetBinEntry(uint16_t group, uint16_t elem) -{ - DocEntry *currentEntry = GetDocEntry(group, elem); - if ( !currentEntry ) - { - return 0; - } - if ( BinEntry *entry = dynamic_cast(currentEntry) ) - { - return entry; - } - gdcmVerboseMacro( "Unfound BinEntry."); - - return 0; -} - -/** - * \brief Same as \ref Document::GetDocEntry except it only - * returns a result when the corresponding entry is of type - * SeqEntry. - * @param group Group number of the searched Dicom Element - * @param elem Element number of the searched Dicom Element - * @return When present, the corresponding SeqEntry. - */ -SeqEntry *Document::GetSeqEntry(uint16_t group, uint16_t elem) -{ - DocEntry *currentEntry = GetDocEntry(group, elem); - if ( !currentEntry ) - { - return 0; - } - if ( SeqEntry *entry = dynamic_cast(currentEntry) ) - { - return entry; - } - gdcmVerboseMacro( "Unfound SeqEntry."); - - return 0; -} - /** * \brief Loads the element while preserving the current diff --git a/src/gdcmDocument.h b/src/gdcmDocument.h index d5ae4e04..21d5558b 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/20 11:07:07 $ - Version: $Revision: 1.93 $ + Date: $Date: 2005/01/20 11:37:37 $ + Version: $Revision: 1.94 $ Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de l'Image). All rights reserved. See Doc/License.txt or @@ -86,10 +86,14 @@ public: // Content entries +// Oops ! Python is gonna cry : +// 4 methods with same name and different parameters ... +// Only C++ is aware! + virtual bool SetEntry(std::string const &content, - uint16_t group, uint16_t element); + uint16_t group, uint16_t elem); virtual bool SetEntry(uint8_t *content, int lgth, - uint16_t group, uint16_t element); + uint16_t group, uint16_t elem); virtual bool SetEntry(std::string const &content, ValEntry *entry); virtual bool SetEntry(uint8_t *content, int lgth, BinEntry *entry); @@ -99,11 +103,6 @@ public: virtual std::string GetEntryVR(uint16_t group, uint16_t elem); virtual int GetEntryLength(uint16_t group, uint16_t elem); - DocEntry *GetDocEntry(uint16_t group, uint16_t element); - ValEntry *GetValEntry(uint16_t group, uint16_t element); - BinEntry *GetBinEntry(uint16_t group, uint16_t element); - SeqEntry *GetSeqEntry(uint16_t group, uint16_t element); - ValEntry *ReplaceOrCreate(std::string const &value, uint16_t group, uint16_t elem, TagName const &vr = GDCM_UNKNOWN); diff --git a/src/gdcmElementSet.cxx b/src/gdcmElementSet.cxx index 44044e4f..cf778c42 100644 --- a/src/gdcmElementSet.cxx +++ b/src/gdcmElementSet.cxx @@ -3,8 +3,8 @@ Program: gdcm Module: $RCSfile: gdcmElementSet.cxx,v $ Language: C++ - Date: $Date: 2005/01/19 15:24:28 $ - Version: $Revision: 1.46 $ + Date: $Date: 2005/01/20 11:37:37 $ + Version: $Revision: 1.47 $ Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de l'Image). All rights reserved. See Doc/License.txt or @@ -96,6 +96,96 @@ void ElementSet::WriteContent(std::ofstream *fp, FileType filetype) } } + +/** + * \brief retrieves a Dicom Element using (group, element) + * @param group Group number of the searched Dicom Element + * @param elem Element number of the searched Dicom Element + * @return + */ +DocEntry *ElementSet::GetDocEntry(uint16_t group, uint16_t elem) +{ + TagKey key = DictEntry::TranslateToKey(group, elem); + if ( !TagHT.count(key)) + { + return NULL; + } + return TagHT.find(key)->second; +} + +/** + * \brief Same as \ref Document::GetDocEntry except it only + * returns a result when the corresponding entry is of type + * ValEntry. + * @param group Group number of the searched Dicom Element + * @param elem Element number of the searched Dicom Element + * @return When present, the corresponding ValEntry. + */ +ValEntry *ElementSet::GetValEntry(uint16_t group, uint16_t elem) +{ + DocEntry *currentEntry = GetDocEntry(group, elem); + if ( !currentEntry ) + { + return 0; + } + if ( ValEntry *entry = dynamic_cast(currentEntry) ) + { + return entry; + } + gdcmVerboseMacro( "Unfound ValEntry."); + + return 0; +} + +/** + * \brief Same as \ref Document::GetDocEntry except it only + * returns a result when the corresponding entry is of type + * BinEntry. + * @param group Group number of the searched Dicom Element + * @param elem Element number of the searched Dicom Element + * @return When present, the corresponding BinEntry. + */ +BinEntry *ElementSet::GetBinEntry(uint16_t group, uint16_t elem) +{ + DocEntry *currentEntry = GetDocEntry(group, elem); + if ( !currentEntry ) + { + return 0; + } + if ( BinEntry *entry = dynamic_cast(currentEntry) ) + { + return entry; + } + gdcmVerboseMacro( "Unfound BinEntry."); + + return 0; +} + +/** + * \brief Same as \ref Document::GetDocEntry except it only + * returns a result when the corresponding entry is of type + * SeqEntry. + * @param group Group number of the searched Dicom Element + * @param elem Element number of the searched Dicom Element + * @return When present, the corresponding SeqEntry. + */ +SeqEntry *ElementSet::GetSeqEntry(uint16_t group, uint16_t elem) +{ + DocEntry *currentEntry = GetDocEntry(group, elem); + if ( !currentEntry ) + { + return 0; + } + if ( SeqEntry *entry = dynamic_cast(currentEntry) ) + { + return entry; + } + gdcmVerboseMacro( "Unfound SeqEntry."); + + return 0; +} + + //----------------------------------------------------------------------------- // Protected diff --git a/src/gdcmElementSet.h b/src/gdcmElementSet.h index 2b7cc0c9..5622c19d 100644 --- a/src/gdcmElementSet.h +++ b/src/gdcmElementSet.h @@ -3,8 +3,8 @@ Program: gdcm Module: $RCSfile: gdcmElementSet.h,v $ Language: C++ - Date: $Date: 2005/01/18 18:03:17 $ - Version: $Revision: 1.33 $ + Date: $Date: 2005/01/20 11:37:37 $ + Version: $Revision: 1.34 $ Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de l'Image). All rights reserved. See Doc/License.txt or @@ -58,6 +58,11 @@ public: DocEntry *GetFirstEntry(); DocEntry *GetNextEntry(); + DocEntry *GetDocEntry(uint16_t group, uint16_t elem); + ValEntry *GetValEntry(uint16_t group, uint16_t elem); + BinEntry *GetBinEntry(uint16_t group, uint16_t elem); + SeqEntry *GetSeqEntry(uint16_t group, uint16_t elem); + protected: private: -- 2.45.1