Points are stored into the mitk::PointSet with the precision of mitk::ScalarType. Which is right now a double value. When saving the PointSet the PointSetWriter only saves the values with 4 decimals instead of the full double range used internally in the PointSet. Saving a PointSet and loading it can lead to confusing computations, since it is not possible to reproduce the expected results.
|Resolved||None||T17765 When saving a PointSet the double values are saved with a maximum of 4 decimals|
|Resolved||None||T14866 Make FileReader and FileWriter Microservice-based|
I think this bug should be fixed by creating new reference data, since I made a TinyXML patch which by default outputs 14 digits after comma.
Was talking to Eric: PointSetWriter doesn't use TinyXML but writes out on its own. Proposed solution is to switch to TinyXML for PointSet output. But this will be some effort.
Tobi: we should ask Michael Mueller since he might know a reason to restrict output to 4 decimals (size?)
We discussed this at the MITK meeting:
- for any XML output a library should be used, so TinyXML and more precision makes sense
- there have been precision problems before with TinyXML, you should look at them
- the reader / writer branch (T14866) contains related changes, so before actually coding on this bug you shoud synchronize with 14866's assignee
Sebastian, what is the status of this bug? Is it likely to fix that for the upcoming release?
In v2015.05.0 release this is still present. When you save a pointset you get only 6 values.
<x>-7.095</x> <y>52.2572</y> <z>2047.83</z>
In case the coordinate has a larger number of character before the point the characters after the point are cut. Thus the precision is less when further away from the origin...
A very critical bug to us!
Reproducd with the latest installer. Create a point set and store it to disc.
precision bug fixed in my fork
(A colleague fixed this bug by adding the precision and setting the precision to fixed.)
<point> <id>0</id> <specification>0</specification> <x>-123.88</x> <y>-43.3363</y> <z>1111.5</z> </point>
afterwards (different points9
<point> <id>43</id> <specification>0</specification> <x>65.698199184397</x> <y>113.579290000000</y> <z>88.070737512467</z> </point>
Please integrate this into the master. I can add a pullrequest if this makes it any easier.
...besides: the current implementation also incorporates locales. So if you are on a English machine your separator will be "." and on a e.g. German machine it will be ",". This will cause an issue if you are sharing the files amongst different machines (en/de). An English machine can't read the German mps files then. Haven't checked the implementation in that direction properly but it looked suspicious to me... The proposed fix doesn't consider locales and sets it fixed to separate with ".".
See also T16115 where the PointSet writer has been changed. XML is created using TinyXML, precision is improved as suggested by Ingmar.