-
Notifications
You must be signed in to change notification settings - Fork 51
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
byteskip -1 fails #70
Comments
NRRD documentation states the following about byte skip (reference):
Therefore, line 383 shouldn't be edited because that only occurs for compressed data. Rather, line 353 is more appropriate. The pseudocode should be something like:
With this in mind, maybe it would be a good idea to check if byte_skip is negative for anything besides raw encoded data and throw an error. Furthermore, even throw an error if the byte skip is negative and not equal to -1, which is undefined. Can even apply this to line skip which can only be >= 0. This is a good catch, I never noticed this about the NRRD documentation. Pull requests are welcome! (Not sure when I would have time to create a PR on this). |
I'll try to work on this PR this week. Just a heads up, even if data is gzip encoded, it was correctly loaded by Slicer (may be itk/vtk takes care of it) when byteskip is set to -1. |
Oh okay, wasn't aware of this, then I think we should add support for byteskip = -1 for raw and compressed data. Maybe even do this for ASCII as well? Slicer uses VTK/ITK to load NRRD's I believe which uses Teem's implementation of NRRD format. Maybe they support byteskip = -1 for compressed data then? |
@addisonElliott , I have been working on this for a while. It looks like you have put a comment before To avoid seeking from end, we have to set
and recondition Ln 389. |
I probably wouldn't revert the changes of decompressing chunk by chunk because this was likely an issue in the past someone had for large NRRD files. With that in mind, does Slicer/VTK apply the byteskip for compressed data before or after decompressing? I thought it was applied after decompression in which case the chunk size is irrelevant, you just change the index into decompressed data. In other words, why aren't you doing something like:
|
Sorry, if it was not clear, I exactly meant that.
It works and I'll submit a PR soon. |
@addisonElliott , once I am done, shall I run
Before submitting a PR? |
Preferably, yes. It saves effort that Travis CI has to do and I don't get spammed with messages. I say this from experience where I did 15 more pushes to try and fix my tests... |
1. Fixed byte_skip -1 reading to work on compressed data (issue #70) 2. Add error checking for line_skip and byte_skip < -1 3. Added tests for error checking and byte_skip functionality
When I set
byteskip: -1
in the header, the data file should load from the end. Instead, I see the following error message.May be we need to add a condition to check if byteskip is -1, and then rewrite line 383.
@ihnorton , UKFTractography ran well, generated
.vtk
file fine. We just need to make this fix to run otherPynrrd
dependent CLIs.@addisonElliott , any idea/commit would be appreciated.
The text was updated successfully, but these errors were encountered: