]> Creatis software - gdcm.git/blobdiff - src/gdcmDicomDir.cxx
prevent trouble during anon.
[gdcm.git] / src / gdcmDicomDir.cxx
index 197942142120ba5c50f81cfb16856959f90895bf..f1fd2561784fa24e016817f60594168d37a82ffc 100644 (file)
@@ -3,8 +3,8 @@
   Program:   gdcm
   Module:    $RCSfile: gdcmDicomDir.cxx,v $
   Language:  C++
-  Date:      $Date: 2007/08/29 15:30:48 $
-  Version:   $Revision: 1.195 $
+  Date:      $Date: 2010/04/09 15:23:40 $
+  Version:   $Revision: 1.198 $
   
   Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
   l'Image). All rights reserved. See Doc/License.txt or
@@ -480,7 +480,7 @@ bool DicomDir::Write(std::string const &fileName)
 
    std::ofstream *fp = new std::ofstream(fileName.c_str(),  
                                          std::ios::out | std::ios::binary);
-   if ( !fp ) 
+   if ( !fp )
    {
       gdcmWarningMacro("Failed to open(write) File: " << fileName.c_str());
       return false;
@@ -764,7 +764,7 @@ void DicomDir::CreateDicomDir()
             gdcmErrorMacro( "Add PatientToEnd failed");
          }
       }
-      /// \to do : deal with PRIVATE (not so easy, since PRIVATE appears 
+      /// \todo : deal with PRIVATE (not so easy, since PRIVATE appears 
       ///                           at different levels ?!? )
       
       else if ( v == "PRIVATE " ) // for SIEMENS 'CSA Non Image'      
@@ -944,6 +944,8 @@ void DicomDir::SetElements(std::string const &path, VectDocument const &list)
    {
       // get the current file characteristics
       patCurName         = (*it)->GetEntryString(0x0010,0x0010);
+      if (patCurName == "") // to prevent further troubles when wild anonymization was performed
+         patCurName = "gdcm^Patient";
       patCurID           = (*it)->GetEntryString(0x0010,0x0011);
       studCurInstanceUID = (*it)->GetEntryString(0x0020,0x000d);
       studCurID          = (*it)->GetEntryString(0x0020,0x0010);