Transform VTK files in accordance with their format and floating point precision#1253
Transform VTK files in accordance with their format and floating point precision#1253
Conversation
If the VTK input file is a binary file, the output file should also be a binary file. Otherwise, the output file is still ASCII, as before. Inspired by pull request #943 "ENH: Support for binary point file (.bin) reading and writing", ChristophKirst, Aug 2, 2023.
If the VTK input file has 32-bit `float` as data type, the output file should also have 32-bit `float` data. Otherwise, the output file still has 64-bit `double` data, as before.
|
@ChristophKirst can you please let us know if this pull request would be helpful to you? Would it be possible/useful for you to use 32-bit floating point precision binary VTK files, both as input and output of elastix/transformix? |
|
@N-Dekker this would be super useful and solve our problems. If you detect binary vtk during reading and automatically write binary back (32 bit floating), this would fully solve our problem and help a lot. |
|
@mstaring @stefanklein I would like to merge this pull request, which is triggered by a request from Christoph Kirst! I think it's very straightforward and intuitive: when the input VTK file is a binary file, let the output VTK file also be a binary file. And likewise: when the input is 32-bit, let the output also be 32-bit. Hope it's OK to you! |
|
sounds good to me! |
When using transformix command-line option "-def" to transform the points of a VTK file, the output was always an ASCII file, having double-precision (64-bit) floating point numbers.
With this pull request, the format (ASCII or binary) and the floating point precision of the output file will correspond with the input file, instead.
When reviewing this pull request, it may be convenient to ignore whitespace changes: https://github.com/SuperElastix/elastix/pull/1253/files?w=1