diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 0000000..5ace460 --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,6 @@ +version: 2 +updates: + - package-ecosystem: "github-actions" + directory: "/" + schedule: + interval: "weekly" diff --git a/.github/workflows/CompatHelper.yml b/.github/workflows/CompatHelper.yml index b57619a..cab0acd 100644 --- a/.github/workflows/CompatHelper.yml +++ b/.github/workflows/CompatHelper.yml @@ -5,6 +5,10 @@ on: - cron: '00 00 * * *' workflow_dispatch: +permissions: + contents: write + pull-requests: write + jobs: CompatHelper: runs-on: ${{ matrix.os }} diff --git a/.github/workflows/UnitTest.yml b/.github/workflows/UnitTest.yml index d4ab095..ff9c285 100644 --- a/.github/workflows/UnitTest.yml +++ b/.github/workflows/UnitTest.yml @@ -27,28 +27,18 @@ jobs: steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 - name: "Set up Julia" - uses: julia-actions/setup-julia@v1 + uses: julia-actions/setup-julia@v2 with: version: ${{ matrix.julia-version }} arch: ${{ matrix.arch }} - - - name: Cache artifacts - uses: actions/cache@v1 - env: - cache-name: cache-artifacts - with: - path: ~/.julia/artifacts - key: ${{ runner.os }}-test-${{ env.cache-name }}-${{ hashFiles('**/Project.toml') }} - restore-keys: | - ${{ runner.os }}-test-${{ env.cache-name }}- - ${{ runner.os }}-test- - ${{ runner.os }}- + - uses: julia-actions/cache@v2 + - uses: julia-actions/julia-buildpkg@v1 - name: "Unit Test" - uses: julia-actions/julia-runtest@master + uses: julia-actions/julia-runtest@v1 - uses: julia-actions/julia-processcoverage@v1 - - uses: codecov/codecov-action@v1 + - uses: codecov/codecov-action@v5 with: file: lcov.info diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml index cb34c7b..bab16d8 100644 --- a/.github/workflows/docs.yml +++ b/.github/workflows/docs.yml @@ -18,21 +18,11 @@ jobs: julia-version: [1] os: [ubuntu-latest] steps: - - uses: actions/checkout@v2 - - uses: julia-actions/setup-julia@latest + - uses: actions/checkout@v4 + - uses: julia-actions/setup-julia@v2 with: version: ${{ matrix.julia-version }} - - name: Cache artifacts - uses: actions/cache@v1 - env: - cache-name: cache-artifacts - with: - path: ~/.julia/artifacts - key: ${{ runner.os }}-test-${{ env.cache-name }}-${{ hashFiles('**/Project.toml') }} - restore-keys: | - ${{ runner.os }}-test-${{ env.cache-name }}- - ${{ runner.os }}-test- - ${{ runner.os }}- + - uses: julia-actions/cache@v2 - name: Install dependencies run: julia --project=docs/ -e 'using Pkg; Pkg.develop(PackageSpec(path=pwd())); Pkg.instantiate()' - name: Build and deploy diff --git a/Project.toml b/Project.toml index 9acc090..c2f530e 100644 --- a/Project.toml +++ b/Project.toml @@ -17,7 +17,7 @@ AxisAlgorithms = "0.3, 1.0" CoordinateTransformations = "0.5, 0.6" ImageBase = "0.1.1" ImageCore = "0.9, 0.10" -Interpolations = "0.13.4, 0.14, 0.15" +Interpolations = "0.13.4, 0.14, 0.15, 0.16" OffsetArrays = "0.10, 0.11, 1.0.1" Rotations = "0.12, 0.13, 1.0" StaticArrays = "0.10, 0.11, 0.12, 1.0" diff --git a/src/ImageTransformations.jl b/src/ImageTransformations.jl index 5f34093..40d6350 100644 --- a/src/ImageTransformations.jl +++ b/src/ImageTransformations.jl @@ -14,7 +14,7 @@ There are in-place version of many of the functions, e.g., `imresize!` etc. Resize example: -```jldoctest +```julia using ImageTransformations, TestImages img = testimage("mandrill") @@ -25,7 +25,7 @@ img_medium = imresize(img_small, size(img_small).*2) Warping example: -```jldoctest +```julia using ImageTransformations, TestImages, CoordinateTransformations, Rotations img = testimage("camera"); diff --git a/src/autorange.jl b/src/autorange.jl index afbdf7e..2710592 100644 --- a/src/autorange.jl +++ b/src/autorange.jl @@ -9,11 +9,11 @@ preserves all information from `A` after applying `tform`. For transformation that preserves the array size, `autorange` is equivalent to `axes(A)`. ```jldoctest; setup=:(using ImageTransformations: autorange; using CoordinateTransformations, Rotations, ImageTransformations) -A = rand(5, 5) -tform = IdentityTransformation() -autorange(A, tform) == axes(A) +julia> A = rand(5, 5); -# output +julia> tform = IdentityTransformation(); + +julia> autorange(A, tform) == axes(A) true ``` @@ -21,11 +21,11 @@ The diffrence shows up when `tform` enlarges the input array `A`. In the followi at least `(0:6, 0:6)` as the range indices to get all data of `A`: ```jldoctest; setup=:(using ImageTransformations: autorange; using CoordinateTransformations, Rotations, ImageTransformations) -A = rand(5, 5) -tform = recenter(RotMatrix(pi/8), center(A)) -autorange(A, tform) +julia> A = rand(5, 5); + +julia> tform = recenter(RotMatrix(pi/8), center(A)); -# output +julia> autorange(A, tform) (0:6, 0:6) ``` diff --git a/src/warp.jl b/src/warp.jl index ed57b3f..54e071a 100644 --- a/src/warp.jl +++ b/src/warp.jl @@ -93,19 +93,19 @@ Also, `fillvalue` can be extrapolation schemes: `Flat()`, `Periodic()` and `Refl way to understand these schemes is perhaps try it with small example: ```jldoctest -using ImageTransformations, TestImages, Interpolations -using OffsetArrays: IdOffsetRange +julia> using ImageTransformations, TestImages, Interpolations -img = testimage("lighthouse") +julia> using OffsetArrays: IdOffsetRange -imgr = imrotate(img, π/4; fillvalue=Flat()) # zero extrapolation slope -imgr = imrotate(img, π/4; fillvalue=Periodic()) # periodic boundary -imgr = imrotate(img, π/4; fillvalue=Reflect()) # mirror boundary +julia> img = testimage("lighthouse"); -axes(imgr) +julia> imgr = imrotate(img, π/4; fillvalue=Flat()); # zero extrapolation slope -# output +julia> imgr = imrotate(img, π/4; fillvalue=Periodic()); # periodic boundary +julia> imgr = imrotate(img, π/4; fillvalue=Reflect()); # mirror boundary + +julia> axes(imgr) (IdOffsetRange(values=-196:709, indices=-196:709), IdOffsetRange(values=-68:837, indices=-68:837)) ``` @@ -116,16 +116,15 @@ axes(imgr) pixels in `img`. ```jldoctest -using ImageTransformations, TestImages, Interpolations +julia> using ImageTransformations, TestImages, Interpolations + +julia> img = testimage("lighthouse"); -img = testimage("lighthouse") -imgr = imrotate(img, π/4) -imgr_cropped = imrotate(img, π/4, axes(img)) +julia> imgr = imrotate(img, π/4); -# No need to manually calculate the offsets -imgr[axes(img)...] == imgr_cropped +julia> imgr_cropped = imrotate(img, π/4, axes(img)); -# output +julia> imgr[axes(img)...] == imgr_cropped # No need to manually calculate the offsets true ``` @@ -142,17 +141,20 @@ true Rotate around the center of `img`: ```jldoctest -using ImageTransformations, CoordinateTransformations, Rotations, TestImages, OffsetArrays -using OffsetArrays: IdOffsetRange -img = testimage("lighthouse") # axes (1:512, 1:768) +julia> using ImageTransformations, CoordinateTransformations, Rotations, TestImages, OffsetArrays + +julia> using OffsetArrays: IdOffsetRange + +julia> img = testimage("lighthouse"); -tfm = recenter(RotMatrix(-pi/4), center(img)) -imgw = warp(img, tfm) +julia> axes(img) +(Base.OneTo(512), Base.OneTo(768)) -axes(imgw) +julia> tfm = recenter(RotMatrix(-pi/4), center(img)); -# output +julia> imgw = warp(img, tfm); +julia> axes(imgw) (IdOffsetRange(values=-196:709, indices=-196:709), IdOffsetRange(values=-68:837, indices=-68:837)) ```