Error using ITK::ImageFileWriter in QtApplication in Ubuntu

we are using C++, Ubuntu 18.04, GCC

I got a weird error using the ITK::ImageFileWriter. We are creating an nrrd file like in the example on Everything works fine till we used it in a QApplication.

then it messes up the NRRD Header. Iterestingly its only doing this in the context of a QApplication.

It writes the dimensions in the headers with commas in the flaoting point numbers so 0.5423456 becomes 0,5423456.

This forces an error when we try to load the file because the Reader can’t tell the dimensions anymore because they are seperated by commas.

so (0.5423456,0,0) becomes (0,5423456,0,0) which shows 4 instead of 3 dimensions.

we are getting this problem on Ubuntu 18.04 only. When I am using my mac its all fine.

1 Like

It sounds like the application is changing locale setting for C or C++, so the library writing floating point numbers uses European decimal separator (comma) instead of the US one (dot). This creates invalid files.

1 Like