Skip to content

Commit

Permalink
Merge pull request #66 from JuliaImages/teh/depwarn
Browse files Browse the repository at this point in the history
Fix some `data`->`arraydata` depwarns
  • Loading branch information
timholy authored Apr 15, 2020
2 parents b0fa6eb + 310dd38 commit 38ef966
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 10 deletions.
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name = "ImageMetadata"
uuid = "bc367c6b-8a6b-528e-b4bd-a4b897500b49"
version = "0.9.0"
version = "0.9.1"

[deps]
AxisArrays = "39de3d68-74b9-583c-8d2d-e117c070f3a9"
Expand Down
2 changes: 1 addition & 1 deletion src/ImageMetadata.jl
Original file line number Diff line number Diff line change
Expand Up @@ -266,7 +266,7 @@ AxisArrays.axisvalues(img::ImageMetaAxis) = axisvalues(arraydata(img))
Extract the properties dictionary `props` for `imgmeta`. `props`
shares storage with `img`, so changes to one affect the other.
See also: [`data`](@ref).
See also: [`arraydata`](@ref).
"""
properties(img::ImageMeta) = getfield(img, :properties)

Expand Down
16 changes: 8 additions & 8 deletions src/operators.jl
Original file line number Diff line number Diff line change
Expand Up @@ -27,29 +27,29 @@ _imagemeta(out) = out
@inline _imagemeta(out, A, As...) = _imagemeta(out, As...)


(-)(img::ImageMeta) = shareproperties(img, -data(img))
(-)(img::ImageMeta) = shareproperties(img, -arraydata(img))

batch2 = (:+, :-)

for op in batch2
@eval begin
($op)(img::ImageMeta, B::BitArray) = shareproperties(img, ($op)(data(img), B))
($op)(B::BitArray, img::ImageMeta) = shareproperties(img, ($op)(B, data(img)))
($op)(img::ImageMeta, B::BitArray) = shareproperties(img, ($op)(arraydata(img), B))
($op)(B::BitArray, img::ImageMeta) = shareproperties(img, ($op)(B, arraydata(img)))
($op)(img::ImageMeta, B::ImageMeta) = ambigop(Symbol($op))
($op)(img::ImageMeta, B::AbstractArray) = shareproperties(img, ($op)(data(img), B))
($op)(B::AbstractArray, img::ImageMeta) = shareproperties(img, ($op)(B, data(img)))
($op)(img::ImageMeta, B::AbstractArray) = shareproperties(img, ($op)(arraydata(img), B))
($op)(B::AbstractArray, img::ImageMeta) = shareproperties(img, ($op)(B, arraydata(img)))
end

for CV in (:AbstractGray, :TransparentGray, :AbstractRGB, :TransparentRGB)
@eval begin
($op)(img::ImageMeta{CV}, n::$CV) where {CV<:$CV} =
shareproperties(img, ($op)(data(img), n))
shareproperties(img, ($op)(arraydata(img), n))
($op)(n::$CV, img::ImageMeta{CV}) where {CV<:$CV} =
shareproperties(img, ($op)(n, data(img)))
shareproperties(img, ($op)(n, arraydata(img)))
end
end
end

(/)(img::ImageMeta, n::Number) = shareproperties(img, data(img)/n)
(/)(img::ImageMeta, n::Number) = shareproperties(img, arraydata(img)/n)

ambigop(s::Symbol) = error("$s with two ImageMeta arrays: dictionary choice is ambiguous")
12 changes: 12 additions & 0 deletions test/Project.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
[deps]
AxisArrays = "39de3d68-74b9-583c-8d2d-e117c070f3a9"
ColorVectorSpace = "c3611d14-8923-5661-9e6a-0046d554d3a4"
Dates = "ade2ca70-3891-5945-98fb-dc099432e06a"
ImageAxes = "2803e5a7-5153-5ecf-9a86-9b4c37f5f5ac"
ImageCore = "a09fc81d-aa75-5fe9-8630-4744c3626534"
IndirectArrays = "9b13fd28-a010-5f03-acff-a1bbcff69959"
OffsetArrays = "6fe1bfb0-de20-5000-8ca7-80f57d26f881"
SimpleTraits = "699a6c99-e7fa-54fc-8d76-47d257e15c1d"
Statistics = "10745b16-79ce-11e8-11f9-7d13ad32a3b2"
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"
Unitful = "1986cc42-f94f-5a68-af5c-568840ba703d"

2 comments on commit 38ef966

@timholy
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@JuliaRegistrator
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Registration pull request created: JuliaRegistries/General/13016

After the above pull request is merged, it is recommended that a tag is created on this repository for the registered package version.

This will be done automatically if the Julia TagBot GitHub Action is installed, or can be done manually through the github interface, or via:

git tag -a v0.9.1 -m "<description of version>" 38ef9662d1c0ee1b6a84f1e05755352fe35aa4ec
git push origin v0.9.1

Please sign in to comment.