Implementation of Shock Filter for Digital X-Ray Image Processing

X-ray image might be corrupted by noise or blurring because of signal transmission or the bad X-ray lens. This paper presents a two-stage shock filter based on Partial Differential Equations (PDE) to restore noisy blurred X-ray image. Shock filters are popular morphological methods. They are used for noise removal, edge enhancement and image segmentation. Our experimental results show that the performances of shock filter are excellent in X-ray image. The peak signal-to-noise ratio (PSNR) values are 38 dB at least in restoring the noisy X-ray image. The sharpness of image’s edges increase in enhancing the blurred X-ray image. Furthermore, this paper proposes a VLSI architecture for accelerating the high-definition (HD) X-ray image (944 p) process. This paper implements the architecture in FPGA. The hardware cost is low because the computation of shock filter is low complex. To achieve the real-time processing specification, this paper uses a 5-series shock filter architecture to implement computation of HD X-ray image. This paper demonstrates a 944 p, 43.1-fps solution on 100 MHz with 133 k gate counts in Design Compiler, and with 2904 logic elements in FPGA.


Introduction
Shock filters are morphological method, and it "shocks" an image iteratively by dilation and erosion to create ruptures at the edge pixels [1].This process makes shock filters applied to edge enhancement and segmentation.The algorithms are based on PDE.
The original shock filter [2] has been developed in 1990, and it can't remove noise.Therefore, an anisotropic diffusion filter [3] has been proposed to remove the noise.The diffusion can remove not only noise but details of image.However, most of X-ray images are smooth and lack of details.Edge enhancement and segmentation are important for medical image.Shock filter is applicable to process X-ray image.
Furthermore, the portable devices might be applied with X-ray technique.We expect the processing time of shock filter can achieve the real time specification.In this paper, we propose a restoration method of X-ray im-age by using the shock filter.The performances of removing noise show that the method is much better than median filter, and that the value of PSNR and SSIM is very high in any types of noise.
The remainder of this paper is organized as follows.We first present shock filter algorithm in Section 2.Then, we present simulation results in Section 3. Section 4 shows a VLSI architecture.Finally, a conclusion is made in Section 5.

Shock Filter Algorithm
In this section, we will present shock filter algorithm in detail.Firstly, the X-ray images need to be noise-free images.In order to remove noise of X-ray image, we propose an anisotropic diffusion filter, and it's an adaptive smoothing technique.Secondly, shock filter algorithm is proposed for the X-ray image segmentation and enhancement.Finally, a two-stage shock filter is proposed to optimize the result of shock processing.

Anisotropic Diffusion Filter
According to [4], the diffusion is a process that equilibrates differences.The equilibration feature is expressed by Fick's law: The equation shows a flux J which aim to equilibrate differences.The relation between the gradient of pixel value ∇I and J is the diffusion tensor D. The change of pixel value is expressed by the continuity equation: where t is the time.Then, we plug in Fick's law into the continuity equation, and get the anisotropic diffusion equation.There is a typical anisotropic diffusion filter [5], as in: I ηη and I εε are the second-order directional derivatives in the directions of gradient η and contour ε, shown in Figure 1, and can be represented as In the denoising case, preserving the image contour is important.For this reason, we can't diffuse the image crossing the contour, but diffuse the image following the contour direction.For Another reason, the contour direction differences of noise are very large because the noise is usually a spot.

Anisotropic Diffusion Filter
The shock filter processes dilating or eroding around the local maxima or the local minima of pixel value.Iterating this process leads the image to a segmented result, and segments are separated by discontinuities.
The formulation of shock filter [7] equation is: The shock filter performs morphological operators depending on the sign of I ηη .I ηη is positive or negative around the local maxima or the local minima, and the sign changes at the edge of image.The absolute value of I ∇ is the weight.The weight at the extreme pixel is zero, so the extreme value won't change after processing.
In Figure 2, we can observe the signal change with the iterative shock process.
However, the absolute value of I ∇ is not an ideal weight.The weight is too large at the edge, and isn't zero at all local extreme pixel.Then, the local extrema will be created and change after processing, shown in Figure 3.
To avoid the divergent result, we generate weight by using the semi-discrete model [2].The equation is: x I + and x I − are the gradient of pixel's right and left side.If the pixel is the local extrema, the value will  certainly be zero.Moreover, if the gradient is too large, the min mode of semi-discrete model will let x I  to be the smaller value.In Table 1, we can the improvement of weight generation.
According to [8], there are three main features of shock filter.Firstly, the segments of image is separated at the edge.Secondly, the local extrema are unchanged, and none of new local extrema are created.Thirdly, the Final result is constant.

Two-Stage Shock Filter Design
A shock filter design includes two parts, the diffusion part and the shock part.In the general design, the shock filter is a one-stage design, shown in Figure 4, because the parameters of diffusion part and the shock part are same.The one-stage design saves the time of calculating parameters, but processing the diffusion and the shock at the same time can't remove all noise.
Therefore, we design a two-stage shock filter, shown in Figure 5, to improve the problem.At the first stage, we execute the diffusion part to remove all noise.Then, we execute the shock part at the second stage.However, we get a better result, shown in Figure 6, by using two-stage design.

Noise Removal in X-Ray Image
In the simulation of removing noise, we use the traditional median filter and the diffusion algorithm proposed by this paper to compare the results.Two types of noise that we add to the noise-free "hand" X-ray image are Gaussian noise (variance = 0.01) and impulse noise (corrupting 30% of image), and are common in the X-ray image.The results are shown in Figure 7.The verification's method is computing the peak signal-to-noise ratio (PSNR) and structural similarity (SSIM) with the restorative image and the noise-free image.Then, the value of PSNR and SSIM is shown in Table 2.
Figure 7 shows that diffusion filter can remove much more noise than median filter.Table 2 shows that diffusion filter is obviously better than median filter.

Segmentation and Edge Enhancement in X-Ray Image
In the simulation of segmentation and edge enhancement, we apply a Gaussian blur to the "brain" X-ray image, and we process the blurred image with the shock filter.The results are shown in Figure 8, and the histograms of images are shown in Figure 9.
As shown in Figure 8, it can be observed that the perform-ance of edge enhancement is great.Figure 9 shows the blurred image is separated into 3 regions.
Then, we compare the performance with Lucy-Richardson deconvolution (L-R).L-R is a popular deblurring    As shown in Figure 10, the edge detection of shock result is better than L-R result.The processing time of shock filter is 5 times shorter than L-R.The performance of shock filter is better than L-R.

Hardware Architecture
In hardware implementation, the architecture of shock filter is shown in Figure 11.The architecture of image's data FIFO is a 2-SRAM Ping-Pong buffer architecture, shown in Figure 12.Table 3 shows the performance of implementation in FPGA.
We use the look-up table (LUT) to replace the divider.The reason is that lots of denominators aren't used.The synthesis result is compared to the divider of intellectual property core (IP-core), shown in Table 4.
Furthermore, we use the Booth-Folding (B-F) technique [9] to implement the squarer.The synthesis result is compared to the squarer and multiplier of intellectual property core (IP-core), shown in Table 5.
The size of X-ray HD images which we use are 944 × 1276 pixels (944 p), and the number of iterations is 12.The processing time of each frame is 121 ms.To achieve the real time processing specification (30 frame/s), we use the four-series hardware architecture, shown in Figure 13.We spend most time writing and reading dates from SRAM when we process the image.Therefore, we use the four-series hardware design to reduce the frequency of writing and reading dates.The processing time of each frame is reduced by 75 percent.

Conclusion
In this paper, we propose a restoration method of X-ray image by using the shock filter.The performances of removing noise show that the method is much better than median filter, and that the value of PSNR and SSIM is very high in any types of noise.The performances of segmentation and edge enhancement also show that the method is applicable to restore the corrupted X-ray image.In the hardware implementation, the VLSI architecture is very low hardware cost and can achieve the real time processing specification (30 frame/s).

Figure 3 .
Figure 3. Divergent result of shock process.

Figure 4 .
Figure 4. Follow chart of one-stage shock filter design.

Figure 11 .
Figure 11.Architecture diagram of shock filter.

Table 1 .
Comparisons of weight generation.

Table 2 .
Comparisons of restorative result.

Table 3 .
Performance of implementation.

Table 4 .
Comparisons of synthesis result.

Table 5 .
Comparisons of synthesis result.