grass
grass copied to clipboard
[Bug] i.ifft fails to re-construct image in presence of mask
Describe the bug
When using a mask intended to filter portions of the frequency domain created by i.fft, the inverse transform i.ifft creates a raster that is composed entirely of NULL values. When using no mask the inverse function works as expected.
To reproduce
- choose any suitable raster ('example')
- Run the forward transform:
i.fft in=example real=re imaginary=im - create an empty vector map ('mask'), digitize mask zones, save
- Put in place inverse mask:
r.mask -i vector=mask - Run inverse transform:
i.ifft real=re imaginary=im out=example.filtered - Remove mask:
r.mask -r - Check raster, for example using r.info:
Range of data: min = NULL max = NULL, but also visually is empty. - Using no mask, and thus no filter, the inverse transform works as expected
Expected behavior
i.ifft would recreate an image from the real and imaginary parts but filtering values in the frequency domain according to the mask.
System description
System Info
GRASS version: 8.5.0dev
Code revision: f9cfab5903
Build date: 2025-05-25
Build platform: x86_64-pc-linux-gnu
GDAL: 3.12.0dev-2cf7f89c26-dirty
PROJ: 9.7.0
GEOS: 3.14.0dev
SQLite: 3.49.2
Python: 3.13.3
wxPython: 4.2.2
Platform: Linux-6.14.6-1-default-x86_64-with-glibc2.41
Additional context
fftw3 installed, GRASS compiled with support for it
GRASS is now configured for: x86_64-pc-linux-gnu
Source directory: /usr/local/src/grass
Build directory: /usr/local/src/grass
Installation directory: ${prefix}/grass85
Startup script in directory:${exec_prefix}/bin
C compiler: gcc -g -O2
C++ compiler: g++ -g -O2
Building shared libraries: yes
OpenGL platform: X11
MacOSX application: no
MacOSX architectures:
MacOSX SDK:
BLAS support: yes
BZIP2 support: no
C++ support: yes
Cairo support: yes
FFTW support: yes
FreeType support: yes
GDAL support: yes
GEOS support: yes
LAPACK support: no
Large File support (LFS): yes
libLAS support: no
LIBSVM support: yes
MySQL support: no
NetCDF support: yes
NLS support: no
ODBC support: yes
OGR support: yes
OpenCL support: no
OpenGL support: yes
OpenMP support: yes
PDAL support: yes
PNG support: yes
POSIX thread support: no
PostgreSQL support: no
Readline support: yes
Regex support: yes
PCRE support: no
SQLite support: yes
TIFF support: yes
X11 support: yes
Zstandard support: yes
using new PROJ 5+ API