From 4962adb161e312436550b1569781c520d4fea97e Mon Sep 17 00:00:00 2001 From: jpr Date: Thu, 26 Jan 2006 09:07:15 +0000 Subject: [PATCH] SerieHelper::CreateUserDefinedFileIdentifier doesn't convert unfound fields when convertion is asked --- src/gdcmSerieHelper.cxx | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/src/gdcmSerieHelper.cxx b/src/gdcmSerieHelper.cxx index 5925b875..8b7ec07e 100644 --- a/src/gdcmSerieHelper.cxx +++ b/src/gdcmSerieHelper.cxx @@ -3,8 +3,8 @@ Program: gdcm Module: $RCSfile: gdcmSerieHelper.cxx,v $ Language: C++ - Date: $Date: 2006/01/24 20:53:54 $ - Version: $Revision: 1.43 $ + 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 @@ -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