The vtkDICOMImageReader is sensitive to locale
The vtkDICOMImageReader contains several
atof() calls, which will misinterpret '.' and ',' in some locales. This problem is usually not seen in simple test programs, since the "C" locale is the default on startup.
However, some GUI frameworks like Qt internally use
std::locale::setglobal() to switch from the "C" locale to the system's preferred locale. In this case, people who live in Europe or South America will find that vtkDICOMImageReader no longer works.
Two possible solutions:
- make the reader switch to the "C" locale before calling atof(), though this can have side-effects
- replace the atof() calls with stream-based conversion, and imbue the streams with the "C" locale
See #17657 (closed) for problems caused by this issue.