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

MRIFiles: Fixing save of ISMRMRDFile's in Julia 1.11 and 1.12 #197

Merged
merged 2 commits into from
Jul 17, 2024

Conversation

cncastillo
Copy link
Contributor

@cncastillo cncastillo commented Jul 10, 2024

The write(IO, ...) function used in writeProfiles now uses the new Memory type that behaves a little differently. From Julia 1.11 changelogs:

New Memory type that provides a lower-level container as an alternative to Array. Memory has less overhead and a faster constructor, making it a good choice for situations that do not need all the features of Array (e.g. multiple dimensions). Most of the Array type is now implemented in Julia on top of Memory, leading to significant speedups for several functions (e.g. push!) as well as more maintainable code (#51319).

The fallback method write(::IO, ::AbstractArray) used to recursively call write on each element, but now writes the in-memory representation of each value. For example, write(io, 'a':'b') now writes 4 bytes for each character, instead of writing the UTF-8 representation of each character. The new format is compatible with that used by Array, making it possible to use read! to get the data back (#42593).

In this PR, I added a sizehint argument to the IOBuffer (that was also available pre-Julia 1.11), as without it, the write function was adding extra bytes of random information when the added data surpassed the current Memory capacity in iobuf.data.

Fixes #194

@cncastillo cncastillo changed the title MRIFiles: Fixing save of ISMRMRDFile in Julia 1.11 and 1.12 MRIFiles: Fixing save of ISMRMRDFile's in Julia 1.11 and 1.12 Jul 10, 2024
@cncastillo
Copy link
Contributor Author

Hi @tknopp, sorry to tag you but I couldn't choose any reviewers. I believe this one to be a small but necessary patch.

No other changes have been made to MRIFiles since v0.3.1 (dee7b36).

The CI problems seem to be unrelated to this PR

  MethodError: no method matching proxTV!(::Vector{ComplexF32}, ::Float64, ::Tuple{Int64, Int64}, ::UnitRange{Int64}; iterationsTV::Int64)

Cheers!

@tknopp
Copy link
Member

tknopp commented Jul 17, 2024

Thanks!

@tknopp tknopp merged commit 2c2fded into MagneticResonanceImaging:master Jul 17, 2024
1 of 5 checks passed
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.

MRIFiles: save(ISMRMRDFile(rawfile), raw) broken in Julia 1.11 and 1.12
2 participants