Skip to content
Snippets Groups Projects
Commit 5bb94d39 authored by Stephan Hilb's avatar Stephan Hilb
Browse files

add test for image sampling

parent fb12a137
No related branches found
No related tags found
No related merge requests found
# This file is machine-generated - editing it directly is not advised
[[Base64]]
uuid = "2a0f44e3-6c83-55bd-87e4-b1978d98bd5f"
[[InteractiveUtils]]
deps = ["Markdown"]
uuid = "b77e0a4c-d291-57a0-90e8-8db25a27a240"
[[Logging]]
uuid = "56ddb016-857b-54e1-b83d-db4d58db5568"
[[Markdown]]
deps = ["Base64"]
uuid = "d6f4376e-aef5-505a-96c1-9c027394607a"
[[Random]]
deps = ["Serialization"]
uuid = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c"
[[Serialization]]
uuid = "9e88b42a-f829-5b0c-bbe9-9e923198166b"
[[Test]]
deps = ["InteractiveUtils", "Logging", "Random", "Serialization"]
uuid = "8dfed614-e22c-5e08-85e1-65c5234f0b40"
[deps]
Random = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c"
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"
import Random
using Test
using SemiSmoothNewton
Random.seed!(0)
@testset "imaging" begin
img = rand(3, 3)
mesh = init_grid(img)
@test ndims_domain(mesh) == 2
@test ndims_space(mesh) == 2
v0 = minimum(mesh.vertices, dims = 2) |> vec
v1 = maximum(mesh.vertices, dims = 2) |> vec
@test v0 == [1., 1.]
@test v1 == [3., 3.]
f_space = FeSpace(mesh, P1(), (1,))
f = FeFunction(f_space)
interpolate!(f, x -> interpolate_bilinear(img, x))
img_sampled = sample(f)
@test img == img_sampled
end
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment