From 30426fccf04549427627e8d7d71dd685e3b8d911 Mon Sep 17 00:00:00 2001 From: hzarei4 Date: Thu, 29 Feb 2024 17:05:54 +0100 Subject: [PATCH] Fixed a bug for `dst_center` parameter of `select_region_view function` --- src/selection_tools.jl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/selection_tools.jl b/src/selection_tools.jl index 0909ca8..f05e46e 100644 --- a/src/selection_tools.jl +++ b/src/selection_tools.jl @@ -157,7 +157,7 @@ julia> select_region_view(ones(3,3),new_size=(7,7),center=(1,3)) 0.0 0.0 0.0 0.0 0.0 0.0 0.0 ``` """ -function select_region_view(src::Array{T,N}; new_size=size(src), center=ft_center_diff(size(src)).+1, dst_center=ft_center_diff(new_size).+1, pad_value=zero(eltype(src))) where {T,N} +function select_region_view(src::Array{T,N}; new_size=size(src), center=ft_center_diff(size(src)).+1, dst_center=ft_center_diff(Tuple(expand_size(new_size, size(src)))).+1, pad_value=zero(eltype(src))) where {T,N} new_size = Tuple(expand_size(new_size, size(src))) center = Tuple(expand_size(center, ft_center_diff(size(src)).+1)) MutablePaddedView(PaddedView(pad_value, src,new_size, dst_center .- center.+1)) :: MutablePaddedView{T, N, NTuple{N,Base.OneTo{Int64}}, OffsetArrays.OffsetArray{T, N, Array{T, N}}}