diff --git a/docs/exampleweaver.jl b/docs/exampleweaver.jl index 437b6495..5cf50d2f 100644 --- a/docs/exampleweaver.jl +++ b/docs/exampleweaver.jl @@ -118,7 +118,7 @@ function weave_notebook(scriptname; overwrite=false, execute=true) if execute sleep(1) @info "executing and overwrite notebook \"$(name*".ipynb")\"" - run(`jupyter-nbconvert --ExecutePreprocessor.timeout=-1 --to notebook --execute $(abspath(jppath)) --output $(name * ".ipynb")`) + run(`jupyter nbconvert --ExecutePreprocessor.timeout=-1 --to notebook --execute $(abspath(jppath)) --output $(name * ".ipynb")`) end # cleanup temporary files rm(processed_scriptpath) diff --git a/src/utils.jl b/src/utils.jl index eb5d83e1..e34eef60 100644 --- a/src/utils.jl +++ b/src/utils.jl @@ -177,41 +177,7 @@ function _2dborder!(A::AbstractArray{T,3}, val::T) where T A end -import ImageTransformations: restrict_indices +#import ImageTransformations: restrict_indices -restrict_indices(r::Base.IdentityUnitRange) = - restrict_indices(r.indices) - -# from latest OffsetArrays master -# see https://discourse.julialang.org/t/lift-and-wrap-array-with-custom-indexes/19436/11 -# https://github.com/JuliaArrays/OffsetArrays.jl/pull/66 -# Remove this when new release tagged -""" - no_offset_view(A) -Return an `AbstractArray` that shares structure and has the same type and size as the -argument, but has 1-based indexing. May just return the argument when applicable. Not -exported. -The default implementation uses `OffsetArrays`, but other types should use something more -specific to remove a level of indirection when applicable. -```jldoctest -julia> O = OffsetArray(A, 0:1, -1:1) -OffsetArray(::Array{Int64,2}, 0:1, -1:1) with eltype Int64 with indices 0:1×-1:1: - 1 3 5 - 2 4 6 -julia> OffsetArrays.no_offset_view(O)[1,1] = -9 --9 -julia> A -2×3 Array{Int64,2}: - -9 3 5 - 2 4 6 -``` -""" -function no_offset_view(A::AbstractArray) - if Base.has_offset_axes(A) - OffsetArray(A, map(r->1-first(r), axes(A))) - else - A - end -end - -no_offset_view(A::OffsetArray) = no_offset_view(parent(A)) +# ImageTransformations.restrict_indices(r::Base.IdentityUnitRange) = +# restrict_indices(r.indices) diff --git a/test/operations/tst_channels.jl b/test/operations/tst_channels.jl index 914daf75..3f880c5f 100644 --- a/test/operations/tst_channels.jl +++ b/test/operations/tst_channels.jl @@ -60,8 +60,7 @@ (view(rect, IdentityRange(1:2), IdentityRange(1:3)), f1), (rgb_rect, f2), (Augmentor.prepareaffine(rgb_rect), f2), - #(OffsetArrays.no_offset_view(OffsetArray(rgb_rect, -2, -1)), f2), - (Augmentor.no_offset_view(OffsetArray(rgb_rect, -2, -1)), f2), + (OffsetArrays.no_offset_view(OffsetArray(rgb_rect, -2, -1)), f2), (view(rgb_rect, IdentityRange(1:2), IdentityRange(1:3)), f2), ] @testset "single image" begin diff --git a/test/operations/tst_distortions.jl b/test/operations/tst_distortions.jl index 70f76662..5d2a0660 100644 --- a/test/operations/tst_distortions.jl +++ b/test/operations/tst_distortions.jl @@ -87,8 +87,7 @@ imgs = [ (rect), (Augmentor.prepareaffine(rect)), - #(OffsetArrays.no_offset_view(OffsetArray(rect, -2, -1))), - (Augmentor.no_offset_view(OffsetArray(rect, -2, -1))), + (OffsetArrays.no_offset_view(OffsetArray(rect, -2, -1))), (view(rect, IdentityRange(1:2), IdentityRange(1:3))), ] @testset "eager" begin diff --git a/test/tst_augment.jl b/test/tst_augment.jl index 0717089d..b8333040 100644 --- a/test/tst_augment.jl +++ b/test/tst_augment.jl @@ -374,7 +374,7 @@ ops = (Rotate(45), CropSize(200,200), Zoom(1.1), ConvertEltype(RGB{Float64}), # however: @test size(collect(wv1)) === size(img) # so (not sure if this is desired behaviour): - @test collect(wv1) ≈ Augmentor.no_offset_view(img) + @test collect(wv1) ≈ OffsetArrays.no_offset_view(img) @test_reference "reference/rot45_crop_zoom_convert.txt" wv2 end diff --git a/test/tst_distortedview.jl b/test/tst_distortedview.jl index 1bcc5e7d..78ed5741 100644 --- a/test/tst_distortedview.jl +++ b/test/tst_distortedview.jl @@ -120,7 +120,7 @@ end @test summary(dv) == "512×512 Augmentor.DistortedView(::Array{Gray{N0f8},2}, ::Array{Float64,3} as 3×3 vector field) with eltype Gray{Normed{UInt8,8}}" @test_reference "reference/distort_static.txt" dv - camerao = Augmentor.no_offset_view(OffsetArray(camera, (-5,-10))) + camerao = OffsetArrays.no_offset_view(OffsetArray(camera, (-5,-10))) dv2 = @inferred Augmentor.DistortedView(camerao, A) @test size(dv2) == size(camera) @test eltype(dv2) == eltype(camera) diff --git a/test/tst_utils.jl b/test/tst_utils.jl index 1b115211..999f7195 100644 --- a/test/tst_utils.jl +++ b/test/tst_utils.jl @@ -55,7 +55,7 @@ end let p = permuteddimsview(Ao, (2,1)) pc = @inferred(Augmentor.maybe_copy(p)) #@test pc == Ao' - @test pc == Augmentor.no_offset_view(Ao') + @test pc == OffsetArrays.no_offset_view(Ao') @test typeof(pc) <: Array end let p = view(permuteddimsview(A, (2,1)), IdentityRange(2:3), IdentityRange(1:2))