]> Creatis software - gdcm.git/blobdiff - src/gdcmDicomDir.cxx
FIX gdcmParser::ReplaceOrCreateByNumber shouldn't seg fault any more (hope so...)
[gdcm.git] / src / gdcmDicomDir.cxx
index db6f357fadb67a9e1e560cf8cc3bac36660b70e6..0ae781076657270c9f3d5ebd39e5c6334a74a3ab 100644 (file)
@@ -313,20 +313,18 @@ bool gdcmDicomDir::Write(std::string fileName)
    fwrite("DICM",4,1,fp1);
    free(filePreamble);        
    UpdateDirectoryRecordSequenceLength();
-   WriteDicomDirEntries(fp1);
+   WriteEntries(fp1);
 
    fclose(fp1);
    return true;
 }
 
 /**
- * \ingroup gdcmParser
- * \brief   writes on disc according to the DICOMDIR format
- *          using the tree-like structure
+ * \brief   Writes in a file using the tree-like structure.
  * @param   _fp already open file pointer
  */
 
-void gdcmDicomDir::WriteDicomDirEntries(FILE *_fp)
+void gdcmDicomDir::WriteEntries(FILE *_fp)
 {   
    // TODO (?) tester les echecs en ecriture 
    //          (apres chaque fwrite, dans le WriteEntry)
@@ -340,28 +338,28 @@ void gdcmDicomDir::WriteDicomDirEntries(FILE *_fp)
    
    ptrMeta= GetDicomDirMeta();
    for(i=ptrMeta->debut();i!=ptrMeta->fin();++i) {
-      WriteEntry(*i,_fp,DICOMDIR);
+      WriteEntry(*i,_fp, ExplicitVR);
    }   
     
    itPatient = GetDicomDirPatients().begin(); 
    while ( itPatient != GetDicomDirPatients().end() ) {
       for(i=(*itPatient)->debut();i!=(*itPatient)->fin();++i) {
-         WriteEntry(*i,_fp,DICOMDIR);
+         WriteEntry(*i,_fp, ExplicitVR);
       }
       itStudy = ((*itPatient)->GetDicomDirStudies()).begin();        
       while (itStudy != (*itPatient)->GetDicomDirStudies().end() ) {   
          for(i=(*itStudy)->debut();i!=(*itStudy)->fin();++i) {
-            WriteEntry(*i,_fp,DICOMDIR);
+            WriteEntry(*i,_fp, ExplicitVR);
          } 
          itSerie = ((*itStudy)->GetDicomDirSeries()).begin();
          while (itSerie != (*itStudy)->GetDicomDirSeries().end() ) {
             for(i=(*itSerie)->debut();i!=(*itSerie)->fin();++i) {
-               WriteEntry(*i,_fp,DICOMDIR);
+               WriteEntry(*i,_fp, ExplicitVR);
             }
             itImage = ((*itSerie)->GetDicomDirImages()).begin();
             while (itImage != (*itSerie)->GetDicomDirImages().end() ) {
                for(i=(*itImage)->debut();i!=(*itImage)->fin();++i) {
-                  WriteEntry(*i,_fp,DICOMDIR);
+                  WriteEntry(*i,_fp, ExplicitVR);
                }
                ++itImage;                  
            }
@@ -448,13 +446,13 @@ void gdcmDicomDir::CheckBoundaries()
             itImage = ((*itSerie)->GetDicomDirImages()).begin();
             while (itImage != (*itSerie)->GetDicomDirImages().end() ) {
                (*itImage)->ResetBoundaries(1);
-               ++itImage;
-       }
-       ++itSerie;
-         }
-      ++itStudy;
-      
-      ++itPatient;     
+              ++itImage;
+            }
+            ++itSerie;
+        }
+        ++itStudy;
+     } 
+     ++itPatient;     
    }
 }