Posted by
Michael Schmid on
Oct 19, 2018; 9:39am
URL: http://imagej.273.s1.nabble.com/Locale-settings-tp5021325p5021326.html
Hi Kenneth,
both the File>Import Text Image and File>Save As>Text Image always use
decimal points (not commas), irrespective of the locale.
The code is in ij.plugin.TextReader and ij.io.TextEncoder, respectively.
ImageJ also uses decimal points to save numbers in tables, and commas
(not semicolons) as separators in CSV files, irrespective of the locale.
I consider this quite fortunate since most scientific software does it
like this.
[Many people in the European scientific community, including me, use the
English version of the operating system and software to avoid such
problems. This also avoids badly translated text in menus etc...]
In any case, changing all of ImageJ to consistently format and accept
numbers according to the current locale would be impossible. The macro
language must have decimal points (for compatibility with existing
code). Then e.g. a curve fit equation (macro language) would have
decimal points in numbers, but the fit parameters would have commas? It
would be a mess, and many macros and plugins would not work any more.
But I am aware that it can be a problem for importing .sv or txt files
into programs like Excel etc. - some programs use their own settings for
the number format, others the system-wide settings of the decimal
point/comma. Some versions of Excel let you decide whether to use the
system decimal separator or a custom one in the advanced options.
If your collaboration partners really need decimal commas, you need some
conversion, e.g.
https://stackoverflow.com/questions/39954541/how-to-replace-dots-with-commas-in-multiple-csv-filesMichael
________________________________________________________________
On 18/10/18 19:38, Kenneth Sloan wrote:
> When saving an image in "text" format, how are Locale settings determined? Are they inherited
> from the local machine's global settings? Or, is it possible to manipulate them within ImageJ?
>
> My question is motivated by collaborations involving USA and German participants. Occasionally,
> I need to run ImageJ on a USA-centric machine, but would prefer to generate German style output.
>
> The specific issue is the difference between '.' and ',' in the formatting of floating point
> pixel values.
>
> When I write Java plugins, I set the Locale directly, and can control this - but I'd prefer to
> use the Save As/text facility, if possible. I'd like to do this without switching the Locale for
> every other application running on my laptop!
>
> I suppose I could just write my own SaveAsGermanText plugin - but that seems like overkill.
>
> A small side question: I just found SaveAs/text. While not my first choice of image representation,
> I can see how it can be useful in some contexts, and I'd like to understand what can be done with it.
> In particular, how do I read back a .txt file and get an image?
> [and then, of course...can I deal with multiple formats - the '.' vs ',' issue, again]
>
> --
> Kenneth Sloan
>
[hidden email]
> Vision is the art of seeing what is invisible to others.
--
ImageJ mailing list:
http://imagej.nih.gov/ij/list.html