From 1375df55998031834ac0e0b11bd2096351bff2b3 Mon Sep 17 00:00:00 2001 From: Victor Saase Date: Wed, 11 Sep 2019 14:17:42 +0200 Subject: [PATCH] Fix for issue #31, bug when writing Integer niftis #31 --- src/NIfTI.jl | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/NIfTI.jl b/src/NIfTI.jl index d7bd655..5252711 100644 --- a/src/NIfTI.jl +++ b/src/NIfTI.jl @@ -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