Skip to content

Commit

Permalink
Fix #3
Browse files Browse the repository at this point in the history
  • Loading branch information
simonster committed Oct 8, 2014
1 parent f91b310 commit ef10a0f
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 17 deletions.
30 changes: 15 additions & 15 deletions src/NIfTI.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down

0 comments on commit ef10a0f

Please sign in to comment.