X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=src%2FgdcmObject.cxx;h=e747b3b39afe68b55b562af49d8f91214d59270a;hb=c5618e6b8276e1b21bbea354fe8bcba3c78eb4bd;hp=a067e72b764e3a14f1e3f88af6c6e29287e3e98c;hpb=9b3db5f141ec2b11eadefaa2ea2a3a20058b37f9;p=gdcm.git diff --git a/src/gdcmObject.cxx b/src/gdcmObject.cxx index a067e72b..e747b3b3 100644 --- a/src/gdcmObject.cxx +++ b/src/gdcmObject.cxx @@ -1,10 +1,10 @@ // gdcmObject.cxx //----------------------------------------------------------------------------- #include "gdcmObject.h" -#include "gdcmUtil.h" +#include "gdcmGlobal.h" +#include "gdcmDebug.h" //----------------------------------------------------------------------------- -// Constructor / Destructor /** * \ingroup gdcmObject * \brief Constructor @@ -44,11 +44,10 @@ gdcmObject::~gdcmObject(void) { void gdcmObject::Print(std::ostream &os) { if(printLevel>=0) { ListTag::iterator i; - //for(ListTag::iterator i=beginObj;i!=endObj;++i) // JPR for(i=beginObj;;++i) { (*i)->SetPrintLevel(printLevel); (*i)->Print(os); - if (i == endObj) break; + if (i == endObj) break; } } } @@ -61,7 +60,6 @@ void gdcmObject::Print(std::ostream &os) { * @return */ std::string gdcmObject::GetEntryByNumber(guint16 group, guint16 element) { - //for(ListTag::iterator i=beginObj;i!=endObj;++i) // JPR for(ListTag::iterator i=beginObj;;++i) { if ( (*i)->GetGroup()==group && (*i)->GetElement()==element) return (*i)->GetValue(); @@ -94,19 +92,22 @@ std::string gdcmObject::GetEntryByName(TagName name) { * @param flag = 0 when META to be dealt with */ void gdcmObject::ResetBoundaries(int flag) { - + if (flag) { // it's NOT a META // upwards to fffe,e000 - for( i=j=debut(); - ((*i)->GetGroup() != 0xfffe) && ((*i)->GetElement() != 0x0000); - --i,j--) { - } + for( i=j=debut(); + ((*i)->GetGroup() != 0xfffe) && ((*i)->GetElement() != 0xe000); + --i,j--) { + } beginObj=j; } - // downwards to fffe,e000 + // upwards again to fffe,e000 + if (fin()== (--(plistEntries->end())) ) // Don't try anything more when end + return; // of Chained List is reached + for( i=j=fin(); - ((*i)->GetGroup() != 0xfffe) && ((*i)->GetElement() != 0x0000); + ((*i)->GetGroup() != 0xfffe) && ((*i)->GetElement() != 0xe000); --i,j--) { } j--; @@ -114,7 +115,6 @@ void gdcmObject::ResetBoundaries(int flag) { } /** - * \ingroup gdcmParser * \brief Sets Entry (Dicom Element) value of an element, * specified by it's tag (Group, Number) * and the length, too ... @@ -129,7 +129,6 @@ void gdcmObject::ResetBoundaries(int flag) { bool gdcmObject::SetEntryByNumber(std::string val,guint16 group, guint16 element) { - gdcmHeaderEntry *a; for(ListTag::iterator i=beginObj;;++i) { if ( (*i)->GetGroup() == 0xfffe && (*i)->GetElement() == 0xe000 ) continue; @@ -150,12 +149,11 @@ void gdcmObject::ResetBoundaries(int flag) { } // we assume the constructor didn't fail Entry = new gdcmHeaderEntry(DictEntry); - // ---- - // TODO - // ---- - // better we don't assume too much ! - // in the next release, gdcmObject will be used - // to describe any Header Entry ... + /// \todo + /// ---- + /// better we don't assume too much ! + /// in the next release, gdcmObject will be used + /// to describe any Header Entry ... } else { Entry = ptagHT->find(key)->second; } @@ -180,7 +178,6 @@ void gdcmObject::ResetBoundaries(int flag) { */ TagHeaderEntryHT gdcmObject::GetEntry(void) { TagHeaderEntryHT HT; - //for(ListTag::iterator i=beginObj;i!=endObj;++i) // JPR for(ListTag::iterator i=beginObj;;++i) { HT.insert( PairHT( (*i)->GetKey(),(*i)) ); if (i == endObj) break; @@ -197,7 +194,6 @@ TagHeaderEntryHT gdcmObject::GetEntry(void) { */ ListTag gdcmObject::GetListEntry(void) { ListTag list; - //for(ListTag::iterator i=beginObj;i!=endObj;++i) // JPR for(ListTag::iterator i=beginObj;;++i) { list.push_back(*i); if (i == endObj) break; @@ -208,7 +204,7 @@ ListTag gdcmObject::GetListEntry(void) { //----------------------------------------------------------------------------- // Protected -/* +/** * \ingroup gdcmObject * \brief add the 'Object' related Dicom Elements to the listEntries * of a partially created DICOMDIR @@ -229,7 +225,7 @@ void gdcmObject::FillObject(std::list elemList) { tmpEl=it->elem; dictEntry=gdcmGlobal::GetDicts()->GetDefaultPubDict()->GetDictEntryByNumber(tmpGr,tmpEl); entry=new gdcmHeaderEntry(dictEntry); - entry->SetOffset(0); // just to avoid missprinting //JPR + entry->SetOffset(0); // just to avoid further missprinting entry->SetValue(it->value); if(dictEntry->GetGroup()==0xfffe) @@ -253,7 +249,7 @@ void gdcmObject::FillObject(std::list elemList) { entry->SetLength(entry->GetValue().length()); } ptagHT->insert( PairHT(entry->GetKey(),entry) ); // add in the (multimap) H Table - plistEntries->insert(debInsertion ,entry); // en tete de liste des Patients + plistEntries->insert(debInsertion ,entry); // add at the begining of the Patient list ++finInsertion; }