Skip to content

Commit 960457a

Browse files
authored
docs: fix build warnings and run doctest as unit test (#234)
1 parent 44d08b2 commit 960457a

File tree

13 files changed

+50
-27
lines changed

13 files changed

+50
-27
lines changed

Project.toml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ julia = "1"
3535

3636
[extras]
3737
AxisArrays = "39de3d68-74b9-583c-8d2d-e117c070f3a9"
38+
Documenter = "e30172f5-a6a5-5a46-863b-614d45cd2de4"
3839
ImageIO = "82e4d734-157c-48bb-816b-45c225c6df19"
3940
ImageMagick = "6218d12a-5da1-5696-b52f-db25d2ecc6d1"
4041
ImageMetadata = "bc367c6b-8a6b-528e-b4bd-a4b897500b49"
@@ -45,4 +46,4 @@ Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"
4546
TestImages = "5e47fb64-e119-507b-a336-dd2b206d9990"
4647

4748
[targets]
48-
test = ["AxisArrays", "ImageIO", "ImageMagick", "ImageMetadata", "ImageQualityIndexes", "Logging", "Random", "Test", "TestImages"]
49+
test = ["AxisArrays", "Documenter", "ImageIO", "ImageMagick", "ImageMetadata", "ImageQualityIndexes", "Logging", "Random", "Test", "TestImages"]

docs/Project.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,11 @@ ImageContrastAdjustment = "f332f351-ec65-5f6a-b3d1-319c6670881a"
55
ImageCore = "a09fc81d-aa75-5fe9-8630-4744c3626534"
66
ImageDistances = "51556ac3-7006-55f5-8cb3-34580c88182d"
77
ImageFiltering = "6a3955dd-da59-5b1f-98d4-e7296123deb5"
8+
ImageIO = "82e4d734-157c-48bb-816b-45c225c6df19"
89
ImageMagick = "6218d12a-5da1-5696-b52f-db25d2ecc6d1"
910
ImageMorphology = "787d08f9-d448-5407-9aad-5290dd7ab264"
1011
ImageShow = "4e3cecfd-b093-5904-9786-8bbb286a6a31"
12+
OffsetArrays = "6fe1bfb0-de20-5000-8ca7-80f57d26f881"
1113
Plots = "91a5bcdd-55d7-5caf-9e0b-520d859cae80"
1214
Random = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c"
1315
Statistics = "10745b16-79ce-11e8-11f9-7d13ad32a3b2"

docs/make.jl

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
using Documenter, DemoCards
22
using ImageFiltering
3+
using OffsetArrays
34
# loading Plots before generating demos (might be helpful to avoid segfaults)
45
using Plots
56
ENV["GKSwstype"] = "nul" # needed for the GR backend on headless servers
@@ -13,14 +14,20 @@ format = Documenter.HTML(prettyurls = get(ENV, "CI", nothing) == "true",
1314
assets = assets)
1415

1516
makedocs(
16-
modules = [ImageFiltering, Kernel, KernelFactors, ImageFiltering.MapWindow],
17+
modules = [ImageFiltering, OffsetArrays, Kernel, KernelFactors, ImageFiltering.MapWindow],
1718
format = format,
1819
sitename = "ImageFiltering",
1920
pages = [
2021
"index.md",
2122
demos,
2223
"Function reference" => "function_reference.md"
23-
]
24+
],
25+
# Note(johnnychen94): doctest is moved as part of unit test for two reasons:
26+
# - we want to run doctest for various Julia versions on various platforms.
27+
# - `doctest=true` for `makedocs` will trigger not only doctest of ImageFiltering but also
28+
# that of other packages listed in `modules`. It usually throws warnings that don't
29+
# belong to the scope of this package.
30+
doctest = false
2431
)
2532

2633
demos_cb()

docs/src/function_reference.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,8 @@ KernelFactors.TriggsSdika
4646
# Kernel utilities
4747

4848
```@docs
49-
centered
49+
OffsetArrays.center
50+
OffsetArrays.centered
5051
kernelfactors
5152
reflect
5253
```

docs/src/index.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ ability to define arrays whose indices span an arbitrary range:
5454

5555
```julia
5656
julia> Kernel.gaussian(1)
57-
OffsetArrays.OffsetArray{Float64,2,Array{Float64,2}} with indices -2:2×-2:2:
57+
OffsetArray{Float64,2,Array{Float64,2}} with indices -2:2×-2:2:
5858
0.00296902 0.0133062 0.0219382 0.0133062 0.00296902
5959
0.0133062 0.0596343 0.0983203 0.0596343 0.0133062
6060
0.0219382 0.0983203 0.162103 0.0983203 0.0219382
@@ -73,7 +73,7 @@ array to one that has coordinates `[0,0,...]` at its center position:
7373

7474
```julia
7575
julia> centered([1 0 1; 0 1 0; 1 0 1])
76-
OffsetArrays.OffsetArray{Int64,2,Array{Int64,2}} with indices -1:1×-1:1:
76+
OffsetArray{Int64,2,Array{Int64,2}} with indices -1:1×-1:1:
7777
1 0 1
7878
0 1 0
7979
1 0 1
@@ -112,16 +112,16 @@ tuple-of-vectors:
112112

113113
```julia
114114
julia> kern1 = centered([1/3, 1/3, 1/3])
115-
OffsetArrays.OffsetArray{Float64,1,Array{Float64,1}} with indices -1:1:
115+
OffsetArray{Float64,1,Array{Float64,1}} with indices -1:1:
116116
0.333333
117117
0.333333
118118
0.333333
119119

120120
julia> kernf = kernelfactors((kern1, kern1))
121-
(ImageFiltering.KernelFactors.ReshapedOneD{Float64,2,0,OffsetArrays.OffsetArray{Float64,1,Array{Float64,1}}}([0.333333,0.333333,0.333333]),ImageFiltering.KernelFactors.ReshapedOneD{Float64,2,1,OffsetArrays.OffsetArray{Float64,1,Array{Float64,1}}}([0.333333,0.333333,0.333333]))
121+
(ImageFiltering.KernelFactors.ReshapedOneD{Float64,2,0,OffsetArray{Float64,1,Array{Float64,1}}}([0.333333,0.333333,0.333333]),ImageFiltering.KernelFactors.ReshapedOneD{Float64,2,1,OffsetArray{Float64,1,Array{Float64,1}}}([0.333333,0.333333,0.333333]))
122122

123123
julia> kernp = broadcast(*, kernf...)
124-
OffsetArrays.OffsetArray{Float64,2,Array{Float64,2}} with indices -1:1×-1:1:
124+
OffsetArray{Float64,2,Array{Float64,2}} with indices -1:1×-1:1:
125125
0.111111 0.111111 0.111111
126126
0.111111 0.111111 0.111111
127127
0.111111 0.111111 0.111111

src/borderarray.jl

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,9 @@ end
2626
"""
2727
BorderArray(inner::AbstractArray, border::AbstractBorder) <: AbstractArray
2828
29-
Construct a thin wrapper around the array `inner`, with given `border`. No data is copied in the constructor, instead border values are computed on the fly in `getindex` calls. Useful for stencil computations. See also [padarray](@ref).
29+
Construct a thin wrapper around the array `inner`, with given `border`. No data is copied in
30+
the constructor, instead border values are computed on the fly in `getindex` calls. Useful
31+
for stencil computations. See also [`padarray`](@ref).
3032
3133
# Examples
3234
```julia

src/extrema.jl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,15 +45,15 @@ as a fraction of `maximum(abs, img)` and the volume of the Gaussian.
4545
While most images are 2- or 3-dimensional, it will be easier to illustrate this with
4646
a one-dimensional "image" containing two Gaussian blobs of different sizes:
4747
48-
```jldoctest; setup=:(using ImageFiltering), filter=r"amplitude=.*"]
48+
```jldoctest; setup=:(using ImageFiltering), filter=r"amplitude=.*"
4949
julia> σs = 2.0.^(1:6);
5050
5151
julia> img = zeros(100); img[20:30] = [exp(-x^2/(2*4^2)) for x=-5:5]; img[50:80] = [exp(-x^2/(2*8^2)) for x=-15:15];
5252
5353
julia> blob_LoG(img, σs; edges=false)
5454
2-element Vector{BlobLoG{Float64, Tuple{Float64}, 1}}:
55-
location=CartesianIndex(25,), σ=(4.0,), amplitude=0.10453155018303673
56-
location=CartesianIndex(65,), σ=(8.0,), amplitude=0.046175719034527364
55+
BlobLoG(location=CartesianIndex(25,), σ=(4.0,), amplitude=0.10453155018303673)
56+
BlobLoG(location=CartesianIndex(65,), σ=(8.0,), amplitude=0.046175719034527364)
5757
```
5858
5959
The other two are centered in their corresponding "features," and the width `σ`

src/imfilter.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -567,7 +567,7 @@ imfilter(f,w,Inner())
567567
# References
568568
1. R. C. Gonzalez and R. E. Woods. *Digital Image Processing (3rd Edition)*. Upper Saddle River, NJ, USA: Prentice-Hall, 2006.
569569
570-
See also: [`imfilter!`](@ref), [`centered`](@ref), [`padarray`](@ref), [`Pad`](@ref), [`Fill`](@ref), [`Inner`](@ref), [`KernelFactors.IIRGaussian`](@ref).
570+
See also: [`imfilter!`](@ref), [`centered`](@ref OffsetArrays.centered), [`padarray`](@ref), [`Pad`](@ref), [`Fill`](@ref), [`Inner`](@ref), [`KernelFactors.IIRGaussian`](@ref).
571571
"""
572572
imfilter
573573

src/kernel.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -397,7 +397,7 @@ relative to the corners.
397397
398398
# Examples
399399
400-
```jldoctest
400+
```jldoctest; setup=:(using ImageFiltering)
401401
julia> Kernel.laplacian2d(0) # the standard Laplacian
402402
3×3 OffsetArray(::Matrix{Float64}, -1:1, -1:1) with eltype Float64 with indices -1:1×-1:1:
403403
0.0 1.0 0.0

src/mapwindow.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ end
9696
"""
9797
mapwindow!(f, out, img, window; border="replicate", indices=axes(img))
9898
99-
Variant of [mapwindow](@ref), with preallocated output.
99+
Variant of [`mapwindow`](@ref), with preallocated output.
100100
If `out` and `img` have overlapping memory regions, behaviour is undefined.
101101
"""
102102
function mapwindow!(f, out, img, window; border="replicate",

0 commit comments

Comments
 (0)