You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src/TestImages.jl
+15-2Lines changed: 15 additions & 2 deletions
Original file line number
Diff line number
Diff line change
@@ -44,6 +44,19 @@ remotefiles = [
44
44
"woman_darkhair.tif" ,
45
45
]
46
46
47
+
"""
48
+
testimage(filename, [ops...])
49
+
50
+
load test image that partially matches `filename`, the first match is used if there're more than one. If `ops` is specified, it will be passed to `load` function. use `TestImages.remotefiles` to get a full list of available images.
51
+
52
+
# Example
53
+
```julia
54
+
julia> using TestImages
55
+
julia> testimage("cameraman.tif")
56
+
julia> testimage("cameraman")
57
+
julia> testimage("c")
58
+
```
59
+
"""
47
60
functiontestimage(filename, ops...)
48
61
isdir(imagedir) ||mkpath(imagedir)
49
62
imagefile =joinpath(imagedir, filename)
@@ -59,7 +72,7 @@ function testimage(filename, ops...)
59
72
end
60
73
61
74
if!havefile
62
-
@info"Could not find "*filename*" in directory. Checking if it exists in the online repository."
75
+
@info"Could not find "*filename*" in directory images/ . Checking if it exists in the online repository."
63
76
for f in remotefiles
64
77
ifstartswith(f, filename)
65
78
@info"Found "*filename*" in the online repository. Downloading to the images directory."
@@ -70,7 +83,7 @@ function testimage(filename, ops...)
70
83
end
71
84
end
72
85
end
73
-
havefile ||error("$filename not found in the directory or the online repository. Here are the contents of the images/ directory:\n$(join(fls, '\n'))")
86
+
havefile ||throw(ArgumentError("$filename not found in the directory images/ or the online repository. use `TestImages.remotefiles` to get a full list of test images"))
0 commit comments