Skip to content

Commit

Permalink
Merge pull request #10 from timholy/teh/0.6
Browse files Browse the repository at this point in the history
Updates for Julia 0.6
  • Loading branch information
timholy authored May 30, 2017
2 parents dc4f5d7 + 6b0beee commit db2ca07
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 15 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ os:
- linux
- osx
julia:
- 0.5
- 0.6
- nightly
notifications:
email: false
Expand Down
3 changes: 1 addition & 2 deletions REQUIRE
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
julia 0.5
julia 0.6.0-pre
AxisArrays
ImageMetadata 0.1.1
FixedPointNumbers 0.3.0
FileIO
Unitful
Ranges
10 changes: 5 additions & 5 deletions appveyor.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
environment:
matrix:
- JULIAVERSION: "julialang/bin/winnt/x86/0.3/julia-0.3-latest-win32.exe"
- JULIAVERSION: "julialang/bin/winnt/x64/0.3/julia-0.3-latest-win64.exe"
- JULIAVERSION: "julianightlies/bin/winnt/x86/julia-latest-win32.exe"
- JULIAVERSION: "julianightlies/bin/winnt/x64/julia-latest-win64.exe"
- JULIA_URL: "https://julialang-s3.julialang.org/bin/winnt/x86/0.6/julia-0.6-latest-win32.exe"
- JULIA_URL: "https://julialang-s3.julialang.org/bin/winnt/x64/0.6/julia-0.6-latest-win64.exe"
- JULIA_URL: "https://julialangnightlies-s3.julialang.org/bin/winnt/x86/julia-latest-win32.exe"
- JULIA_URL: "https://julialangnightlies-s3.julialang.org/bin/winnt/x64/julia-latest-win64.exe"

branches:
only:
Expand All @@ -19,7 +19,7 @@ notifications:
install:
# Download most recent Julia Windows binary
- ps: (new-object net.webclient).DownloadFile(
$("http://s3.amazonaws.com/"+$env:JULIAVERSION),
$env:JULIA_URL,
"C:\projects\julia-binary.exe")
# Run installer silently, output to C:\projects\julia
- C:\projects\julia-binary.exe /S /D=C:\projects\julia
Expand Down
11 changes: 5 additions & 6 deletions src/ImagineFormat.jl
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ __precompile__()
module ImagineFormat

using AxisArrays, ImageMetadata, FileIO, Unitful, FixedPointNumbers
using Ranges # TODO: eliminate with julia 0.6

export imagine2nrrd

Expand Down Expand Up @@ -40,7 +39,7 @@ function load(io::Stream{format"Imagine"}; mode="r")
# Check that the file size is consistent with the expected size
if !isfile(camfilename)
warn("Cannot open ", camfilename)
data = Array(T, sz[1], sz[2], sz[3], 0)
data = Array{T}(sz[1], sz[2], sz[3], 0)
else
fsz = filesize(camfilename)
n_stacks = sz[end]
Expand All @@ -56,7 +55,7 @@ function load(io::Stream{format"Imagine"}; mode="r")
println("Truncating to ", n_stacks, length(sz) == 4 ? " stacks" : " frames")
sz[end] = n_stacks
end
data = SharedArray(camfilename, T, tuple(sz...), mode=mode)
data = SharedArray{T}(camfilename, tuple(sz...), mode=mode)
end
um_per_pixel = h["um per pixel"]*μm
pstart = h["piezo"]["stop position"]
Expand All @@ -72,11 +71,11 @@ function load(io::Stream{format"Imagine"}; mode="r")
pixelspacing = (pixelspacing..., h["idle time between stacks"]+h["frames per stack"]*h["exposure time"])
end
# ImageMeta(AxisArray(data, axisnames, pixelspacing), imagineheader=h, suppress=Set(Any["imagineheader"])) # TODO: switch to this with julia 0.6.0
axs = map((n,s,l)->Axis{n}(Ranges.linspace(0*s, (l-1)*s, l)), axisnames, pixelspacing, size(data))
axs = map((n,s,l)->Axis{n}(linspace(0*s, (l-1)*s, l)), axisnames, pixelspacing, size(data))
ImageMeta(AxisArray(data, axs), imagineheader=h, suppress=Set(Any["imagineheader"]))
end

abstract Endian
abstract type Endian end
type LittleEndian <: Endian; end
type BigEndian <: Endian; end
const endian_dict = Dict("l"=>LittleEndian, "b"=>BigEndian)
Expand All @@ -85,7 +84,7 @@ parse_endian(s::AbstractString) = endian_dict[lowercase(s)]

function parse_vector_int(s::AbstractString)
ss = split(s, r"[ ,;]", keep=false)
v = Array(Int, length(ss))
v = Vector{Int}(length(ss))
for i = 1:length(ss)
v[i] = parse(Int,ss[i])
end
Expand Down
2 changes: 1 addition & 1 deletion test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ rm(cfn)
using ImagineFormat
io = IOBuffer()
imagine2nrrd(io, img["imagineheader"])
str = takebuf_string(io)
str = String(take!(io))
@test str == "NRRD0001\ntype: uint16\ndimension: 4\nsizes: 5 7 3 4\nkinds: space space space time\nencoding: raw\nendian: little\n"

# Optional fields
Expand Down

0 comments on commit db2ca07

Please sign in to comment.