Skip to content

Reconsider string representation of floating points for parameter files and parameter maps #383

@N-Dekker

Description

@N-Dekker

It seems more convenient to represent floating point (double) parameter values the same way for parameter files and parameter maps. Elastix currently uses scientific format, and default precision for parameter maps, and fixed (showpoint) format with a precision of 10 for parameter files. Both formats are lossy. C++11 allows specifying a lossless precision by max_digits10.

The following tables could be helpful. Related to issue #217 the "Origin" precision in TransformParameters is not high enough by @GouZi2019

Format Precision Length String representation of 0
scientific 6 (default) 1 0
scientific 10 (elastix-txt-file) 1 0
scientific 15 (digits10) 1 0
scientific 17 (max_digits10) 1 0
fixed (showpoint) 6 (default) 8 0.000000
fixed (showpoint) 10 (elastix-txt-file) 12 0.0000000000
fixed (showpoint) 15 (digits10) 17 0.000000000000000
fixed (showpoint) 17 (max_digits10) 19 0.00000000000000000
Format Precision Length String representation of 1
scientific 6 (default) 1 1
scientific 10 (elastix-txt-file) 1 1
scientific 15 (digits10) 1 1
scientific 17 (max_digits10) 1 1
fixed (showpoint) 6 (default) 8 1.000000
fixed (showpoint) 10 (elastix-txt-file) 12 1.0000000000
fixed (showpoint) 15 (digits10) 17 1.000000000000000
fixed (showpoint) 17 (max_digits10) 19 1.00000000000000000
Format Precision Length String representation of 0.1
scientific 6 (default) 3 0.1
scientific 10 (elastix-txt-file) 3 0.1
scientific 15 (digits10) 3 0.1
scientific 17 (max_digits10) 19 0.10000000000000001
fixed (showpoint) 6 (default) 8 0.100000
fixed (showpoint) 10 (elastix-txt-file) 12 0.1000000000
fixed (showpoint) 15 (digits10) 17 0.100000000000000
fixed (showpoint) 17 (max_digits10) 19 0.10000000000000001
Format Precision Length String representation of 1.0 / 3.0
scientific 6 (default) 8 0.333333
scientific 10 (elastix-txt-file) 12 0.3333333333
scientific 15 (digits10) 17 0.333333333333333
scientific 17 (max_digits10) 19 0.33333333333333331
fixed (showpoint) 6 (default) 8 0.333333
fixed (showpoint) 10 (elastix-txt-file) 12 0.3333333333
fixed (showpoint) 15 (digits10) 17 0.333333333333333
fixed (showpoint) 17 (max_digits10) 19 0.33333333333333331
Format Precision Length String representation of 1e-10
scientific 6 (default) 5 1e-10
scientific 10 (elastix-txt-file) 5 1e-10
scientific 15 (digits10) 5 1e-10
scientific 17 (max_digits10) 5 1e-10
fixed (showpoint) 6 (default) 8 0.000000
fixed (showpoint) 10 (elastix-txt-file) 12 0.0000000001
fixed (showpoint) 15 (digits10) 17 0.000000000100000
fixed (showpoint) 17 (max_digits10) 19 0.00000000010000000
Format Precision Length String representation of 1e+10
scientific 6 (default) 5 1e+10
scientific 10 (elastix-txt-file) 5 1e+10
scientific 15 (digits10) 11 10000000000
scientific 17 (max_digits10) 11 10000000000
fixed (showpoint) 6 (default) 18 10000000000.000000
fixed (showpoint) 10 (elastix-txt-file) 22 10000000000.0000000000
fixed (showpoint) 15 (digits10) 27 10000000000.000000000000000
fixed (showpoint) 17 (max_digits10) 29 10000000000.00000000000000000
Format Precision Length String representation of 1e+10 - 1
scientific 6 (default) 5 1e+10
scientific 10 (elastix-txt-file) 10 9999999999
scientific 15 (digits10) 10 9999999999
scientific 17 (max_digits10) 10 9999999999
fixed (showpoint) 6 (default) 17 9999999999.000000
fixed (showpoint) 10 (elastix-txt-file) 21 9999999999.0000000000
fixed (showpoint) 15 (digits10) 26 9999999999.000000000000000
fixed (showpoint) 17 (max_digits10) 28 9999999999.00000000000000000
Format Precision Length String representation of M_PI
scientific 6 (default) 7 3.14159
scientific 10 (elastix-txt-file) 11 3.141592654
scientific 15 (digits10) 16 3.14159265358979
scientific 17 (max_digits10) 18 3.1415926535897931
fixed (showpoint) 6 (default) 8 3.141593
fixed (showpoint) 10 (elastix-txt-file) 12 3.1415926536
fixed (showpoint) 15 (digits10) 17 3.141592653589793
fixed (showpoint) 17 (max_digits10) 19 3.14159265358979312
Format Precision Length String representation of DBL_MIN
scientific 6 (default) 12 2.22507e-308
scientific 10 (elastix-txt-file) 16 2.225073859e-308
scientific 15 (digits10) 20 2.2250738585072e-308
scientific 17 (max_digits10) 23 2.2250738585072014e-308
fixed (showpoint) 6 (default) 8 0.000000
fixed (showpoint) 10 (elastix-txt-file) 12 0.0000000000
fixed (showpoint) 15 (digits10) 17 0.000000000000000
fixed (showpoint) 17 (max_digits10) 19 0.00000000000000000
Format Precision Length String representation of DBL_EPSILON
scientific 6 (default) 11 2.22045e-16
scientific 10 (elastix-txt-file) 15 2.220446049e-16
scientific 15 (digits10) 20 2.22044604925031e-16
scientific 17 (max_digits10) 22 2.2204460492503131e-16
fixed (showpoint) 6 (default) 8 0.000000
fixed (showpoint) 10 (elastix-txt-file) 12 0.0000000000
fixed (showpoint) 15 (digits10) 17 0.000000000000000
fixed (showpoint) 17 (max_digits10) 19 0.00000000000000022
Format Precision Length String representation of DBL_MAX
scientific 6 (default) 12 1.79769e+308
scientific 10 (elastix-txt-file) 16 1.797693135e+308
scientific 15 (digits10) 21 1.79769313486232e+308
scientific 17 (max_digits10) 23 1.7976931348623157e+308
fixed (showpoint) 6 (default) 316 1797693134...4124858368.000000
fixed (showpoint) 10 (elastix-txt-file) 320 1797693134...4124858368.0000000000
fixed (showpoint) 15 (digits10) 325 1797693134...4124858368.000000000000000
fixed (showpoint) 17 (max_digits10) 327 1797693134...4124858368.00000000000000000

Metadata

Metadata

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions