Processing of Idiopathic Pulmonary Fibrosis images based on spatial
interpolation using DFT, FFT, DCT and LPF
IRLA MANTILLA, MIHAEL ARCE
Universidad Nacional de Ingeniería,
Av. Túpac Amaru 210, Rímac, 27
PERU
Abstract: —The work focuses on the study of existing issues with some medical images obtained from patients with Idiopathic
Pulmonary Fibrosis (IPF) who have survived this COVID-19 pandemic. This study analyzes potential causes of incorrect medical
diagnoses with this disease. In this regard, we employ numerical algorithms such as DFT (Discrete Fourier Transform), FFT (Fast
Fourier Transform), DCT (Discrete Cosine Transform), and LPF (Low-pass filter). The main objective of this work is to
demonstrate that with these numerical algorithms based on Continuous and Discrete Fourier Theory, it is possible to filter existing
noise in IPF radiography images. Furthermore, it is possible to compress, enhance, and improve their resolution so that better
decisions can be made in a medical protocol. In this way, it contributes to the understanding of the true images that would be used
for an optimal medical diagnosis.
Keywords: Discrete Cosine Transform, Discrete Fourier Transform, Fast Fourier Transform, Idiopathic Pulmonary Fibrosis,
Low-pass filter, Medical Image Processing.
Received: March 21, 2024. Revised: Agust 17, 2024. Accepted: September 20, 2024. Published: November 4, 2024.
1. Introduction
The COVID-19 pandemic has left significant consequences on
the health of millions of people around the world, [1],[2].
Seven species infect humans; two from the alpha set (HCoV-
229E and HCoV-NL6) and five from the beta (HCoV-HKU1,
HCoV-OC43, SARS (“Severe Acute Respiratory Syndrome
Coronavirus”, today called SARS-CoV-1), MERS (“Middle
East Respiratory Syndrome”, today called MERS-CoV) and
SARS-CoV 2). HCoVs infect the respiratory tract and are
responsible for a certain proportion of mild respiratory tract
infections that usually occur each year and are diagnosed
regularly, [3]. Among the respiratory complications that have
been observed in patients recovered from the disease is
Idiopathic Pulmonary Fibrosis (IPF), a chronic and progressive
disease that affects lung function and reduces the quality of life
of those who suffer from it, [4], [5]. With the aim of better
understanding the characteristics of IPF in post-COVID-19
patients, a study was carried out on the application of medical
image processing techniques, [6], [7].
This study shows how medical image processing
techniques can significantly contribute to improving the
diagnosis of IPF and prevent patients from undergoing
processes harmful to their health to obtain a diagnosis. The
processing techniques used are based on the Fourier transform
since it converts a spatial domain to a frequency domain;
Therefore, it is possible to amplify an image, [8], by
interpolating points, compressing, [8], and correcting, [9], [10],
[11], an image by filtering high frequencies. We hope that the
findings presented in this article will drive future research and
advances in the field of IPF, thereby improving medical care
and quality of life for affected patients, [12].
2. Frequency Domain Processing
The frequency domain is the realm in which an image is
represented as the sum of periodic signals of different
frequencies. For instance, the Fourier transform of an image is
the representation of that image through a summation of
complex exponentials with varying magnitudes, frequencies,
and phases. The discrete one-dimensional Fourier transform
and its inverse are defined as follows, [8], and, [9],
respectively:
󰇝󰇛󰇜󰇞󰇛󰇜󰇛󰇜


 󰇝󰇞
󰇝󰇛󰇜󰇞󰇛󰇜
󰇛󰇜
󰇝󰇞


Meanwhile, the discrete -dimensional transforms are
defined as follows:
󰇝󰇛󰇜󰇞󰇛󰇜 󰇛󰇜

 

 󰇝󰇞
MOLECULAR SCIENCES AND APPLICATIONS
DOI: 10.37394/232023.2024.4.10
Irla Mantilla, Mihael Arce
E-ISSN: 2732-9992
111
Volume 4, 2024
󰇝󰇛󰇜󰇞󰇛󰇜
 󰇛󰇜

 

 󰇝󰇞
3. Fast convolution
An important property of the Fourier transform is that the
multiplication of the Fourier transforms of two associated
spatial functions is equal to the product of their individual
transforms. This property, together with the fast Fourier
transform, form the basis for the convolution algorithm. The
discrete Fourier convolution, [8], is expressed as follows:
󰇛󰇜󰇛󰇜
󰇛󰇜󰇛󰇜
󰇝󰇞


Given two matrices  and  representing the values
of one of the  components of two images, the convolution
algorithm between these matrices is executed through the
following steps:
1. Zeros are added to and to make the dimensions of
the resulting matrix from the convolution between
and 󰇛󰇜󰇛󰇜. Additionally, zeros
are often added to and until the number of elements
in each matrix is a power of two.
2. The two-dimensional Fourier transforms of and are
computed.
3. The element-wise multiplication is performed between
the Fourier transform of and the Fourier transform of
.
4. The two-dimensional inverse Fourier transform is
applied to the product obtained in the previous step.
4. Image Amplification
Image amplification based on spatial interpolation through
the frequency domain can be carried out using the following
method:
A transformation matrix  is defined as follows:

 


The matrices and are defined. Therefore,
the discrete Fourier transform of would be given by:

Expressing the above equality using summations, the two-
dimensional discrete Fourier transform is given by:
󰇛󰇜
 󰇛󰇜󰇛

󰇜



 ;

By defining a transformation matrix  as:




Given that:


 



It can be deduced that: 
Therefore, the Inverse Discrete Fourier Transform is given by:
󰇛󰇜󰇛󰇜



 󰇛

󰇜

This method is quite suitable because even though the four
groups of nodes are very separated, when transforming the
spatial domain into a frequency domain, they remain
practically equidistant so that the interpolation can be effective.
Finally, we proceed to carry out the procedure for the
amplification of images, [8], whose dimensions are powers of
“two” due to the change of domain, as follows:
1. Place the values of the first RGB component of each
pixel in the image into a matrix  
according to their position in the image.
2. Apply the two-dimensional discrete Fourier transform
to the matrix  and store the result in a matrix
  assuming that 󰇛󰇜,
and 󰇛󰇜
3. Let be the value of the proportional increase in
image dimensions. Define the matrix with
dimensions  as follows:



󰇝


󰇝
󰇞


󰇝

󰇞
4. Apply the inverse discrete Fourier transform to the matrix
to obtain the matrix with dimensions 
5. Multiply each element of the matrix by
to
compensate for the increase in its values caused by the inverse
transform applied to the times larger matrix compared
to the original matrix .
6. Repeat the previous steps for the other two components of
each pixel in the image.
In Figure 1, you can see how the matrix is constructed
from the matrix in step 3:
MOLECULAR SCIENCES AND APPLICATIONS
DOI: 10.37394/232023.2024.4.10
Irla Mantilla, Mihael Arce
E-ISSN: 2732-9992
112
Volume 4, 2024
Fig. 1 Construction of the augmented matrix from the matrix
5. Discrete Cosine Transform (DCT)
The Discrete Cosine Transform (DCT) represents the values of
a matrix that represents an image by summing sine waves of
different amplitudes and frequencies. It is commonly used in
image compression because most of the visually significant
information is concentrated in only a few DCT coefficients,
[8]. Given a matrix 󰇟󰇠 with dimensions , the
coefficients  of the
Discrete Cosine Transform of are obtained as follows:
 



 󰇧󰇛󰇜
 󰇨󰇧󰇛󰇜
 󰇨
Where the coefficients and are defined as follows:




And the coefficients 
of the inverse Discrete Cosine Transform of the matrix
󰇟󰇠 with dimensions are obtained as follows:
 



 󰇧󰇛󰇜
 󰇨󰇧󰇛󰇜
 󰇨
6. Low-Pass Filter
It is a smoothing filter that attenuates or eliminates the gain
of the high-frequency components and only keeps the low-
frequency components unaltered (allows the low frequencies to
pass), [9]. It is very effective in eliminating noise in images
since these have high frequencies. high in noisy areas due to
the sudden change in the RGB values of the noisy pixels and
their neighboring pixels. This filter defines a function
based on a cutoff frequency that filters points in the
frequency plane by evaluating their distances from the origin.
To do this, the function is defined as follows:
󰇛󰇜
The filter is executed following these steps:
1. Input: Read the image to be filtered.
2. Save the size of the input image in pixels in the
processor's memory.
3. Perform the Fourier transform of the image.
4. Assign a value to the cutoff frequency .
5. Define the low-pass filter function and establish the
mesh on the frequency plane of the image where it
will be defined.
6. Convolve the Fourier transform of the input image
with the filtering mask .
7. Take the inverse Fourier transform of the convolved
image.
8. Output: Display the resulting image.
6.1 Ideal Low-Pass Filter
It is the simplest one. This filter allows signals with
frequencies lower than or equal to the cutoff frequency to pass
through and rejects those with frequencies higher than the
cutoff frequency, [10]. The function is defined as follows:
󰇛󰇜󰇛󰇜
󰇛󰇜
In Figure 2, you can observe the graph of the function
with respect to the mesh on the image and with respect to the
distance between the point in the image where the function
is evaluated and the origin of coordinates in the frequency
plane of the image. Therefore, when performing the
convolution mentioned in step 6 of this filter's algorithm, it
will only affect the points in the image that are located at the
base of the cylinder in the first graph of this figure.
Fig. 2 Perspective plot of an ideal low-pass filter transfer function and
the radial cross-section of the filter
6.2 Butterworth Low-Pass Filter of Order
It is a type of smooth maximum attenuation filter, which
means it has a gradual attenuation rather than a sharp
attenuation at frequencies above the cutoff frequency.
Therefore, it produces a nearly constant response until it
approaches the cutoff frequency closely enough and then
begins to decrease at a rate of  per octave. This makes
the filter suitable for applications where a smooth transition
between pass and attenuated frequencies is desired. This filter
is widely used in various applications, including signal
processing, system control, and noise removal, [11]. The
function is given by:
MOLECULAR SCIENCES AND APPLICATIONS
DOI: 10.37394/232023.2024.4.10
Irla Mantilla, Mihael Arce
E-ISSN: 2732-9992
113
Volume 4, 2024
󰇛󰇜
󰇡󰇛󰇜
󰇢
In Figure 3, you can see the graph of the function with
respect to the mesh on the image, and in Figure 4, you can
observe the graph of the function with respect to the distance
between the point in the image where the function is
evaluated and the origin of coordinates in the frequency plane
of the image for orders 1 to 5:
Fig. 3 Perspective plot of a Butterworth low-pass filter transfer
function of order n
Fig. 4 Graph of the radial cross-section of the Butterworth low-pass
filter of order n
6.3 Gaussian Low-Pass Filter
This filter is commonly used for image smoothing. The
filter works by averaging the pixel intensity values in an image
within a certain neighborhood radius around each pixel. This
results in a less detailed and less noisy image, although it can
also make the image appear less sharp. It is also used as a
preprocessing step for other image-processing operations such
as edge detection and image segmentation. This filter has a
frequency response that is a Gaussian function and allows low
frequencies to pass while attenuating higher frequencies, [10].
In this filter, the function is given by:
󰇛󰇜󰇛󰇜󰇛
󰇜
In Figure 5, you can observe the graph of the function
with respect to the mesh on the image and with respect to the
distance between the point in the image where the function
is evaluated and the origin of coordinates in the frequency
plane of the image.
Fig. 5 Perspective plot of a Gaussian low-pass filter transfer function
and the radial cross-section of the filter
7. IMPLEMENTATION
When we double the dimensions of a radiograph of IPF
using a Matlab code that follows a method for enlarging
images based on spatial interpolation through the frequency
domain, we find that the resolution of the radiograph is
maintained even after enlargement, as can be seen by
comparing Figure 6, [13], with Figure 7. This process has
already been successfully tested on other images before and is
carried out with the aim of improving the visualization of
certain areas of the image:
Fig. 6 Original image of an Idiopathic Pulmonary Fibrosis X-ray,
[13].
Fig. 7 Here is the result of enlarging the image from the previous
figure to four times its area using spatial interpolation methods based
on the Fast Fourier Transform (FFT) and Discrete Fourier Transform
(DFT) for an Idiopathic Pulmonary Fibrosis X-ray.
When compressing the image from Figure 6 using the
Discrete Cosine Transform (DCT) method, the result shown in
MOLECULAR SCIENCES AND APPLICATIONS
DOI: 10.37394/232023.2024.4.10
Irla Mantilla, Mihael Arce
E-ISSN: 2732-9992
114
Volume 4, 2024
Figure 8 is obtained. This method is performed to reduce the
image's file size.
Fig. 8 Result of applying image compression based on DCT while
retaining 777 coefficients and achieving a compression ratio of 5/4 to
an Idiopathic Pulmonary Fibrosis X-ray.
When comparing Figure 9, [14], with Figure 10, Figure 11,
and Figure 12, you can see the result of applying the ideal,
Butterworth of order 3, and Gaussian Low-Pass filters,
respectively, with a cutoff frequency of 90 Hz to an Idiopathic
Pulmonary Fibrosis X-ray with the “salt and pepper” noise.
Fig. 9 Idiopathic Pulmonary Fibrosis X-ray with "salt and pepper"
noise, [14].
Fig. 10 Effect of the ideal low-pass filter with a cutoff frequency of 90
Hz on an Idiopathic Pulmonary Fibrosis X-ray with “salt and pepper
Fig. 11 Effect of the Butterworth low-pass filter of order 3 with a
cutoff frequency of 90 Hz on an Idiopathic Pulmonary Fibrosis X-ray
with “salt and pepper"
Fig. 12 Effect of the gaussian low-pass filter with a cutoff frequency
of 90 Hz on an Idiopathic Pulmonary Fibrosis X-ray with “salt and
pepper"
8. Conclusion
Algorithms based on the Fast Fourier Transform were
successfully developed to correct errors in digital images. As a
result, an Idiopathic Pulmonary Fibrosis X-ray was amplified
using the method of two-dimensional Discrete Fourier
Transform, as shown in Figure 6. Compression of an Idiopathic
Pulmonary Fibrosis X-ray was achieved through the Discrete
Cosine Transform (DCT), as demonstrated in Figure 7.
Additionally, noise was effectively reduced in an Idiopathic
Pulmonary Fibrosis X-ray using low-pass filters, as shown in
Figures 8, Figure 9, and Figure 10. Therefore, digital images
were created by applying algorithms in Matlab to Idiopathic
Pulmonary Fibrosis X-rays, contributing to improved
diagnosis.
References
[1] Carfì A, Bernabei R, Landi F, Gemelli Against COVID-19 Post-Acute
Care Study Group. Persistent symptoms in patients after acute COVID-
19. JAMA. 2020;324(6):603-605.W.-K. Chen, Linear Networks and
Systems (Book style). Belmont, CA: Wadsworth, 1993, pp. 123–135.
[2] Nalbandian A, Sehgal K, Gupta A, Madhavan MV, McGroder C,
Stevens JS, et al. Post-acute COVID-19 syndrome. Nat Med.
2021;27(4):601-615.
[3] Manta, B., Sarkisian, A. G., Garcia-Fontana, B., & Pereira-Prado, V.
(2022). Pathophysiology of COVID-19. *Odontoestomatología,
24*(39), e312. Retrieved from:
https://doi.org/10.22592/ode2022n39e312
[4] Raghu G, Remy-Jardin M, Myers JL, et al. Diagnosis of idiopathic
pulmonary fibrosis: an Official ATS/ERS/JRS/ALAT Clinical Practice
Guideline. Am J Respir Crit Care Med. 2018;198(5):e44-e68.
[5] Kreuter M, Swigris J, Pittrow D, et al. The clinical course of idiopathic
pulmonary fibrosis and its association to quality of life over time:
longitudinal data from the INSIGHTS-IPF registry. Respir Res.
2019;20(1):59.
[6] Lowe DG. Distinctive image features from scale-invariant key points.
Int J Comput Vision. 2004;60(2):91-110.
[7] González RC, Woods RE. Digital Image Processing. Pearson
Education; 2008.
[8] Esqueda JJ, Palafox LE. Fundamentals of image processing.
Universidad Autónoma de Baja California; 2005. Available at:
https://www.academia.edu/9729833/Fundamentos_de_Procesamiento_d
e_Imágenes_Evento_CONATEC_2002 (pp. 15-24).
[9] Smith SW. Applications of the DFT. En: Smith SW, editor. Digital
Signal Processing. Newnes; 2003. p. 169-184. DOI: 10.1016/B978-0-
7506-7444-7/50046-7
[10] Ramírez L, Rodríguez M. Comparative analysis of low-pass filters:
Ideal, Butterworth, and Gaussian. Revista de Procesamiento de Señales.
2018;12(2):45-58. DOI: 10.1016/j.rps.2017.12.004
MOLECULAR SCIENCES AND APPLICATIONS
DOI: 10.37394/232023.2024.4.10
Irla Mantilla, Mihael Arce
E-ISSN: 2732-9992
115
Volume 4, 2024
[11] Zhang H, Chen W. Evaluating the performance of low-pass filters:
Ideal, Butterworth, and Gaussian. IEEE Trans Signal Process.
2020;68:287-301. DOI: 10.1109/TSP.2019.2948276
[12] Ley B, Collard HR, King TE Jr. Clinical course and prediction of
survival in idiopathic pulmonary fibrosis. Am J Respir Crit Care Med.
2011;183(4):431-440.
[13] Giménez Palleiro A, Franquet T. Figure 13: CTMD reconstructed
image in the coronal plane in a patient with sarcoidosis, showing
micronodular involvement predominantly in the middle and upper
fields, associated with septal thickening. In: Radiological Patterns in
Interstitial Lung Disease. Elsevier; 2013. DOI:
10.1016/j.semreu.2013.05.002
[14] Neumología Peruana. (n.d.). Idiopathic pulmonary fibrosis: Now it is
possible to diagnose through tomography. In Diagnosis of Idiopathic
Pulmonary Fibrosis by Tomography (HRCT). Retrieved from:
Diagnosis of pulmonary fibrosis - First steps (neumologiaperuana.com)
MOLECULAR SCIENCES AND APPLICATIONS
DOI: 10.37394/232023.2024.4.10
Irla Mantilla, Mihael Arce
E-ISSN: 2732-9992
116
Volume 4, 2024
Contribution of Individual Authors to the
Creation of a Scientific Article (Ghostwriting
Policy)
The authors equally contributed in the present
research, at all stages from the formulation of the
problem to the final findings and solution.
Sources of Funding for Research Presented in a
Scientific Article or Scientific Article Itself
No funding was received for conducting this study.
Conflict of Interest
The authors have no conflicts of interest to declare
that are relevant to the content of this article.
Creative Commons Attribution License 4.0
(Attribution 4.0 International, CC BY 4.0)
This article is published under the terms of the
Creative Commons Attribution License 4.0
https://creativecommons.org/licenses/by/4.0/deed.en
_US