Skip to content

Commit

Permalink
start cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
Dale-Black committed Aug 18, 2023
1 parent 2d15714 commit df91282
Show file tree
Hide file tree
Showing 11 changed files with 1,688 additions and 2,132 deletions.
672 changes: 389 additions & 283 deletions Manifest.toml

Large diffs are not rendered by default.

7 changes: 0 additions & 7 deletions Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,7 @@ version = "0.2.2"
[deps]
CUDA = "052768ef-5323-5732-b1bb-66c8b64840ba"
FLoops = "cc61a311-1640-44b5-9fba-1b764f453329"
FoldsCUDA = "6cd66ae4-5932-4b96-926d-e73e578e42cc"
FoldsThreads = "9c68100b-dfe1-47cf-94c8-95104e173443"
ImageMorphology = "787d08f9-d448-5407-9aad-5290dd7ab264"
InteractiveUtils = "b77e0a4c-d291-57a0-90e8-8db25a27a240"
LoopVectorization = "bdcacae8-1622-11e9-2a5c-532679323890"
Markdown = "d6f4376e-aef5-505a-96c1-9c027394607a"
Pkg = "44cfe95a-1eb2-52ea-b672-e2afdf69b78f"
PlutoUI = "7f904dfe-b85e-4ff6-b463-dae2292396a8"
Revise = "295af30f-e4ad-537b-8983-00126c2a3abe"
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"
TestSetExtensions = "98d24dd4-01ad-11ea-1b02-c9a08f80db04"
3 changes: 1 addition & 2 deletions src/DistanceTransforms.jl
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
module DistanceTransforms

using ImageMorphology
using CUDA
using FLoops
using FoldsCUDA
# using FoldsCUDA

include("./borgefors.jl")
include("./felzenszwalb.jl")
Expand Down
70 changes: 8 additions & 62 deletions src/borgefors.jl
Original file line number Diff line number Diff line change
@@ -1,41 +1,17 @@
### A Pluto.jl notebook ###
# v0.19.11

using Markdown
using InteractiveUtils

# ╔═╡ fe947108-2f07-425d-8ded-5a2d8322a0a7
# ╠═╡ show_logs = false
begin
using Pkg
Pkg.activate("..")
using Revise
using PlutoUI
using Test
using DistanceTransforms
using FLoops
using CUDA
end

# ╔═╡ 32dcf5b9-fb91-4891-8be0-a578947aa484
TableOfContents()

# ╔═╡ ec56a36e-72b3-42d2-9f8f-6a332401b9b9
"""
## DistanceTransform
```julia
abstract type DistanceTransform end
```
Main type for all distance transforms
"""
abstract type DistanceTransform end

# ╔═╡ f6dd7123-0069-4154-a3c3-b9f95c49d21d
md"""
# `Borgefors`
"""

# ╔═╡ aafc9419-3105-45ff-905e-610843528e04
"""
## Borgefors
```julia
struct Borgefors{T} <: DistanceTransform end
Expand All @@ -45,23 +21,18 @@ Prepares an array to be `transform`ed using the 3-4 chamfer algorithm laid out i
"""
struct Borgefors <: DistanceTransform end

# ╔═╡ e68e45ae-fbc1-403e-bc45-9d4f227a933f
md"""
## Regular
"""

# ╔═╡ e9afda48-bdbf-4e6b-8fb8-94324a76a7e7
md"""
### 2D
"""

# ╔═╡ 408fa845-a280-47ce-aedd-a53ffe3376f7
"""
## transform (Borgefors)
```julia
transform(img::AbstractMatrix, dt::AbstractMatrix, tfm::Borgefors)
transform(img::AbstractArray, dt::AbstractArray, tfm::Borgefors)
```
2D chamfer distance transform using the 3-4 chamfer algorithm laid out in 'Distance transformations in digital images, Computer Vision, Graphics, and Image Processing' [Gunilla Borgefors](https://studentportalen.uu.se/uusp-filearea-tool/download.action?nodeId=214320&toolAttachmentId=64777)
3D chamfer distance transform using the 3-4 chamfer algorithm laid out in 'Distance transformations in digital images, Computer Vision, Graphics, and Image Processing' [Gunilla Borgefors](https://studentportalen.uu.se/uusp-filearea-tool/download.action?nodeId=214320&toolAttachmentId=64777)
"""
function transform(img::AbstractMatrix, dt::AbstractMatrix, tfm::Borgefors)
w, h = size(img)
Expand Down Expand Up @@ -128,34 +99,9 @@ function transform(img::AbstractMatrix, dt::AbstractMatrix, tfm::Borgefors)
return dt
end

# ╔═╡ 3616fedc-53d6-4eec-90b5-14c1c98a83ba
md"""
### 3D
"""

# ╔═╡ ab0b89ad-8cf1-4cb0-9666-487e6973e414
"""
```julia
transform(img::AbstractArray, dt::AbstractArray, tfm::Borgefors)
```
3D chamfer distance transform using the 3-4 chamfer algorithm laid out in 'Distance transformations in digital images, Computer Vision, Graphics, and Image Processing' [Gunilla Borgefors](https://studentportalen.uu.se/uusp-filearea-tool/download.action?nodeId=214320&toolAttachmentId=64777)
"""
function transform(img::AbstractArray, dt::AbstractArray, tfm::Borgefors)
for z in 1:size(img)[3]
dt[:, :, z] = transform(img[:, :, z], dt[:, :, z], tfm)
end
return dt
end

# ╔═╡ Cell order:
# ╠═fe947108-2f07-425d-8ded-5a2d8322a0a7
# ╠═32dcf5b9-fb91-4891-8be0-a578947aa484
# ╠═ec56a36e-72b3-42d2-9f8f-6a332401b9b9
# ╠═f6dd7123-0069-4154-a3c3-b9f95c49d21d
# ╠═aafc9419-3105-45ff-905e-610843528e04
# ╟─e68e45ae-fbc1-403e-bc45-9d4f227a933f
# ╟─e9afda48-bdbf-4e6b-8fb8-94324a76a7e7
# ╠═408fa845-a280-47ce-aedd-a53ffe3376f7
# ╟─3616fedc-53d6-4eec-90b5-14c1c98a83ba
# ╠═ab0b89ad-8cf1-4cb0-9666-487e6973e414
Loading

0 comments on commit df91282

Please sign in to comment.