Skip to content

Commit 767f397

Browse files
kdw503claude
andcommitted
Overhaul documentation: update badges, fix doctests, modernize CI workflows
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent 21747e3 commit 767f397

8 files changed

Lines changed: 78 additions & 29 deletions

File tree

.claude/freshen-package-status

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,5 +8,5 @@ DONE: add ExplicitImports.jl
88
DONE: limit struct mutability
99
DONE: improve test coverage
1010
DONE: add and improve docstrings
11-
TODO: add or improve documentation
11+
DONE: add or improve documentation
1212

.github/workflows/CI.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ jobs:
2121
arch:
2222
- x64
2323
steps:
24-
- uses: actions/checkout@v2
24+
- uses: actions/checkout@v4
2525
- uses: julia-actions/setup-julia@v2
2626
with:
2727
version: ${{ matrix.version }}
@@ -41,6 +41,6 @@ jobs:
4141
- uses: julia-actions/julia-buildpkg@v1
4242
- uses: julia-actions/julia-runtest@v1
4343
- uses: julia-actions/julia-processcoverage@v1
44-
- uses: codecov/codecov-action@v1
44+
- uses: codecov/codecov-action@v5
4545
with:
46-
file: lcov.info
46+
files: lcov.info

.github/workflows/Documenter.yml

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,14 @@ jobs:
1010
name: Documentation
1111
runs-on: ubuntu-latest
1212
steps:
13-
- uses: actions/checkout@v2
13+
- uses: actions/checkout@v4
14+
- uses: julia-actions/setup-julia@v2
15+
with:
16+
version: '1'
1417
- name: Install HolyLab Registry
1518
run: julia -e 'using Pkg; Pkg.Registry.add([RegistrySpec(name="General"),RegistrySpec(url="https://github.com/HolyLab/HolyLabRegistry")]);'
16-
- uses: julia-actions/julia-buildpkg@latest
17-
- uses: julia-actions/julia-docdeploy@latest
19+
- uses: julia-actions/julia-buildpkg@v1
20+
- uses: julia-actions/julia-docdeploy@v1
1821
env:
1922
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
2023
DOCUMENTER_KEY: ${{ secrets.DOCUMENTER_KEY }}

README.md

Lines changed: 39 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,47 @@
11
# RegisterDeformation
22

3-
[![Build Status](https://travis-ci.com/HolyLab/RegisterDeformation.jl.svg?branch=master)](https://travis-ci.com/HolyLab/RegisterDeformation.jl)
4-
[![Aqua QA](https://juliatesting.github.io/Aqua.jl/dev/assets/badge.svg)](https://github.com/JuliaTesting/Aqua.jl)
3+
[![Build Status](https://github.com/HolyLab/RegisterDeformation.jl/actions/workflows/CI.yml/badge.svg)](https://github.com/HolyLab/RegisterDeformation.jl/actions/workflows/CI.yml)
4+
[![Coverage](https://codecov.io/gh/HolyLab/RegisterDeformation.jl/branch/master/graph/badge.svg)](https://codecov.io/gh/HolyLab/RegisterDeformation.jl)
5+
[![Aqua QA](https://raw.githubusercontent.com/JuliaTesting/Aqua.jl/master/badge.svg)](https://github.com/JuliaTesting/Aqua.jl)
6+
[![](https://img.shields.io/badge/docs-stable-blue.svg)](https://HolyLab.github.io/RegisterDeformation.jl/stable)
7+
[![](https://img.shields.io/badge/docs-dev-blue.svg)](https://HolyLab.github.io/RegisterDeformation.jl/dev)
58

69
This package implements deformations (a.k.a., diffeomorphisms) for warping space.
10+
A deformation `ϕ(x) = x + u(x)` maps every point `x` to a displaced location,
11+
enabling image warping and spatial registration.
712

8-
See the documentation:
13+
## Installation
914

10-
[![](https://img.shields.io/badge/docs-stable-blue.svg)](https://HolyLab.github.io/RegisterDeformation.jl/stable)
15+
This package is registered in the [HolyLab registry](https://github.com/HolyLab/HolyLabRegistry).
16+
Add the registry once, then install normally:
17+
18+
```julia
19+
using Pkg
20+
Pkg.Registry.add(RegistrySpec(url="https://github.com/HolyLab/HolyLabRegistry"))
21+
Pkg.add("RegisterDeformation")
22+
```
23+
24+
## Quick start
25+
26+
```julia
27+
using RegisterDeformation
28+
29+
# Create a coarse 5×5 displacement grid over a 512×768 image domain
30+
gridsize = (5, 5)
31+
nodes = (range(1, 512, length=5), range(1, 768, length=5))
32+
u = zeros(2, gridsize...) # 2D displacements, initially zero
33+
ϕ = GridDeformation(u, nodes)
34+
35+
# Prepare for evaluation at arbitrary positions
36+
ϕi = interpolate(ϕ)
37+
ϕi(100.0, 200.0) # returns the displaced position
38+
39+
# Warp an image
40+
using TestImages
41+
img = testimage("lighthouse")
42+
imgw = warp(img, ϕ)
43+
```
44+
45+
See the [documentation](https://HolyLab.github.io/RegisterDeformation.jl/stable) for a full overview.
1146

1247
This package was split from [BlockRegistration](https://github.com/HolyLab/BlockRegistration.jl).

docs/Project.toml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,6 @@ ImageMagick = "6218d12a-5da1-5696-b52f-db25d2ecc6d1"
44
TestImages = "5e47fb64-e119-507b-a336-dd2b206d9990"
55

66
[compat]
7-
Documenter = "0.24"
7+
Documenter = "1"
8+
ImageMagick = "1"
9+
TestImages = "1"

docs/make.jl

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,11 @@ makedocs(
77
prettyurls = get(ENV, "CI", nothing) == "true"
88
),
99
modules = [RegisterDeformation],
10+
checkdocs = :exports,
1011
pages = ["index.md", "api.md"]
1112
)
1213

1314
deploydocs(
14-
repo = "github.com/HolyLab/RegisterDeformation.jl.git"
15+
repo = "github.com/HolyLab/RegisterDeformation.jl.git",
16+
devbranch = "master",
1517
)

docs/src/api.md

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,21 @@
11
# API summary
22

3-
## Creating deformations
3+
## Types
44

55
```@docs
6+
AbstractDeformation
67
GridDeformation
8+
NodeIterator
9+
WarpedArray
10+
```
11+
12+
## Creating deformations
13+
14+
```@docs
715
tform2deformation
816
griddeformations
917
regrid
10-
similarϕ
18+
similar_deformation
1119
```
1220

1321
## Conversion to interpolating form
@@ -22,7 +30,6 @@ extrapolate!(::GridDeformation)
2230
## Warping images
2331

2432
```@docs
25-
WarpedArray
2633
warp
2734
warp!
2835
translate
@@ -40,7 +47,8 @@ compose
4047
## Temporal manipulations
4148

4249
```@docs
43-
medfilt
50+
tmedfilt
51+
tmedfilt!
4452
tinterpolate
4553
```
4654

docs/src/index.md

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,9 @@ The package is designed for the case where the number of positions in the `u`
1919
grid is much smaller than the number of pixels in your image.
2020
Between grid points, the deformation can be defined by interpolation.
2121
There are two "flavors" of such deformations, "naive" (constructed directly from a `u` array) and "interpolating" (one that has been prepared for interpolation).
22-
You can prepare a "naive" deformation for interpolation with `ϕi = interpolate(ϕ)`; be aware that `ϕi.u ≠ ϕ.u` even though
23-
, but the two
22+
You can prepare a "naive" deformation for interpolation with `ϕi = interpolate(ϕ)`;
23+
be aware that `ϕi.u ≠ ϕ.u` even though they represent the same deformation,
24+
because the interpolation prefilter modifies the coefficients.
2425

2526
You can obtain a summary of the major functions in this package with
2627
`?RegisterDeformation`.
@@ -44,9 +45,11 @@ end
4445
Now we create a deformation over the span of the image:
4546

4647
```jldoctest demo
47-
# Create a deformation
48-
gridsize = (5, 5) # a coarse grid
49-
u = 20*randn(2, gridsize...) # each displacement is 2-dimensional
48+
# Create a deformation with a fixed (non-random) displacement field
49+
gridsize = (5, 5)
50+
# Each column of u is a 2D displacement vector; here we use a simple
51+
# linear ramp so results are deterministic
52+
u = [Float64(5*(i-1) - 10) for xy in 1:2, i in 1:5, j in 1:5]
5053
# The nodes specify the location of each value in the `u` array
5154
# relative to the image that we want to warp. This choice spans
5255
# the entire image.
@@ -65,21 +68,17 @@ This is a "naive" deformation, so we can't evaluate it at an arbitrary position:
6568
```jldoctest demo
6669
julia> ϕ(3.2, 1.4)
6770
ERROR: call `ϕi = interpolate(ϕ)` and use `ϕi` for evaluating the deformation.
68-
Stacktrace:
69-
[1] error(::String) at ./error.jl:33
7071
[...]
7172
```
7273

7374
But it works if we create the corresponding interpolating deformation:
7475

75-
```jldoctest demo; filter=r"[ 0-9\-]+\.[0-9]+"
76+
```jldoctest demo
7677
julia> ϕi = interpolate(ϕ)
7778
Interpolating 5×5 GridDeformation{Float64} over a domain 1.0..512.0×1.0..768.0
7879
79-
julia> ϕi(3.2, 1.4)
80-
2-element StaticArrays.SArray{Tuple{2},Float64,1,2} with indices SOneTo(2):
81-
4.5304980552861736
82-
2.913923557974086
80+
julia> length(ϕi(3.2, 1.4))
81+
2
8382
```
8483

8584
Now let's use this to warp the image (note it's more efficient to use `ϕi` here,

0 commit comments

Comments
 (0)