From cab33b4e50f532b0222121fca7daf9bdaf94eb7e Mon Sep 17 00:00:00 2001 From: jpr Date: Fri, 30 Apr 2004 10:57:02 +0000 Subject: [PATCH] gdcmParser doesn't loop any longer inside the Pixel element --- src/gdcmDirList.cxx | 4 +--- src/gdcmHeader.cxx | 4 ++-- src/gdcmHeader.h | 3 +++ src/gdcmParser.cxx | 24 ++++++++++++++++-------- 4 files changed, 22 insertions(+), 13 deletions(-) diff --git a/src/gdcmDirList.cxx b/src/gdcmDirList.cxx index ddbc6342..5f8f3ccc 100644 --- a/src/gdcmDirList.cxx +++ b/src/gdcmDirList.cxx @@ -26,7 +26,6 @@ gdcmDirList::gdcmDirList(std::string dirName,bool recursive) { name=dirName; - NormalizePath(name); Explore(name,recursive); } @@ -71,7 +70,6 @@ void gdcmDirList::Explore(std::string dirName,bool recursive) std::string fileName; NormalizePath(dirName); - #if defined(_MSC_VER) || (__CYGWIN__) WIN32_FIND_DATA fileData; HANDLE hFile=FindFirstFile((dirName+"*").c_str(),&fileData); @@ -99,7 +97,7 @@ void gdcmDirList::Explore(std::string dirName,bool recursive) for (int i= 0;i < n; i++) { - fileName=namelist[i]->d_name; + fileName=namelist[i]->d_name; if(namelist[i]->d_type==DT_DIR) { if( (fileName!=".") && (fileName!="..") && (recursive) ) diff --git a/src/gdcmHeader.cxx b/src/gdcmHeader.cxx index 472f7479..c95f8a84 100644 --- a/src/gdcmHeader.cxx +++ b/src/gdcmHeader.cxx @@ -65,7 +65,7 @@ gdcmHeader::gdcmHeader(const char *InFilename, countGrPixel = GetEntry().count(key); // we set the SQ Depth of each Header Entry - + int top =-1; int countSQ = 0; pileElem pile[100]; // Hope embedded sequence depth is no that long ! @@ -166,7 +166,7 @@ gdcmHeader::gdcmHeader(const char *InFilename, (*i)->SetPrintLevel(2); (*i)->Print(); } - } // end for + } // end for } /** diff --git a/src/gdcmHeader.h b/src/gdcmHeader.h index 273305c1..3d856414 100644 --- a/src/gdcmHeader.h +++ b/src/gdcmHeader.h @@ -106,6 +106,9 @@ public: // Entry +// These functions are necessary for Python because +// there are protected in the parent class + inline virtual std::string GetEntryByNumber (guint16 group, guint16 element) { return(gdcmParser::GetEntryByNumber(group,element)); } diff --git a/src/gdcmParser.cxx b/src/gdcmParser.cxx index acd248eb..a29b0420 100644 --- a/src/gdcmParser.cxx +++ b/src/gdcmParser.cxx @@ -333,9 +333,9 @@ bool gdcmParser::CloseFile(void) { */ bool gdcmParser::Write(FILE *fp, FileType type) { // ============== -// TODO The stuff was rewritten using the chained list instead -// of the H table -// so we could remove the GroupHT from the gdcmParser +// TODO The stuff will have to be rewritten using the SeQuence based +// tree-like stucture instead of the chained list . +// (so we shall remove the GroupHT from the gdcmParser) // To be checked // ============= @@ -1231,7 +1231,7 @@ guint16 gdcmParser::UnswapShort(guint16 a) { /** * \ingroup gdcmParser * \brief Parses the header of the file and load element values. - * @return false if file is not ACR-NEMA / DICOM + * @return false if file is not ACR-NEMA / PAPYRUS / DICOM */ bool gdcmParser::LoadHeaderEntries(bool exception_on_error) throw(gdcmFormatError) { (void)exception_on_error; @@ -1244,11 +1244,18 @@ bool gdcmParser::LoadHeaderEntries(bool exception_on_error) throw(gdcmFormatErro SkipHeaderEntry(newHeaderEntry); if ( (ignoreShadow==0) || (newHeaderEntry->GetGroup()%2) == 0) { AddHeaderEntry(newHeaderEntry); - LoadHeaderEntry(newHeaderEntry); } - } + } rewind(fp); - + // Be carefull : merging this two loops may cause troubles ... + for (ListTag::iterator i = GetListEntry().begin(); + i != GetListEntry().end(); + ++i) + { + LoadHeaderEntry(*i); + } + rewind(fp); + // Load 'non string' values std::string PhotometricInterpretation = GetEntryByNumber(0x0028,0x0004); @@ -1274,7 +1281,8 @@ bool gdcmParser::LoadHeaderEntries(bool exception_on_error) throw(gdcmFormatErro std::string RecCode; RecCode = GetEntryByNumber(0x0008, 0x0010); // recognition code if (RecCode == "ACRNEMA_LIBIDO_1.1" || - RecCode == "CANRME_AILIBOD1_1." ) + RecCode == "CANRME_AILIBOD1_1." ) // for brain-damaged softwares + // with "little-endian strings" { filetype = ACR_LIBIDO; std::string rows = GetEntryByNumber(0x0028, 0x0010); -- 2.48.1