GNU Astronomy Utilities



12.3.26 Convolution functions (convolve.h)

Convolution is a very common operation during data analysis and is thoroughly described as part of Gnuastro’s Convolve program which is fully devoted to this job. Because of the complete introduction that was presented there, we will directly skip onto the currently available convolution functions in Gnuastro’s library.

As of this version, only spatial domain convolution is available in Gnuastro’s libraries. We have not had the time to liberate the frequency domain function convolution and deconvolution functions that are available in the Convolve program275.

Function:
gal_data_t *
gal_convolve_spatial (gal_data_t *tiles, gal_data_t *kernel, size_t numthreads, int edgecorrection, int convoverch, int conv_on_blank)

Convolve the given tiles dataset (possibly a list of tiles, see List of gal_data_t and Tessellation library (tile.h)) with kernel on numthreads threads. When edgecorrection is non-zero, it will correct for the edge dimming effects as discussed in Edges in the spatial domain. When conv_on_blank is non-zero, this function will also attempt convolution over the blank pixels (and therefore give values to the blank pixels that are near non-blank pixels).

tiles can be a single/complete dataset, but in that case the speed will be very slow. Therefore, for larger images, it is recommended to give a list of tiles covering a dataset. To create a tessellation that fully covers an input image, you may use gal_tile_full, or gal_tile_full_two_layers to also define channels over your input dataset. These functions are discussed in Tile grid. You may then pass the list of tiles to this function. This is the recommended way to call this function because spatial domain convolution is slow and breaking the job into many small tiles and working on simultaneously on several threads can greatly speed up the processing.

If the tiles are defined within a channel (a larger tile), by default convolution will be done within the channel, so pixels on the edge of a channel will not be affected by their neighbors that are in another channel. See Tessellation for the necessity of channels in astronomical data analysis. This behavior may be disabled when convoverch is non-zero. In this case, it will ignore channel borders (if they exist) and mix all pixels that cover the kernel within the dataset.

Function:
void
gal_convolve_spatial_correct_ch_edge (gal_data_t *tiles, gal_data_t *kernel, size_t numthreads, int edgecorrection, int conv_on_blank, gal_data_t *tocorrect)

Correct the edges of channels in an already convolved image when it was initially convolved with gal_convolve_spatial and convoverch==0. In that case, strong boundaries might exist on the channel edges. So if you later need to remove those boundaries at later steps of your processing, you can call this function. It will only do convolution on the tiles that are near the edge and were effected by the channel borders. Other pixels in the image will not be touched. Hence, it is much faster. When conv_on_blank is non-zero, this function will also attempt convolution over the blank pixels (and therefore give values to the blank pixels that are near non-blank pixels).


Footnotes

(275)

Hence any help would be greatly appreciated.