Implemented an experimental executable for all systems, fixed a few errors, implemented first try for a median filter for the slices in Julia

This commit is contained in:
Pixelguy14
2025-02-10 15:34:30 -06:00
parent 59630bdd95
commit 63c7428214
5 changed files with 109 additions and 56 deletions
+25
View File
@@ -383,4 +383,29 @@ function log_tick_formatter(values::Vector{Float64})
end
return map((v, e) -> e == 0 ? "$(round(v, sigdigits=2))" : "$(round(v, sigdigits=2))x10" * Makie.UnicodeFun.to_superscript(e), formValues, exponents)
end
# Median filter: an adaptation of the R medianfilter, which averages the matrix
# with the close pixels just from the sides to reduce noise.
# This one in particular is a midpoint fiter from a 3x3 neighbour area
function medianFilterjl(pixMap)
width, height = size(pixMap)
target = zeros(eltype(pixMap), height, width)
println("Matrix Dimensions: ", size(pixMap))
for j in 2:(width-1)
for i in 2:(height-1)
println("Current Indices: i = $i, j = $j")
neighbors = []
for dj in max(1, j-1):min(width, j+1)
for di in max(1, i-1):min(height, i+1)
push!(neighbors, pixMap[di, dj])
end
end
target[i, j] = median(neighbors)
end
end
return target
end