]> Creatis software - gdcm.git/blobdiff - src/gdcmSerieHelper.cxx
SerieHelper::CreateUserDefinedFileIdentifier doesn't convert unfound fields
[gdcm.git] / src / gdcmSerieHelper.cxx
index 3761252f910ed4e0294ac29afa763463654249b9..8b7ec07e39d881c74904c6951899f830335e0905 100644 (file)
@@ -3,8 +3,8 @@
   Program:   gdcm
   Module:    $RCSfile: gdcmSerieHelper.cxx,v $
   Language:  C++
-  Date:      $Date: 2006/01/18 15:25:07 $
-  Version:   $Revision: 1.42 $
+  Date:      $Date: 2006/01/26 09:07:15 $
+  Version:   $Revision: 1.44 $
                                                                                 
   Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
   l'Image). All rights reserved. See Doc/License.txt or
@@ -960,7 +960,7 @@ std::string SerieHelper::CreateUserDefinedFileIdentifier( File * inFile )
   //     Deal with all user supplied tags.
   //      (user knows more than we do about his images!)
   
-   float converted;
+   double converted;
    std::string id;
    std::string s; 
    char charConverted[17]; 
@@ -976,12 +976,15 @@ std::string SerieHelper::CreateUserDefinedFileIdentifier( File * inFile )
       // e.g : 100 would be *before* 20; 000020.00 vs 00100.00 : OK
       if (it2->convert)
       {
-         converted = atof(s.c_str());
-         // probabely something much more complicated is possible, 
-         // using C++ features
-         /// \todo check the behaviour when there are >0 and <0 numbers
-         sprintf(charConverted, "%016.6f",converted);
-         s = charConverted;
+         if ( s != GDCM_UNFOUND) // Don't convert unfound fields !
+         {
+            converted = atof(s.c_str());
+            // probabely something much more complicated is possible, 
+            // using C++ features
+            /// \todo check the behaviour when there are >0 and <0 numbers
+            sprintf(charConverted, "%016.6f",converted);
+            s = charConverted;
+         }
       }
       // Eliminate non-alphanum characters, including whitespace.
       for(unsigned int i=0; i<s.size(); i++)