Skip to content

Commit

Permalink
Fix for issue JuliaNeuroscience#31, bug when writing Integer niftis
Browse files Browse the repository at this point in the history
  • Loading branch information
vsaase authored Sep 11, 2019
1 parent a9e50b9 commit 1375df5
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/NIfTI.jl
Original file line number Diff line number Diff line change
Expand Up @@ -373,11 +373,12 @@ end
esize(ex::NIfTI1Extension) = 8 + ceil(Int, length(ex.edata)/16)*16

# Validates the header of a volume and updates it to match the volume's contents
function niupdate(vol::NIVolume{T}) where {T}
function niupdate(vol::NIVolume)
vol.header.sizeof_hdr = SIZEOF_HDR
vol.header.dim = nidim(vol.raw)
vol.header.datatype = nidatatype(T)
vol.header.bitpix = nibitpix(T)
t = eltype(vol.raw)
vol.header.datatype = nidatatype(t)
vol.header.bitpix = nibitpix(t)
vol.header.vox_offset = isempty(vol.extensions) ? Int32(352) :
Int32(mapreduce(esize, +, vol.extensions) + SIZEOF_HDR)
vol
Expand Down

0 comments on commit 1375df5

Please sign in to comment.