Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
version: 2
updates:
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "weekly"
4 changes: 4 additions & 0 deletions .github/workflows/CompatHelper.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@ on:
- cron: '00 00 * * *'
workflow_dispatch:

permissions:
contents: write
pull-requests: write

jobs:
CompatHelper:
runs-on: ${{ matrix.os }}
Expand Down
22 changes: 6 additions & 16 deletions .github/workflows/UnitTest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
16 changes: 3 additions & 13 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
4 changes: 2 additions & 2 deletions src/ImageTransformations.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand All @@ -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");
Expand Down
16 changes: 8 additions & 8 deletions src/autorange.jl
Original file line number Diff line number Diff line change
Expand Up @@ -9,23 +9,23 @@ 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
```

The diffrence shows up when `tform` enlarges the input array `A`. In the following example, we need
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)
```

Expand Down
46 changes: 24 additions & 22 deletions src/warp.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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))
```

Expand All @@ -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
```

Expand All @@ -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))
```

Expand Down
Loading