International Journal On Advanced Computer Theory And Engineering (IJACTE)
_______________________________________________________________________________________________
Embedded Soft CAM and Farey Sequence for Medical Image Processing
1S. Jagannathan, 2V Niranjana Holla
1,2Department of Computer Science Engineering, APSCE, Bangalore 560082
Abstract- This paper brings out the application of CAM, Implementation of Embedded Software CAM approach and Farey sequence for medical image processing. CAM is a memory that implements the look up table function in a single clock cycle using dedicated comparison circuitry.
Farey sequence approach is used to extract the image features for further processing. The extracted feature from the farey sequence will be saved in a sequential manner in CAM for further processing.
Keywords: CAM content addressable memory, Farey sequence, compressing the Farey table, Image Processing
I. INDRODUCTION
A Content-Addressable Memory (CAM) compares input search data against a table of stored data, and returns the address of the matching data. CAMs have a single clock cycle throughput making them faster than other hardware- and software-based search systems. CAMs can be used in a wide variety of applications requiring high search speeds. These applications include parametric curve extraction, Hough transformation, Huffman coding/decoding,
Lempel–Ziv compression and image coding.
The Farey sequence (of counting fractions) has been of interest to modern mathematicians since the 18th century. This project is an exploration of the Farey sequence and its applications. In the year 1816, John Farey invented an amazing procedure to generate proper fractions lying in the interval [0, 1], called the Farey sequence. Formally defined, the Farey sequence F n of order n is the sequence of simple/irreducible, proper, and less than or equal to n, and are arranged in increasing order of their values. There are several studies and research works related with Farey sequences. The concept is well-known in theory of fractions but from the algorithmic point of view very limited work has been done so far. There are two well- known problems in this area. One is the rank problem:
Given a fraction p/q, find its rank (Fig. 1) in Fn. Another is the order-statistics problem: Given two positive integers’ n and k, compute the k th element of Fn. Both are solvable in O (n log n) time and O (n) space [2, 3].
We show that the rank problem can be solved in O (1) time and O (n2) space using the Farey table, which is an improvement compared toO(n log n) time ,although we require O(n2 ) space. Our technique avoids floating- point operations as they are expensive and introduce truncations errors. Exhaustive testing and in-depth analyses have been made, and some results have been furnished to demonstrate the performance of the proposed algorithm based on Farey table.
II. FAREY SEQUENCE AND FAREY TABLE
2.1 Farey Sequence
The Farey sequence of order n is a sequence of irreducible or simple fractions in [0, 1], which have denominators less than or equal to n, arranged in ascending order. Each sequence starts with the value 0 (0/ 1) and ends with the value 1 (1 /1). Interestingly, each sequence Fn can be generated from its preceding sequence Fn-1 by inserting the fraction (a + a') (b + b') , called the mediant [Sec. 2.2], between each pair of consecutive fractions a b and a' b' of Fn-1, discarding the
fractions whose denominators exceed n, as shown in Fig. 2.
Fig. 2. Generation of Farey sequences up to order 5 in an iterative way. (New terms in each sequence are
highlighted in gray.)
Note that, barring F1, each sequence has an odd number of terms and the middle term is always 1 /2.
2.2 Properties of the Farey sequence
Some of the properties of the Farey sequence, relevant to our work, are discussed below. Their proofs are based on number-theoretic properties and may be seen in [1].
Property 1: For any two successive fractions a b and c d in Fn , b + d ≥ n +1, and bc − ad = 1 for ab < cd.
Property 2: Given any real number x, there is always a nearby fraction a / b belonging to Fn, such that x − a b ≤ 1 (b(n +1)).
Property 3: For a sufficiently large value of n , the number of fractions in Fn is given by 3n2 π 2 ≈ 0.304n2
= Θ(n2 ).
Property 4: The mediant of two fractions a b and c d is defined as μ (a b, c d ) = (a + c) (b + d) , which lies in the interval (a b, c d ). Each fraction in Fn is the mediant of its two neighbors. In fact, the mediant of any two fractions is contained in the Farey sequence, unless the sum of their denominators exceeds n.
Apart from the above properties, another striking property is that the rank of a fraction in a Farey sequence serves a good measure of its numerical value.
A fraction p q of Fn has the rank r if and only if there exist r −1 fractions in Fn, which are smaller than p q (see Fig. 1). Figure 3 shows a few plots on variation of the numerical values of the fractions with their ranks in Farey sequences of different orders. In these plots, barring a few undulations, we can see that the nature of the variation is linear. As the order increases, these undulations are also reduced. Hence, we can say that the ranks are related almost linearly to the numerical values of the fractions. Therefore, given a fraction x y with rank k in Fn containing fmax fractions, we have x/y ≈ k/
fmax. Thus, to compare two fractions we can refer to their ranks in a Farey sequence rather than computing and comparing their exact values.
Fig. 3. Fraction v/s rank plot for F50, F77, F95, F99.
In particular, given two fractions and asked to find whether they are close to one another (within a range), we can avoid floating-point operations and can get an estimate by simply looking at the difference of ranks of the given fractions. It is important to note that this difference of ranks will be relative to the order of the concerned Farey sequence. As mentioned earlier, several methods for generating Fn are known. Evidently, any such algorithm requires at least quadratic time, since Fn has Θ(n2) elements (Property 3). Hence, the rank problem and the order statistics problem are solvable in O(n log n) time and O(n) space. In subsequent discussions, we show how we have used a more structured representation of Fn, namely the Farey table, Tn, to solve the rank problem in O(1) time and O(n2 ) space.
2.3 Farey table
A Farey table Tn for Fn is an (n +1)× n matrix in which each row i, 0 ≤ i ≤ n, represents a numerator and each column j, 1 ≤ j ≤ n, represents a denominator, and Tn (i, j) contains the rank of the fraction i j in Fn. For a fraction i' j ' reducible to i j , we have Tn (i', j') = Tn (i, j). As Fn contains only proper fractions in [0,1] , Tn (i, j) is invalid for i ≥ j . Fig. 4 shows the Farey table T4 of order 4. Note that, if a fraction is in Fn, then we can find its rank from Tn in O(1) time.
Fig. 4. T4 = p q:0≤ p ≤ q ≤ 4 2.4 Some Properties of Farey Table
The Farey table is seen to have some elegant properties.
Some of these properties, which are relevant to our work, are as follows.
Property 5: The sum of the ranks of two fractions, whose sum is unity, is fmax +1.
Proof: For any pair of fractions i j and ( j − i) j of Fn, their corresponding ranks are of the form fi +1 and fmax
− fi .
Property 6: In a Farey table Tn , ranks (of fractions from Fn) decrease from left to right along a row, excepting only the first row whose all fractions have rank 1.
Proof: Along a row, the numerators of all the fractions are i , and the denominators are i, i +1, i + 2,K, n (left to right). So for any two fractions i j1 and i j2 having j1 <
j2 , we get i j1 > i j2 , or, Tn (i, j1) > Tn (i, j2 ).
Similarly, we have: the following property.
Property 7: In a Farey table Tn , ranks along a column increase downwards.
Property 8: Differences between consecutive ranks along a column j in Tn are vertically symmetric with an upward-downward correspondence, i.e.,
Tn (i +1, j) −Tn (i, j) = Tn ( j − i, j) −Tn ( j − i −1, j), 0 ≤ i ≤ j.
Proof: Observe that
Tn (i +1, j) +Tn ( j − i −1, j) = Tn (i, j) +Tn ( j − i, j) = fmax +1,
fmax being the total number of fractions in Fn.
Notice in Fig. 1 that for each such pair of fractions, the sum of their ranks is fmax +1.
2.5 Generation of Farey Table
As explained in Sec. 2.4, we fill up Tn with the ranks of the fractions in Fn. For a fraction i j in Fn, we generate all other equivalent fractions present in Tn (e.g., 2 4, 3 6, Kfrom1 2). We fill their cells with the rank of the original irreducible fraction. The algorithm GenFT (Fig.
5) generates Tn from Fn (array F). For each i j , we updateT[i][ j] , and all the corresponding equivalent cells. Tn is thus prepared from in O(n2 ) time.
Fig. 5: Algorithm GenFT(order: n)
III .CONTENT ADDRESSABLE MEMORY (CAM)
Content-addressable memories (CAMs) are hardware search engines that are much faster than algorithmic approaches for search-intensive applications. CAMs are composed of conventional semiconductor memory (usually SRAM) with added comparison circuitry that enable a search operation to complete in a single clock cycle. The two most common search-intensive tasks that use CAMs are packet forwarding and packet classification in Internet routers. I introduce CAM architecture and circuits by first describing the application of address lookup in Internet routers. Then we describe how to implement this lookup function with CAM.
There are two basic forms of CAM: binary and ternary.
Binary CAMs support storage and searching of binary bits, zero or one (0, 1). Ternary CAMs support storing of zero, one, or don't care bit (0, 1, X). Ternary CAMs are presently the dominant CAM since longest-prefix routing is the Internet standard. Figure 6 shows a block diagram of a simplified 4 x 5 bit ternary CAM with a NOR-based architecture. The CAM core cells are arranged into four horizontal words, each five bits long.
Core cells contain both storage and comparison circuitry. The search lines run vertically in the figure and broadcast the search data to the CAM cells.
The matchlines run horizontally across the array and indicate whether the search data matches the row's word.
An activated matchline indicates a match and a deactivated matchline indicates a non-match, called a mismatch in the CAM literature. The matchlines are inputs to an encoder that generates the address corresponding to the match location.
A CAM search operation begins with precharging all matchlines high, putting them all temporarily in the match state. Next, the search line drivers broadcast the search data, 01101 in the figure, onto the search lines.
Then each CAM core cell compares its stored bit against the bit on its corresponding search lines. Cells with matching data do not affect the matchline but cells with a mismatch pull down the matchline. Cells storing an X operate as if a match has occurred. The aggregate result is that matchlines are pulled down for any word that has at least one mismatch. All other matchlines remain activated (precharged high). In the figure, the two middle matchlines remain activated, indicating a match, while the other matchlines discharge to ground,
indicating a mismatch. Last, the encoder generates the search address location of the matching data. In the example, the encoder selects numerically the smallest numbered matchline of the two activated matchlines, generating the match address 01. This match address is used as the input address to a RAM that contains a list of output ports as depicted in Figure 7. This CAM/RAM system is a complete implementation of an address lookup engine. The match address output of the CAM is in fact a pointer used to retrieve associated data from the RAM. In this case the associated data is the output port.
The CAM/RAM search can be viewed as a dictionary lookup where the search data is the word to be queried and the RAM contains the word definitions. With this sketch of CAM operation, we now look at the comparison circuitry in the CAM core cells.
Figure 6: NOR-based CAM architecture
Figure7: Address lookup with CAM Verilog implementation of CAM:
Since the SOC (system on chip) is a curent implementation technique popularly used, we tried to implement software version of CAM.We coded the functionalities of CAM using Verilog HDL.The snippets code is shown below.
Medical Imaging and Efficacy of Farey Sequence Approach:
In level set methods we propose proposed based on a general piecewise smooth (PS) formulation originally proposed by Mumford and Shah []. These methods do not assume homogeneity of image intensities, and therefore are able to segment images with intensity inhomogeneities. However, these methods are computationally too expensive and are quite sensitive to the initialization of the contour [13], which greatly limits their utilities. In this paper, we propose a novel region- based method for image segmentation. From a generally accepted model of images with intensity inhomogeneities, we derive a local intensity clustering property, and therefore define a local clustering criterion function for the intensities in a neighborhood of each point. This local clustering criterion is integrated over the neighborhood center to define an energy functional, which is converted to a level set formulation.
Minimization of this energy is achieved by an interleaved process of level set evolution and estimation of the bias field. As an important application, our method can be used for segmentation and bias correction of magnetic resonance (MR) images. In the above process the normalization used is expensive which computes the minimum and maximum of the image gray
values and does the fraction consists of the numerator of the difference of the image gray value and minimum of the image and the denominator consists of the difference of the minimum and maximum.
In the signal processing and image coding, some of the operations are of multiplications and some are of fractional arithmetic. It involves usage of more power and floating point operations for applications such as the medical image processing. By having only fixed point implementation and less searching will save the power and reduces the complexity in implementation.
The figure 8 is the original example image of the heart taken for simulation. The figure 9 is Reconstructed Image before Bias Corrected Image; figure 10 is the marked portions for segmentation. Figure 11 is the Segmented Portions of the heart image. The figure 12 is Bias Corrected Image of the Heart through Farey Approach. The figure 13 is Histogram of the original and the bias corrected images of Farey Approach. The figure 14 is Histogram of the heart image after Normalization using Min-Max Method. In the image segmentation and bias correction and the normalization of Gaussian method involves the fraction multiplication and divisions. The normalization involves more power and also the techniques used in [13] consist of more fractional computation. The figure 15 is Histogram of the heart image after Normalization using Farey Sequence Approach. The figure 16 shows the verilog implementation of the CAM and the simulations results.
By using the farey Trees, it can be reduced more than traditional methods which are in vogue. It involves only few searches in the table which is a small table of size 1k bytes. It avoids the floating point arithmetic. First using the farey encoder Tree table is created and the table size is of 99 entries and of 1K bytes.
In this paper we propose CAM use in medical image processing, here we process image using farey sequence to extract image features. The extracted image features saved on to CAM for further processing. When image need to be reconstructed at the decoder, need not compute features of the image again, just by finding match in CAM look table the image can be reconstructed with bare minimum error which is insignificant. Hence we can reduce the computation budget at the decoder side and making the decoder simple and cost effective.
To process the medical image we come across various transform coding methods (KL Transform, FFT, DCT, Wavelet...) which will be in complex in terms of computation, it consumes more time to produce processed output and also consumes more power. The major challenge in medical image processing the computations must happen in real time and most of the medical processing instruments are handheld and battery operated, hence the power consumption to be minimized for the battery life.
Fig 8: Original Image of the Heart
Fig9: Reconstructed Image before Bias Corrected Image
Fig10: Marked for Segmented Portions
Fig11: Segmented Portions
Fig 12: Bias Corrected Image of the Heart through Farey Approach
Fig 13: Histogram of the original and the bias corrected images of Farey Approach
Fig 14: Histogram of the heart image after Normalization using Min-Max Method
Fig 15: Histogram of the heart image after Normalization using Farey Sequence Approach
Fig16: CAM simulation results of Verilog implementation
V. CONCLUSION
This paper brings out the approach of Embedded Software CAM and also shows that the ranks of fractions in the Farey sequence can be used to provide a useful estimation of their relative values. Searching a fraction in the Farey sequence has been improved by using the Farey table. Algorithms to find a fraction closest to any arbitrary fraction in a given Farey sequence are also presented. All the algorithms are devoid of floating-point operations.
REFERENCES
[1] R. Graham, D. Knuth, and O. Potashnik.
Concrete Mathematics. Addison-Wesley, 1994.
[2] C. E. Patrascu and M.Patrascu. Computing Order Statistics in the Farey Sequence, ANTS 2004:
358-366.
[3] J. Pawlewicz, Order statistics in the Farey sequences in sublinear time and counting primitive lattice points in polygons. Algorithmica 55(2): 271-282, 2009.
[4] G. H. Hardy and E. M. Wright. An Introduction to the Theory of Numbers. Oxford University Press, New York, 1968.
[5] E. H. Neville. The Farey Series of Order 1025.
Cambridge University Press, 1950.
[6] P. L. Rosin. Techniques for assessing polygonal approximation of curves. IEEE Trans. PAMI, 19(6): 659-666, 1997.
[7] M. Schroeder. Fractions: Continued, Egyptian and Farey (Chapter 5). Number Theory in Sc. &
Communication, vol. 7, Springer Series in Information Sciences, 2006.
[8] C.-H. Teh and R. T. Chin. On the detection of dominant points on digital curves. IEEE Trans.
PAMI, 2(8):859-872, 1989.
[9] P. Y. Yin. Ant colony search algorithms for optimal polygonal approximation of plane curves. Pattern Recognition, 36:1783-1797, 2003.
[10] K. Wall and P.-E. Danielsson, A fast sequential method for polygonal approximation of digitized curves, Computer Vision, Graphics, and Image Processing, 28:220-227, 1984.