diff --git a/src/NIfTI.jl b/src/NIfTI.jl index d63a0c3..d7c4510 100644 --- a/src/NIfTI.jl +++ b/src/NIfTI.jl @@ -81,21 +81,21 @@ NIVolume{T<:Number,N}(header::NIfTI1Header, raw::Array{T,N}) = const SIZEOF_HDR = int32(348) -const NIfTI_DT_BITSTYPES = (Int16=>Type)[ - int16(2) => Uint8, - int16(4) => Int16, - int16(8) => Int32, - int16(16) => Float32, - int16(32) => Complex64, - int16(64) => Float64, - int16(256) => Int8, - int16(512) => Uint16, - int16(768) => Uint32, - int16(1024) => Int64, - int16(1280) => Uint64, - int16(1792) => Complex128 -] -const NIfTI_DT_BITSTYPES_REVERSE = (Type=>Int16)[] +const NIfTI_DT_BITSTYPES = Dict{Int16,Type}([ + (int16(2), Uint8), + (int16(4), Int16), + (int16(8), Int32), + (int16(16), Float32), + (int16(32), Complex64), + (int16(64), Float64), + (int16(256), Int8), + (int16(512), Uint16), + (int16(768), Uint32), + (int16(1024), Int64), + (int16(1280), Uint64), + (int16(1792), Complex128) +]) +const NIfTI_DT_BITSTYPES_REVERSE = Dict{Type,Int16}() for (k, v) in NIfTI_DT_BITSTYPES NIfTI_DT_BITSTYPES_REVERSE[v] = k end diff --git a/test/runtests.jl b/test/runtests.jl index 0a54ff3..1427608 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -36,8 +36,8 @@ for (fname, mmap) in ((NII, false), (NII, true), (HDR, false), (HDR, true), @test vox(file, 69, 56, 13, :)[:] == [502, 521] end -@test_throws niread(GZIPPED_NII; mmap=true) -@test_throws niread(GZIPPED_HDR; mmap=true) +@test_throws ErrorException niread(GZIPPED_NII; mmap=true) +@test_throws ErrorException niread(GZIPPED_HDR; mmap=true) # Test writing const TEMP_FILE = "$(tempname()).nii"