Program: gdcm
Module: $RCSfile: gdcmSerieHelper.cxx,v $
Language: C++
- Date: $Date: 2006/01/18 15:25:07 $
- Version: $Revision: 1.42 $
+ Date: $Date: 2006/02/05 23:13:36 $
+ Version: $Revision: 1.46 $
Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
l'Image). All rights reserved. See Doc/License.txt or
* Criterions will be set with AddSeriesDetail.
* (Maybe the method should be moved elsewhere
* -File class? FileHelper class?-
- * @return FileIdentifier (Tokenizable on '_')
+ * @return FileIdentifier (Tokenizable on '%%%'. Hope it's enough !)
*/
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];
{
const ExDetail &r = *it2;
s = inFile->GetEntryString( r.group, r.elem );
-
+
// User is allowed to ask 'convertion', to allow further ordering
// 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++)
{
while(i<s.size()
- && !( s[i] == '.' || s[i] == '-'
+ && !( s[i] == '.' || s[i] == '%'
|| (s[i] >= 'a' && s[i] <= 'z')
|| (s[i] >= '0' && s[i] <= '9')
|| (s[i] >= 'A' && s[i] <= 'Z')))
}
id += s.c_str();
- id += "_"; // make the FileIdentifier Tokenizable
+ id += "%%%"; // make the FileIdentifier Tokenizable
}
return id;