From a23d3b0e36743664f22f42269224f305ccf50fdb Mon Sep 17 00:00:00 2001 From: regrain Date: Thu, 5 Feb 2004 10:53:41 +0000 Subject: [PATCH] * ENH : add methods in gdcmObject to get the hash table or the list of header entries -- BeNours --- ChangeLog | 4 +++ src/gdcmImage.cxx | 15 +++++++++++ src/gdcmObject.cxx | 61 ++++++++++++++++++++++++++++++++++++++++++++- src/gdcmObject.h | 3 +++ src/gdcmPatient.cxx | 15 +++++++++++ src/gdcmSerie.cxx | 15 +++++++++++ src/gdcmStudy.cxx | 15 +++++++++++ 7 files changed, 127 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 05f1474d..cfad4d3f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2004-02-05 Benoit Regrain + * ENH : add methods in gdcmObject to get the hash table or the list of + header entries + 2004-02-04 Benoit Regrain * FIX : even length for some strings when writting the dicom dir * FIX : sort the images in the dicom dir diff --git a/src/gdcmImage.cxx b/src/gdcmImage.cxx index e47585aa..5484f9d9 100644 --- a/src/gdcmImage.cxx +++ b/src/gdcmImage.cxx @@ -4,17 +4,32 @@ //----------------------------------------------------------------------------- // Constructor / Destructor +/** + * \ingroup gdcmImage + * \brief + * @param begin iterator of begin for the object + * @param end iterator of end for the object + */ gdcmImage::gdcmImage(ListTag::iterator begin,ListTag::iterator end): gdcmObject(begin,end) { } +/** + * \ingroup gdcmImage + * \brief Canonical destructor. + */ gdcmImage::~gdcmImage() { } //----------------------------------------------------------------------------- // Print +/** + * \ingroup gdcmImage + * \brief Prints the Object + * @return + */ void gdcmImage::Print(std::ostream &os) { os<<"IMAGE : "; diff --git a/src/gdcmObject.cxx b/src/gdcmObject.cxx index 93942bdd..82ff5131 100644 --- a/src/gdcmObject.cxx +++ b/src/gdcmObject.cxx @@ -5,6 +5,12 @@ //----------------------------------------------------------------------------- // Constructor / Destructor +/** + * \ingroup gdcmObject + * \brief + * @param begin iterator of begin for the object + * @param end iterator of end for the object + */ gdcmObject::gdcmObject(ListTag::iterator begin,ListTag::iterator end) { beginObj=begin; @@ -14,12 +20,21 @@ gdcmObject::gdcmObject(ListTag::iterator begin,ListTag::iterator end) dbg.Verbose(0, "gdcmObject::gdcmObject empty list"); } +/** + * \ingroup gdcmObject + * \brief Canonical destructor. + */ gdcmObject::~gdcmObject(void) { } //----------------------------------------------------------------------------- // Print +/** + * \ingroup gdcmObject + * \brief Prints the Object + * @return + */ void gdcmObject::Print(std::ostream &os) { if(printLevel>=0) @@ -34,6 +49,11 @@ void gdcmObject::Print(std::ostream &os) //----------------------------------------------------------------------------- // Public +/** + * \ingroup gdcmObject + * \brief Get an entry by number + * @return + */ std::string gdcmObject::GetEntryByNumber(guint16 group, guint16 element) { for(ListTag::iterator i=beginObj;i!=endObj;++i) @@ -45,7 +65,12 @@ std::string gdcmObject::GetEntryByNumber(guint16 group, guint16 element) return GDCM_UNFOUND; } - +/** + * \ingroup gdcmObject + * \brief Get an entry by name + * @param name name of the searched element. + * @return + */ std::string gdcmObject::GetEntryByName(TagName name) { gdcmDict *PubDict=gdcmGlobal::GetDicts()->GetDefaultPubDict(); @@ -56,6 +81,40 @@ std::string gdcmObject::GetEntryByName(TagName name) return GetEntryByNumber(dictEntry->GetGroup(),dictEntry->GetElement()); } +/** + * \ingroup gdcmObject + * \brief Get all entries in a hash table + * @return + */ +TagHeaderEntryHT gdcmObject::GetEntry(void) +{ + TagHeaderEntryHT HT; + + for(ListTag::iterator it=beginObj;it!=endObj;++it) + { + HT.insert( PairHT( (*it)->GetKey(),(*it)) ); + } + + return(HT); +} + +/** + * \ingroup gdcmObject + * \brief Get all entries in a list + * @return + */ +ListTag gdcmObject::GetListEntry(void) +{ + ListTag list; + + for(ListTag::iterator it=beginObj;it!=endObj;++it) + { + list.push_back(*it); + } + + return(list); +} + //----------------------------------------------------------------------------- // Protected diff --git a/src/gdcmObject.h b/src/gdcmObject.h index ff560f55..b8457546 100644 --- a/src/gdcmObject.h +++ b/src/gdcmObject.h @@ -26,6 +26,9 @@ public: std::string GetEntryByNumber(guint16 group, guint16 element); std::string GetEntryByName(TagName name); + TagHeaderEntryHT GetEntry(void); + ListTag GetListEntry(void); + protected: ListTag::iterator beginObj; ListTag::iterator endObj; diff --git a/src/gdcmPatient.cxx b/src/gdcmPatient.cxx index 11ec6ac8..e7f8ed4a 100644 --- a/src/gdcmPatient.cxx +++ b/src/gdcmPatient.cxx @@ -4,11 +4,21 @@ //----------------------------------------------------------------------------- // Constructor / Destructor +/** + * \ingroup gdcmPatient + * \brief + * @param begin iterator of begin for the object + * @param end iterator of end for the object + */ gdcmPatient::gdcmPatient(ListTag::iterator begin,ListTag::iterator end): gdcmObject(begin,end) { } +/** + * \ingroup gdcmPatient + * \brief Canonical destructor. + */ gdcmPatient::~gdcmPatient() { for(ListStudy::iterator cc = studies.begin();cc != studies.end();++cc) @@ -19,6 +29,11 @@ gdcmPatient::~gdcmPatient() //----------------------------------------------------------------------------- // Print +/** + * \ingroup gdcmPatient + * \brief Prints the Object + * @return + */ void gdcmPatient::Print(std::ostream &os) { os<<"PATIENT"<