When Windows regional settings do not have '.' as the decimal symbol - as is common in many European countries, for example - floating point properties such as OpenSlideImage.MicronsPerPixelX and OpenSlideImage.MicronsPerPixelY are parsed incorrectly from their string equivalent properties. This stems from the use of the double.TryParse(string, out double) method which is culture sensitive.
The OpenSlide library uses the g_ascii_dtostr method to convert doubles to strings which ensures that '.' is used as the decimal point.
The properties should parse the string using the invariant culture in double.TryParse(string, NumberStyles, IFormatProvider, out double) where IFormatProvider is CultureInfo.InvariantCulture which uses '.' as the decimal symbol.
Consider doing similar for the float and doubleGetProperty extension methods too.
When Windows regional settings do not have '.' as the decimal symbol - as is common in many European countries, for example - floating point properties such as
OpenSlideImage.MicronsPerPixelX
andOpenSlideImage.MicronsPerPixelY
are parsed incorrectly from their string equivalent properties. This stems from the use of thedouble.TryParse(string, out double)
method which is culture sensitive.The OpenSlide library uses the
g_ascii_dtostr
method to convertdouble
s tostring
s which ensures that '.' is used as the decimal point.The properties should parse the string using the invariant culture in
double.TryParse(string, NumberStyles, IFormatProvider, out double)
whereIFormatProvider
isCultureInfo.InvariantCulture
which uses '.' as the decimal symbol.Consider doing similar for the
float
anddouble
GetProperty
extension methods too.