From 68e46bc06ede526972d6d6010823b412ea9867df Mon Sep 17 00:00:00 2001 From: Johnny Chen Date: Mon, 11 Apr 2022 18:25:48 +0800 Subject: [PATCH] compat fix for Julia < v1.6 --- src/matlab.jl | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/matlab.jl b/src/matlab.jl index 9082f55..4da605e 100644 --- a/src/matlab.jl +++ b/src/matlab.jl @@ -159,6 +159,11 @@ im_to_matlab(::Type{T}, img::AbstractMatrix{<:RGB}) where T = im_to_matlab(::Type{T}, img::AbstractArray{<:RGB}) where T = throw(ArgumentError("For $(ndims(img)) dimensional color image, manual conversion to MATLAB layout is required.")) -# this method allows `data === im_to_matlab(im_from_matlab(data))` for gray image -im_to_matlab(::Type{T}, img::Base.ReinterpretArray{CT,N,T,<:AbstractArray{T,N}, true}) where {CT,N,T} = - img.parent +if VERSION >= v"1.6.0-DEV.1083" + # this method allows `data === im_to_matlab(im_from_matlab(data))` for gray image + im_to_matlab(::Type{T}, img::Base.ReinterpretArray{CT,N,T,<:AbstractArray{T,N}, true}) where {CT,N,T} = + img.parent +else + im_to_matlab(::Type{T}, img::Base.ReinterpretArray{CT,N,T,<:AbstractArray{T,N}}) where {CT,N,T} = + img.parent +end