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

Allow writing a NRRD record to memory. Ref #108 #117

Merged
merged 2 commits into from
Jun 17, 2022

Conversation

bernardopericacho
Copy link
Contributor

Proposed changes:

  • write now supports as a parameter either a filename or a io.BytesIO object.
  • refactor write method into:
    • _write_default_header_entries to write the default header entries generated by this package
    • _handle_header_fields to determine the headers based on the specified headers, data and index order
    • _write_header that used the logic from _write_default_header_entries and _handle_header_fields to write the headers
    • write used the methods above to encapsulate and reuse better the code
    • added new tests to check the functionality. Coverage still 100% after these changes

@addisonElliott addisonElliott self-assigned this Jun 14, 2022
nrrd/writer.py Outdated Show resolved Hide resolved
nrrd/writer.py Outdated Show resolved Hide resolved
nrrd/writer.py Show resolved Hide resolved
nrrd/writer.py Outdated Show resolved Hide resolved
nrrd/writer.py Outdated Show resolved Hide resolved
nrrd/writer.py Show resolved Hide resolved
@addisonElliott
Copy link
Collaborator

One more thing. Can you add examples for reading and writing to memory? That's probably useful to demonstrate.

@bernardopericacho
Copy link
Contributor Author

Thanks for the review and the feedback on this. I will apply the suggestions as soon as I can.

@bernardopericacho
Copy link
Contributor Author

I think I addressed all the feedback if you can have another look. Thanks in advance!

@addisonElliott addisonElliott merged commit a8667a5 into mhe:master Jun 17, 2022
@bernardopericacho bernardopericacho deleted the feat/write_to_memory branch June 17, 2022 04:51
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.

2 participants