-void removeSpecChar(std::string &s);
-
-void removeSpecChar(std::string &s) {
- unsigned int s_size = s.size();
- for(unsigned int i=0; i<s_size; i++)
- {
- if (
- /*while(i<s_size
- && */!( s[i] == '.' || 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')))
- {
- s.replace(i, 1, "_"); // ImagePositionPatient related stuff will be more human readable
- }
- }
-
- // deal with Dicom strings trailing '\0'
- if(s[s_size-1] == '_')
- s.erase(s_size-1, 1);
-
-}