- tokens[3] = gdcm::Util::GetName( *it );
- userFileIdentifier = tokens[0] + "_" + tokens[1] + "_" + tokens[2] + "_" + tokens[3] + "_" + tokens[4];
- }
+ ///this is a trick to build up a lexicographical compliant name :
+ /// eg : fich001.ima vs fich100.ima as opposed to fich1.ima vs fich100.ima
+ std::string name = gdcm::Util::GetName( *it );
+ if (hasSkel)
+ {
+ gdcm::Util::Tokenize (name, tokensForFileName, skel);
+ imageNum = atoi ( tokensForFileName[0].c_str() );
+ // probabely we could write something much more complicated using C++ !
+ sprintf (newName, "%s%06d%s", skel, imageNum, extent);
+ tokens[3] = newName;
+ tokensForFileName.clear();
+ }
+ else
+ tokens[3] = name;