Skip to content

Commit 81b265a

Browse files
author
Dae Woo Kim
committed
FemtoCleaner upto julia 0.7
1 parent 799321d commit 81b265a

File tree

3 files changed

+16
-19
lines changed

3 files changed

+16
-19
lines changed

src/RegisterDriver.jl

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
__precompile__()
2-
31
module RegisterDriver
42

53
using Images, JLD, HDF5, StaticArrays, Formatting
@@ -183,11 +181,11 @@ function initialize_jld!(dsets, file, mon, fs, n)
183181
have_unpackable
184182
end
185183

186-
function nicehdf5{T<:StaticArray}(v::Union{Array{T},SharedArray{T}})
184+
function nicehdf5(v::Union{Array{T},SharedArray{T}}) where T<:StaticArray
187185
nicehdf5(reinterpret(eltype(T), sdata(v), (size(eltype(v))..., size(v)...)))
188186
end
189187

190-
function nicehdf5{T<:NumDenom}(v::Union{Array{T},SharedArray{T}})
188+
function nicehdf5(v::Union{Array{T},SharedArray{T}}) where T<:NumDenom
191189
nicehdf5(reinterpret(eltype(T), sdata(v), (2, size(v)...)))
192190
end
193191

@@ -220,7 +218,7 @@ Gaussian filters of width `sigmalp` (for the low-pass) and `sigmahp`
220218
(for the high-pass). You can pass `sigmalp=zeros(n)` to skip low-pass
221219
filtering, and `sigmahp=fill(Inf, n)` to skip high-pass filtering.
222220
"""
223-
type PreprocessSNF # Shot-noise filtered
221+
mutable struct PreprocessSNF # Shot-noise filtered
224222
bias::Float32
225223
sigmalp::Vector{Float32}
226224
sigmahp::Vector{Float32}
@@ -229,7 +227,7 @@ end
229227

230228
function preprocess(pp::PreprocessSNF, A::AbstractArray)
231229
Af = sqrt_subtract_bias(A, pp.bias)
232-
imfilter(highpass(Af, pp.sigmahp), KernelFactors.IIRGaussian((pp.sigmalp...)), NA())
230+
imfilter(highpass(Af, pp.sigmahp), KernelFactors.IIRGaussian((pp.sigmalp...,)), NA())
233231
end
234232
(pp::PreprocessSNF)(A::AbstractArray) = preprocess(pp, A)
235233
(pp::PreprocessSNF)(A::ImageMeta) = shareproperties(A, pp(data(A)))

test/WorkerDummy.jl

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,9 @@ export Alg1, Alg2, Alg3
1010
# Dispatch on the algorithm used to perform registration
1111
# Each algorithm has a container it uses for storage and communication
1212
# with the driver process
13-
@compat abstract type Alg <: AbstractWorker end
13+
abstract type Alg <: AbstractWorker end
1414

15-
type Alg1{A<:AbstractArray} <: Alg
15+
mutable struct Alg1{A<:AbstractArray} <: Alg
1616
fixed::A
1717
λ::Float64
1818
workerpid::Int
@@ -21,17 +21,17 @@ function Alg1(fixed, λ; pid=1)
2121
Alg1(maybe_sharedarray(fixed, pid), λ, pid)
2222
end
2323

24-
type Alg2{A<:AbstractArray,V<:AbstractVector,M<:AbstractMatrix} <: Alg
24+
mutable struct Alg2{A<:AbstractArray,V<:AbstractVector,M<:AbstractMatrix} <: Alg
2525
fixed::A
2626
tform::V
2727
u0::M
2828
workerpid::Int
2929
end
30-
function Alg2{T}(fixed, ::Type{T}, sz; pid=1)
30+
function Alg2(fixed, ::Type{T}, sz; pid=1) where T
3131
Alg2(maybe_sharedarray(fixed, pid), maybe_sharedarray(T, (12,), pid), maybe_sharedarray(T, sz, pid), pid)
3232
end
3333

34-
type Alg3 <: Alg
34+
mutable struct Alg3 <: Alg
3535
string::String
3636
workerpid::Int
3737
end
@@ -47,7 +47,7 @@ end
4747

4848
function worker(algorithm::Alg2, moving, tindex, mon)
4949
# Do stuff to set tform
50-
tform = linspace(1,12,12)+tindex
50+
tform = range(1, stop=12, length=12)+tindex
5151
monitor!(mon, :tform, tform)
5252
# Do more computations...
5353
monitor!(mon, :u0, zeros(size(algorithm.u0))-tindex)

test/runtests.jl

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,21 @@
11
driverprocs = addprocs(2)
22

33
# Work around julia #3674
4-
using Images, JLD, Base.Test
4+
using Images, JLD, Test
55
using BlockRegistration, BlockRegistrationScheduler
66
using RegisterDriver, RegisterWorkerShell
77
@sync for p in driverprocs
88
@spawnat p eval(quote
9-
using Images, JLD, Base.Test
9+
using Images, JLD, Test
1010
using BlockRegistrationScheduler, RegisterDriver, RegisterWorkerShell
1111
end)
1212
end
1313

14-
push!(LOAD_PATH, splitdir(@__FILE__)[1])
15-
using WorkerDummy
14+
include("WorkerDummy.jl")
15+
using .WorkerDummy
1616
for p in driverprocs
17-
remotecall_fetch(eval, p, :(using WorkerDummy)) # workaround #3674 if this is re-run
17+
remotecall_fetch(eval, p, :(include("WorkerDummy.jl"); using .WorkerDummy)) # workaround #3674 if this is re-run
1818
end
19-
pop!(LOAD_PATH)
2019

2120
workdir = tempname()
2221
mkdir(workdir)
@@ -40,7 +39,7 @@ fn = joinpath(workdir, "file2.jld")
4039
driver(fn, alg, img, mon)
4140
tform = JLD.load(fn, "tform")
4241
u0 = JLD.load(fn, "u0")
43-
@test tform[:,4] == collect(linspace(1,12,12)+4)
42+
@test tform[:,4] == collect(range(1, stop=12, length=12)+4)
4443
@test u0[:,:,2] == fill(-2,(3,3))
4544
rm(fn)
4645

0 commit comments

Comments
 (0)