]> Creatis software - gdcm.git/commitdiff
gdcmParser doesn't loop any longer inside the Pixel element
authorjpr <jpr>
Fri, 30 Apr 2004 10:57:02 +0000 (10:57 +0000)
committerjpr <jpr>
Fri, 30 Apr 2004 10:57:02 +0000 (10:57 +0000)
src/gdcmDirList.cxx
src/gdcmHeader.cxx
src/gdcmHeader.h
src/gdcmParser.cxx

index ddbc63429bc4204c6811d569e03632e26398725b..5f8f3ccc2536bb4eb548efe2ed4dced09dec67a3 100644 (file)
@@ -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) )
index 472f74795a4446295e5cc02f108297bc2f37fdc8..c95f8a84a2a472728ce63347df29df8a041419cf 100644 (file)
@@ -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        
 }
 
 /**
index 273305c11160e301a8a4606606a4c462d4ff9e41..3d8564140d646e4667f2b6484dabee3427d903b1 100644 (file)
@@ -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)); }
       
index acd248eb3f5230b4cc34ae0c9db1d227d19d87d3..a29b042013d5b7f20e5c9e552323b418327094bf 100644 (file)
@@ -333,9 +333,9 @@ bool gdcmParser::CloseFile(void) {
  */
 bool gdcmParser::Write(FILE *fp, FileType type) {
 // ==============
-// TODO The stuff was rewritten using the chained list instea
-//      of the H table
-//      so we could remove the GroupHT from the gdcmParser
+// TODO The stuff will have to be rewritten using the SeQuence base
+//       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);