Skip to content

Conversation

@jdtournier
Copy link
Member

replaces #2488, this time merging to master with VTK output still defaulting to ASCII.

@blezek, could do with a second pair of eyes to double-check none of my changes break anything...

blezek added 6 commits June 24, 2022 15:17
New default is to write binary VTK files, the testing needed to
be changed to reflect this.
…ck with original

New tests are:
1. convert tck -> vtk -> txt and compare to tck -> txt
2. convert tck -> vtk -> txt and compare to tck -> vtk -> tck -> txt
@jdtournier jdtournier added this to the 3.0.4 milestone Jun 24, 2022
@jdtournier jdtournier requested a review from a team June 24, 2022 16:55
@jdtournier jdtournier self-assigned this Jun 24, 2022
@jdtournier jdtournier force-pushed the tckconvert_write_binary_vtk branch from e5d74a4 to de51453 Compare June 24, 2022 16:57
@blezek
Copy link
Contributor

blezek commented Jun 27, 2022

@jdtournier LGTM. Preserving backwards compatibility by using ascii as the default makes sense.

tckconvert tracks.tck tmp.vtk -binary -force -quiet && tckconvert tmp.vtk tmp-vtk-streamlines-[].txt -force && cat tmp-vtk-streamlines-*.txt > tmp-vtk-all.txt && tckconvert tracks.tck tmp-mrtrix-streamlines-[].txt -force -quiet && cat tmp-mrtrix-streamlines-*.txt > tmp-mrtrix-all.txt && testing_diff_matrix tmp-vtk-all.txt tmp-mrtrix-all.txt

# convert tck -> vtk -> txt and compare to tck -> vtk -> tck -> txt
tckconvert tracks.tck tmp.vtk -binary -force -quiet && tckconvert tmp.vtk tmp-roundtrip.tck -force && tckconvert tmp-roundtrip.tck tmp-roundtrip-streamlines-[].txt -force && cat tmp-roundtrip-streamlines-*.txt > tmp-roundtrip-all.txt && tckconvert tracks.tck tmp-mrtrix-streamlines-[].txt -force -quiet && cat tmp-mrtrix-streamlines-*.txt > tmp-mrtrix-all.txt && testing_diff_matrix tmp-roundtrip-all.txt tmp-mrtrix-all.txt
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One lesson I've learned the hard way elsewhere is that if your own software is non-compliant, but the reader and writer functionalities have matching non-compliance, then round-trip tests do you no good.

If we could add an exemplar binary file into the test_data repository that demonstrably works in some other software, then we could ensure that that at least gets read correctly. Writing back to binary and then doing a binary diff might work for testing the write.

I don't think it's super critical here given that we presume you've implemented the writer for a purpose and it's being successfully read by something else, and also that the code is relatively independent of everything else. But as with another comment, for #411 we'd need to be more exhaustive.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Indeed. I'll add the outputs produced by the conversion to the test data repo and test against that. It'll catch regressions, and if @blezek can double-check that these work correctly in other packages, we should be good.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK, done. @blezek, any chance you could sanity check the binary VTK test data before we merge?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't have anything with which to visualise polylines.

Copy link
Member

@Lestropie Lestropie left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Even if the binary VTK data in the test data repo hasn't been tested, I'll trust @blezek's prior work here. Happy to merge for 3.0.4 as-is.

@blezek
Copy link
Contributor

blezek commented Nov 2, 2022

Even if the binary VTK data in the test data repo hasn't been tested, I'll trust @blezek's prior work here. Happy to merge for 3.0.4 as-is.

@jdtournier @Lestropie sorry, this PR got away from me. I verified the binary VTK file loads correctly in ParaView, so we are good to go!

@jdtournier jdtournier merged commit 6d12ff0 into master Nov 2, 2022
@jdtournier jdtournier deleted the tckconvert_write_binary_vtk branch November 2, 2022 14:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants