Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

gaussf: error when first time usage #158

Closed
AndreZeug opened this issue May 13, 2024 · 1 comment
Closed

gaussf: error when first time usage #158

AndreZeug opened this issue May 13, 2024 · 1 comment
Labels
bug component:DIPimage About the DIPimage toolbox for MATLAB

Comments

@AndreZeug
Copy link

AndreZeug commented May 13, 2024

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

Describe the bug
I try to use GAUSSF to smooth a 100x2 matrix AA.zip (containing x,y coordinates) in the 1. dimension only.
When calling
AA(:,:,2) = single(gaussf(AA,[0 .5]));
I receive the following error:

Error using dip_filtering
Index out of range
in function: Fix (Z:\GIT\DIPimage\include\diplib/library/types.h at line number 545)
in function: View (Z:\GIT\DIPimage\src\library\image_views.cpp at line number 74)
in function: At (Z:\GIT\DIPimage\include\diplib/library/image_views.h at line number 1391)
in function: FourierTransform (Z:\GIT\DIPimage\src\transform\fourier.cpp at line number 579)
in function: Gauss (Z:\GIT\DIPimage\src\linear\derivative.cpp at line number 75)
in function: Derivative (Z:\GIT\DIPimage\src\linear\derivative.cpp at line number 107)
Error in gaussf (line 58)
   image_out = dip_filtering('derivative',image_in,0,sigma); 
58     image_out = dip_filtering('derivative',image_in,0,sigma);

When executing the same command
AA(:,:,2) = single(gaussf(AA(:,:,1),[0 .5]));
a second time the error does not occur and the returned data are as expected.

The error does not occur at all when using
AA(:,:,2) = single(gaussf(AA(:,:,1),[0 .8]));
since another method ('fir' instead of 'ft') is used as default?
When using
AA(:,:,2) = single(gaussf(AA(:,:,1),[0 .5],'fir'));
I receive no error.

This behaviour changed with DIPimage 3.x and was not present in DIPimage 2.9

System information:
Win10, Matlab2024a, DIPimage 3.4

@AndreZeug AndreZeug added the bug label May 13, 2024
@crisluengo crisluengo added the component:DIPimage About the DIPimage toolbox for MATLAB label May 13, 2024
@crisluengo
Copy link
Member

Thank you! I have been able to reproduce this, and found the bug.
It is caused when the Fourier transform of a real image picks a dimension of size 2 to do the R2C transform along. For such a short input, there are no pixels that are conjugate symmetric, and so no copying of data is needed. The function tries to copy 0 pixels and fails.

The real mystery is why it works the second time!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug component:DIPimage About the DIPimage toolbox for MATLAB
Projects
None yet
Development

No branches or pull requests

2 participants