grass icon indicating copy to clipboard operation
grass copied to clipboard

[Bug] i.ifft fails to re-construct image in presence of mask

Open dhdeangelis opened this issue 5 months ago • 1 comments

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

  1. choose any suitable raster ('example')
  2. Run the forward transform: i.fft in=example real=re imaginary=im
  3. create an empty vector map ('mask'), digitize mask zones, save
  4. Put in place inverse mask: r.mask -i vector=mask
  5. Run inverse transform: i.ifft real=re imaginary=im out=example.filtered
  6. Remove mask: r.mask -r
  7. Check raster, for example using r.info: Range of data: min = NULL max = NULL, but also visually is empty.
  8. 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

dhdeangelis avatar May 25 '25 14:05 dhdeangelis