Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Transform VTK files in accordance with their format and floating point precision #1253

Merged
merged 2 commits into from
Oct 23, 2024

Conversation

N-Dekker
Copy link
Member

@N-Dekker N-Dekker commented Oct 16, 2024

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

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.
@N-Dekker
Copy link
Member Author

@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?

@ChristophKirst
Copy link

@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.

@N-Dekker
Copy link
Member Author

@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!

@mstaring
Copy link
Member

sounds good to me!

@N-Dekker N-Dekker merged commit 78f9051 into main Oct 23, 2024
8 checks passed
@N-Dekker N-Dekker deleted the Write-VTK-binary branch October 23, 2024 09:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants