From 7d8a56b1561cfbafb0727a410f67107a91b9380b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Paul=20J=C3=BCr=C3=9F?= Date: Wed, 28 Feb 2024 11:16:05 +0100 Subject: [PATCH] Add kernel width keyword --- src/Vessel.jl | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/Vessel.jl b/src/Vessel.jl index 54825d4..b7e79ab 100644 --- a/src/Vessel.jl +++ b/src/Vessel.jl @@ -150,9 +150,11 @@ function vesselPhantom(N::NTuple{3,Int}; oversampling=2, rng = GLOBAL_RNG, kargs obs = [ sphere( Float32.(route[i]), Float32(diameter_route[i]), 1.0f0) for i=eachindex(route) ] ranges = ntuple(d-> 1:N[d], 3) img = phantom(ranges..., obs, oversampling) - # filter for smoothing, offset to ensure minimal filter width - filterWidth = (1.0-0.2)*rand(rng) + 0.2 - kernelWidth = ntuple(_ -> filterWidth*N[1] / 20, 3) + if isnothing(kernelWidth) + # filter for smoothing, offset to ensure minimal filter width + filterWidth = (1.0-0.3)*rand(rng) + 0.3 + kernelWidth = ntuple(_ -> filterWidth*N[1] / 20, 3) + end img = imfilter(img, Kernel.gaussian(kernelWidth)) img[img .> 1] .= 1 return img