DIPlib / diplib

Quantitative Image Analysis in C++, MATLAB and Python
https://diplib.org
Apache License 2.0
211 stars 48 forks source link

gaussf: different boundary behaviour within methods #159

Closed AndreZeug closed 1 month ago

AndreZeug commented 1 month ago

Component Matlab R2024a DIPimage toolbox for quantitative image analysis Version 3.4.3 10-May-2024

Describe the bug The methods included in gaussf (derivative) lead to different boundary behaviour, depending on method used. When smoothing a z-stack structures from the last/first layer are present in the first/last - depending on the method used.

RAW z0 dd_RAW

iir z0 (ddiir = single(gaussf(double(squeeze(dd)),[.8 .8 .8],'iir'));) dd_iir

ft z0 (ddft = single(gaussf(double(squeeze(dd)),[.8 .8 .8],'ft'));) dd_ft

Question Can 'boundary_condition' , 'truncation' be used with 'ft' to achieve similar behaviour as with 'iir' and 'fir'? Typically I use a weak smoothing of 0.5 which implicates 'ft' method as default.

To Reproduce Sample data can be found here dd_uint8.zip.

ddiir = single(gaussf(double(squeeze(dd)),[.8 .8 .8],'iir')); ddft = single(gaussf(double(squeeze(dd)),[.8 .8 .8],'ft')); ddfir = single(gaussf(double(squeeze(dd)),[.8 .8 .8],'fir'));

System information: Win10, Matlab2024a, DIPimage 3.4

crisluengo commented 1 month ago

I agree, this should be consistent. I’ll have to take a look how to do this properly, we also don’t want to change behavior that people might depend on.

AndreZeug commented 1 month ago

Dear Chris, Thank you so much! You are faster with fixing then I with compiling 🙈 Both conditions work perfect now! (at least for me 🤭)

Best, Andre