# A New Adaptive Spatial Filtering Method in the Wavelet Domain for Medical Images
## 2 Materials and Methods
### Algorithm Proposed in This Work  
In the article we propose a spatially adaptive soft Truncation algorithm based on the hierarchical correlation map and with the establishment of the threshold value based on local statistics. The proposed algorithm exploits the intra-scale dependence of the wavelet coefficients by determining the local dispersion of the signal, and the inter-scale dependence is exploited by determining the contours based on the hierarchical correlation map. Results obtained by applying this algorithm show that the reduction of noise in images is achieved and the quality of the contours is maintained or even improved. At the same time, by choosing a parameter, it is possible to establish the compromise between the amount by which the noise is reduced and the quality of preserving the details in the image. The filtering technique proposed by us is based on the fact that the abrupt variations of the pixel intensity in the image determine wavelet coefficients that have high absolute values in several scales, while the noise induces wavelet coefficients that decrease in absolute value with increasing scale. We define the direct spatial correlation of the undecided wavelet transformation on several adjacent scales to accurately determine the locations of contours or other important features in the image:  
\[Corr_{l}(m,n)\ =\ \prod_{i\ =\ 0}^{l-1}w(m+1,n),\ \ \ n\ =\ 1,2,\ldots,N \tag{7}\]  
where \(l\) is the number of scales considered in direct multiplication, \(M\) being the total number of scales, \(N\) is the number of samples in the signal, and \(w(j,n)\) are the wavelet coefficients of the degraded noise signal corresponding to scale \(j\). The absence of contours or other significant features in a particular region will allow background noise to be removed from that region. The direct spatial correlation on several adjacent scales of the data will lead to the precise location of the important contours in the image. If we consider an undecided wavelet decomposition on three levels (so we have three scales), then the direct spatial correlation will be:  
\[Corr_{2}(1,n)\ =\ w(1,n)w(2,n) \tag{8}\]  
Data representing \(\{Corr_{2}(1,n)\}\) are rescaled as a function of \(\{w(1,n)\}\). Figure 1: Wavelet decomposition (blue—lowest resolution sub-band is not processed; red—low resolution sub-bands, corresponding to wavelet decomposition level 3, are processed by soft truncation; green, white—detail sub-bands, corresponding to wavelet decomposition level 2 and 1, are processed based on the significance map). The most important contours are identified by comparing the absolute values of \(Corr_{2}(1,n)\) and \(w(1,n)\). It is assumed that the position \(n\) belongs to a contour if:  
\[\left|Corr_{2}(1,n)\right|>\left|w(1,n)\right| \tag{9}\]  
The \(w(1,n)\) coefficient corresponding to position \(n\), identified as belonging to the contour, is stored in a new matrix \(w_{new}(1,n)\), the contour position is also stored and the value of \(w(1,n)\) is cancelled in the initial matrix. Finally, all determined contours are extracted from \(Corr_{2}(1,n)\) and \(w(1,n)\) by cancelling their values in the locations identified as belonging to contours. We thus obtain two new data sets \(Corr_{2}^{\prime}(1,n)\) and \(w^{\prime}(1,n)\) which form the basis of the next round of contour determination. We proceed further to a new data scaling \(\left\{Corr_{2}^{\prime}(1,n)\right\}\) and a new contour identification. This procedure, consisting of normalization, identification of contour locations, retention and cancellation, is performed iteratively several times until the power of the remaining coefficients in \(\left\{w^{\prime}(1,n)\right\}\) is less than a given value. All contour information contained in the original data that is extracted from \(w(1,n)\) during the iterative process is stored in a new \(w_{new}(1,n)\) vector.