Digital image processing method employing histogram peak detection
TECHNICAL FIELD 
     This invention relates to the field of digital image processing, and more particularly to a method for processing a digital image to automatically detect peaks in a gray-level histogram of the digital image. A knowledge of the location of the peaks in the histogram is useful in selecting gray level thresholds for segmenting the digital image into distinguishable structures. 
     BACKGROUND ART 
     In digital image processing, and particularly in digital radiography, various image processing methods have been applied to the digital image to increase the diagnostic usefulness of the image. For example in the field of chest radiography, the goal of these image processing methods is to reproduce faithfully or to enhance the detail in both the lungs and the mediastinum in spite of their often large differences in subject contrast. However, when these image processing methods are applied to the entire digital radiographic image, the resulting enhancement in the lung field may be destructively high, potentially decreasing the detectability of small lesions. To overcome this problem, anatomical structure-selective processing of chest radiographs is desirable to prevent the detrimental effects to one structure from outweighing the improvement to another structure. 
     McAdams et al (see &#34;Histogram Directed Processing of Digital Chest Images&#34; by H.P. McAdams et al, Investigative Radiology, March 1986, Vol. 21, pp. 253-259) have discussed anatomical-structure selective image processing as applied to digital chest radiography. They used the lung field and the mediastinum histograms individually to determine a lung/mediastinum gray level threshold. The individual histograms for the lung field and the mediastinum were constructed by a trackball-driven cursor outlining technique. The gray level threshold was selected from the gray levels at which the two histograms overlap. McAdams et al. presented impressive results of anatomical structure-selective image processing guided by a lung/mediastinum gray level threshold. However, their method for determining the gray level threshold required human intervention, and therefore it was impractical for routine application. Rosenfeld and De La Torre (see &#34;Histogram Concavity Analysis as an Aid in Threshold Selection&#34;, IEEE Transactions on Systems Man and Cybernetics, Vol. SMC-13, 1983) proposed an algorithm that used the image histogram concavity to automatically determine a gray level threshold for the images containing at most two major gray level subpopulations. Although capable of being automated, their method is very noise sensitive. Furthermore, the threshold determined by this method always lies closer to the tallest peak in the histogram which does not prove to be satisfactory for chest radiography in general. 
     Another problem encountered in the effort to automate the process of image segmentation is the difficulty in determining whether and where a peak in the histogram is actually located. This problem is aggravated by the presence of noise in the image, which causes the peaks to appear as clusters of spikes. 
     It is therefore the object of the present invention to provide an improved digital processing method for automatically detecting peaks in the histogram of a digital image and a method of selecting gray level thresholds for segmenting a digital image into distinquishable structures, that is free from the shortcomings noted above. 
     DISCLOSURE OF THE INVENTION 
     The object of the invention is achieved by a digital image processing method for automatically detecting peaks in a gray level histogram of the digital image characterized by applying smoothing and differencing operators to the gray level histogram to generate a peak detection function wherein positive to negative zero crossings in the function represent the start of a peak, and a maximum of the function following such a positive to negative zero crossing represents the end of a peak. Gray level thresholds are set at gray levels between the detected peaks. 
    
    
     BRIEF DESCRIPTION OF THE DRAWINGS 
     FIG. 1 is block diagram showing digital image processing apparatus useful for practicing the digital image processing method of the present invention; 
     FIG. 2 is a histogram of a typical chest radiograph; 
     FIG. 3 is a graph showing the cumulative distribution function of the digital image represented by the histogram in FIG. 2; 
     FIG. 4 is a graph illustrating the form of the smoothing and differencing operations employed in one mode of practicing the present invention; 
     FIG. 5 is a graph showing a peak detection function generated by a smoothing window of width 541; 
     FIG. 6 is a graph showing the peak detection function generated by a smoothing window of width 271; 
     FIG. 7 is an enlarged view of the histogram shown in FIG. 2, illustrating the locations of the detected peaks for a smoothing window of width 541 and 271 respectively; 
     FIG. 8 is a flow chart of a generalized peak detection method according to the present invention; and 
     FIG. 9 is a histogram of a digital radiographic image of human hands. 
    
    
     MODES OF CARRYING OUT THE INVENTION 
     FIG. 1 is a schematic diagram illustrating digital image processing apparatus useful for practicing the method of the present invention. The apparatus includes a scanning input portion which may comprise, for example, a drum scanner 10 for scanning transparencies such as conventional film radiographs. The drum scanner 10 includes a transparent drum 12 on which the radiograph 14 is mounted. A light source 16 is provided inside the drum to illuminate a spot on the radiograph. A photo sensor 18 receives the light signal modulated by the radiograph 14. The drum 12 spins on its axis in the direction of arrow A to form line scans, and the light source and sensor are moved relative to the radiograph in the direction of arrow B to form the scan raster. 
     The analog signal detected by the photosensor 18 is amplified by an amplifier 20 and is converted to a digital signal by an analog to digital converter 22. The scanning input portion of the digital image processing apparatus may also comprise a stimulable storage phosphor radiographic imaging system of the type shown in U.S. Pat. No. 3,859,257 issued to Luckey, January 1975 reissued as U.S. Pat. No. Re. 31,847, Mar. 12, 1985. 
     The digital radiographic signal is stored in a memory 24 and is processed by a digital image processing computer 26. The digital image processing computer 26 may comprise a general purpose digital computer, or a special purpose digital computer designed specifically for processing images. The digital image processing computer performs operations on a digital image, such as tone scale adjustment, and edge enhancement according to well known digital image processing methods. The processed digital image is converted to a video signal by signal processing electronics and video encoder 28 and is displayed on a video monitor 30. 
     Alternatively, the digital image is displayed by producing a film image on output scanning apparatus 32. The output scanning apparatus comprises a digital to analog converter 34 for converting the processed digital image signal to an analog signal, an amplifier 36 for amplifying the analog image signal, and a light source 38 modulated by the analog signal. Light source 38 is focused to a spot by a lens 40 onto a photosensitive medium such as photographic film 42 on a spinning drum 44. The various elements of the digital image processing apparatus communicate via a data and control bus 46. 
     FIG. 2 is a histogram plot compiled from a typical chest radiograph that was scanned and digitized by apparatus such as shown in FIG. 1. The digital image signal was a 12 bit 1250×1400 pixel image. As can be seen from FIG. 2, it is not readily apparent from visual observation of the histogram, which cluster of peaks in the histogram belong to the lungs, and which to the mediastinum. The plot shown in FIG. 2 is typical of a histogram from a chest radiograph and illustrates the difficulty of selecting a gray level threshold between the lungs and mediastinum. 
     The inventors have found, through experimentation, that a gray level threshold between the portions of the histogram representing the lung and mediastinum may be reliably selected by the method of the present invention. The method involves the steps of applying smoothing and differencing operations to the histogram to produce a peak detection function wherein a positive to negative zero crossing in the function indicates the beginning of a peak, and a maximum occurring after such a positive to negative crossing represents the end of a peak. According to one mode of practicing the invention, the peak detection function is generated by forming the cumulative distribution function F(n) of the gray levels in the image where ##EQU1## h(n) is the image histogram and n represents the gray levels in the image 0≦n≦2 N  -1 where N is the number of bits used to represent the digital image (e.g. N=12). A plot of F(n) from the histogram of FIG. 2 is shown in FIG. 3. 
     Next, the cumulative distribution function F(n) is smoothed by applying a sliding window average having a width w to produce a smoothed cumulative distribution function F w  (n). The peak detection function r(n) is generated by subtracting the smoothed cumulative distribution function F w  (n) from the original cumulative distribution function F(n) as follows: 
     
         r(n)=F(n)-F.sub.w (n)                                      (2) 
    
     The resulting function r(n) is a function having positive to negative zero crossings that correspond to the beginnings of peaks in the histogram, and maxima corresponding to the ends of the peaks in the histograms. 
     Alternatively, the peak detection function r(n) can be computed directly from the histogram h(n) by the following convolution 
     
         r(n)=q.sub.w (n)*h(n) 
    
     where q w  (n) is a function that can be expressed as the convolution of a &#34;smoothing&#34; kernel s w  (n) and a &#34;differencing&#34; kernel d(n) as follows: 
     
         q.sub.w (n)=d(n)*s.sub.w (n)                               (4) 
    
     where ##EQU2## a plot of q w  (n) for a window size of w=13 is shown in FIG. 4. 
     FIG. 5 shows the peak detection function r(n) generated from the histogram of FIG. 1 using a smoothing window w, 541 samples wide. In FIG. 5, 
     a i  --is a positive to negative zero crossing, and indicates the gray level at which the ith peak starts 
     b i  --is a maximum after the ith positive to negative zero crossing and indicates the gray level at which the ith peak ends. 
     The pair (a i , b i ) characterizes the ith peak detected. 
     FIG. 6 shows the peak detection function r(n) generated with a window size w, 271 samples wide. 
     In the following description of the signal processing method, 
     p(n)--represents the percentage of the total number of gray levels confined to the interval [o, n] (p(n)=100 F(n)) 
     n T  --represents the gray level threshold between the lung and the mediastinum 
     d--is an empirically derived constant representing the minimum separation in gray levels between two clusters of peaks 
     n Max  --is the largest gray level present in the image. 
     The steps in the signal processing method for selecting the lung/mediastinum gray level threshold will now be described in pseudo-Fortran. This description is sufficient to enable a computer programmer of ordinary skill in the art to implement the method in a general purpose digital computer or a special purpose image processing computer. 
     
         ______________________________________                                    
STEP NO.                                                                  
______________________________________                                    
0.      j = 1                                                             
1.1.    Compute .sup.--F.sub.w (n) with w = w.sub.j                       
1.2.    Form r(n) = F(n) - .sup.--F.sub.w (n), or q.sub.w (n) * h(n)      
1.3.    Histogram peak detection: To detect peaks                         
        of the histogram consider the zeros and the                       
        local maxima of r(n). A zero-crossing to                          
        negative values indicates the start of a                          
        peak, i.e., the gray level at which the                           
        crossover occurs is a.sub.i. Similarly, the                       
        next zero-crossing to negative values at the                      
        gray level a.sub.i+1 (a.sub.i+1 &gt;a.sub.i) indicates               
        the start of the (i+1)th peak. The gray                           
        level b.sub.i, a.sub.i &lt;b.sub.i &lt;a.sub.i+1, at which              
        r(b.sub.i) = Max [r(n)],a.sub.i &lt; n &lt; a.sub.i+1,                  
        determines the end point of the peak (see                         
        FIG. 5). That is, the ith peak is                                 
        characterized by the pair (a.sub.i, b.sub.i), and                 
        the (i+1)th by (a.sub.i+1, b.sub.i+1) and so on.                  
        When the peak detection function has a                            
        negative value at n=o, it is assumed that                         
        the start of the first peak a.sub.1 is at zero.                   
1.4.    Terminate the search for the peaks at the                         
        gray level n.sub.S. n.sub.S is determined from                    
         p(n.sub.Max -1) - P.sub.S = p(n.sub.s) (5)                       
        In other words, it is assumed that there                          
        does not exist a prominent detectable peak                        
        in the range where the upper P.sub.S percent                      
        (excluding the background level at n.sub.Max)                     
        of the gray levels are confined. The value                        
        of the parameter P.sub.S is determined                            
        empirically by studying various chest                             
        histograms.                                                       
        Note: If n.sub.s is reached after a                               
        zero-crossing to negative values but before                       
        the next zero-crossing to negative values,                        
        then the end point of the last peak                               
        (a.sub.K.sbsb.1, b.sub.K.sbsb.1) is taken to be n.sub.s i.e.,     
        b.sub.K.sbsb.1 = n.sub.s. At this point a set of peaks A          
        defined by A .sup.Δ = {(a.sub.i, b.sub.i) : i = 1,2, . . .  
        ,K.sub.1 }                                                        
        where 0 ≦ a.sub.i ≦ 2.sup.N - 1 and 0 ≦      
        b.sub.i                                                           
        ≦ 2.sup.N -1, is obtained.                                 
1.5.    Preprocessing: If a.sub.i+1 -b.sub.i &lt; m, for                     
        any i = 1,2, . . . ,K.sub.1 -1 then (a.sub.i, b.sub.i) and        
        (a.sub.i+1, b.sub.i+1) are combined into a single                 
        peak to form (a.sub.i, b.sub.i+1). In this case                   
        the set A becomes:                                                
        A = {(a.sub.i, b.sub.i) : i=1,2, . . . K.sub.2 } (K.sub.2         
        ≦ K.sub.1).                                                
        Parameter m is a constant that is determined                      
        experimentally.                                                   
1.6.    Significance test: If the percentage of the                       
        gray levels confined to the peak (a.sub.i,                        
        b.sub.i), i =  1,2, . . . K.sub.2 is less than a certain          
        value P.sub.sig, i.e., p(b.sub.i) - p(a.sub.i) &lt;                  
        P.sub.sig, then the peak is considered to be                      
        insignificant and it is excluded from the                         
        set A. Thus for L (L ≧0) insignificant                     
        peaks A becomes:                                                  
         A = {(a.sub.i, b.sub.i) : i = 1,2, . . . K.sub.3 }               
         where K.sub.3 = K.sub.2 - L                                      
        P.sub.sig is a value that is determined                           
        experimentally.                                                   
1.7.    Classification: the peaks are classified                          
        into clusters as follows:                                         
         (a.sub.1, b.sub.1) belongs to the first cluster.                 
(i)     i = 2                                                             
(ii)    IF (a.sub.i -b.sub.i-1 &lt; d) THEN (a.sub.i, b.sub.i) and           
        (a.sub.i-1, b.sub.i-1) belong to the same cluster                 
        ELSE (a.sub.i, b.sub.i) belongs to the next                       
        cluster; a.sub.i is the starting value of the                     
        next cluster,                                                     
         where d is a constant determined                                 
         experimentally.                                                  
(iii)   i = i + 1                                                         
(iv)    IF(i ≦ K.sub.3) GO TO (ii)                                 
        STOP                                                              
1.8.    Decision: threshold selection                                     
1.8a.   If the peaks are classified into two                              
        clusters then the lung/mediastinum threshold                      
        is set to a gray level n.sub.T which lies                         
        between the end point of the first cluster                        
        and the starting point of the second                              
        cluster, that is                                                  
        n.sub.T = int [μb(1) + (1-μ)a(2)], 0 ≦ μ ≦ 
        1, (6)                                                            
        where int[.] is the nearest integer                               
        truncation function, a(2) is the starting                         
        point of the second cluster, and b(1) is the                      
        end point of the first cluster. (Starting                         
        point of a cluster is defined to be the                           
        starting point of the first peak classified                       
        to that cluster. Similarly, end point of a                        
        cluster is defined to be the end point of                         
        the last peak classified to that cluster).                        
1.8b.   If the peaks are classified into more than                        
        two clusters, the separation in gray levels                       
        between each successive clusters is                               
        computed. The pair with the largest                               
        separation is selected and the threshold is                       
        set to a gray level n.sub.T that lies between                     
        this pair, i.e.,                                                  
        n.sub.T = int [μb(l) + (1-μ)a(l+1)], 0 ≦ μ        
        ≦ 1, (7)                                                   
        where Max [a(x+1)-b(x)] = a(l+1) - b(l).                          
         x=1,2, . . . ,M                                                  
        (M is the total number of clusters).                              
1.8c.   If only one peak is detected (K.sub.3 =1)                         
IF (K.sub.3 =1) THEN                                                      
        IF ([p(n.sub.max -1) - p(b.sub.1)] &lt; P.sub.T) THEN                
          IF ( (j+1) ≦ J ) THEN                                    
           w = w.sub.j+1 = (w.sub.j +1)/2                                 
                         ! process can                                    
                          be repeated                                     
                         ! with a smaller                                 
                          window size                                     
           GO TO STEP 1.1                                                 
          ELSE                                                            
           Histogram is essentially unimodal.                             
           A threshold does not exist.                                    
          END IF                                                          
        ELSE                                                              
          Histogram is essentially unimodal but a                         
          threshold can be set.                                           
          n.sub.T =  b.sub.1                                              
        END IF                                                            
END IF                                                                    
Note: P.sub.T is an experimentally determined                             
percentage criterium. J is a user specified                               
parameter.                                                                
1.8d.   If the peaks are classified into one cluster                      
        (M=1):                                                            
        IF ([p(n.sub.max -1) - p(b.sub.K.sbsb.3)] &gt; P.sub.T) THEN         
        n.sub.T = b.sub.K.sbsb.3                                          
ELSE                                                                      
        IF ( (j+1) ≦ J) THEN                                       
          w = w.sub.j+1 = 2w.sub.j -1                                     
                       ! process can be                                   
                        repeated                                          
                       ! with a larger                                    
                        window size                                       
          GO TO STEP 1.1                                                  
        ELSE                                                              
          Peaks are treated as clusters and                               
          decision is made according to (1.8b).                           
        END IF                                                            
END IF                                                                    
______________________________________                                    
 
    
     The signal processing method was applied to the digital chest radiograph having the histogram shown in FIG. 2. The parameters were set as follows: 
     J=2 
     μ=0 
     N=12 
     w=541, 271 
     P s  =10.0 
     m=15 
     P sig  =1.0 
     d=235 
     P T  =20.0 
     At the end of STEP 1.6 of the method the following sets of peaks were obtained. ##EQU3## The peaks are illustrated on the image histogram in FIG. 7. 
     The signal processing method was tested with various chest radiographs to empirically determine the initial window size w=w 1 , the separation criterion d, and the percentage criterion P T . In almost all cases a threshold was determined without the need to modify the initial window size w=w 1 . 
     The threshold selection method according to the present invention was applied to an assortment of digital chest radiographs to select gray level thresholds between the lungs and the mediastinum. Then various anatomical structure selective image enhancement procedures were applied to the digital chest radiographs using the selected gray level thresholds. The image enhancement procedures included anatomical selective tone scale adjustment and edge enhancement. In these tests, the gray level thresholds automatically selected by the method of the present invention were found to be appropriate and yielded diagnostically useful results. 
     Steps 1.7 and 1.8 of the above method exploit the a priori knowledge of the existence of at most two well-separated (at least by d in gray levels) major histogram clusters corresponding to the mediastinum and the lung field. In general, images can have any number of major structures each of which correspond to a single, or a group of histogram peaks (clusters). The thresholds separating the major structures are then set to gray levels between these peaks. For images other than chest radiographs, the above method can be generalized as follows: steps 1.1 through 1.6 are iterated twice with window sizes w=w 1  and w=w 2  (w 1  &gt;w 2 ) to obtain two sets of peaks: ##EQU4## (K≧I since the sensitivity of the peak detection increases with decreasing window size (see FIG. 7)). Based on selection rules, peaks are selected from these two sets to form a final set C of the so-called `major` peaks. The thresholds are then set to gray levels between the major peaks. 
     The A 2  -intervals (or equivalently the A 2  -peaks), i.e., (c k ,d k )&#39;s may overlap with the A 1  -intervals (or equivalently the A 1  -peaks), i.e., (a i ,b i )&#39;s. If the relative population of the gray levels contained in the overlap exceeds a predetermined value then the overlap is said to be `significant`. Nonoverlapping peaks, or insignificantly overlapping peaks are called `independent` peaks. The overlapping and the independent peaks are determined by the overlap detection procedure described below. The set C of the major peaks is formed via the following rules: 
     R1. An A 1  -peak qualifies for the set C if 
     (i) it is an independent peak, 
     (ii) it is not an independent peak but total number of the significant overlaps that are `major` overlaps is less than t (if an A 2  -peak overlaps significantly with an A 1  -peak then the overlap is a major overlap if the ratio of the number of gray levels contained in the overlap to the total number of gray levels contained in the A 1  -peak exceeds the value R maj ) and t is a predetermined parameter. 
     R2. An A 2  -peak qualifies for the set C if 
     (i) it is an independent peak, 
     (ii) it is not independent and its overlap with the A 1  -peak is a major overlap and the total number of A 2  -peaks that have major overlaps with the A 1  -peak is at least t, 
     (iii) it is not independent and its overlap with the A 1  -peak is not a major one but there exist at least t other A 2  -peaks with major overlaps with that A 1  -peak. In this case adjacent peaks that do not have major overlaps with the A 1  -peak are combined into single peaks. 
     The final set C can be defined as 
     
         C={(e.sub.m,f.sub.m):m=1,2, . . . , M}, 
    
     where (e m ,f m ) ε A 1  U A 2 . The thresholds are then set to gray levels 
     
         n.sub.T.sbsb.1,n.sub.T.sbsb.2, . . . , n.sub.T.sbsb.(M-1) 
    
     where 
     
         n.sub.T.sbsb.P =int{μf.sub.l +(1-μ)e.sub.l+1 },l=1,2 . . . , (M-1) 
    
     and 
     
         0≦μ≦1. 
    
     the overlap detection procedure that determines the overlapping and the independent peaks will now be described in pseudo-Fortran (significant overlaps will be denoted by the `→` sign). 
     
         ______________________________________                                    
2.1. i = 1                                                                
2.2. k = 1                                                                
2.3. IF (c.sub.k ≧ a.sub.i AND b.sub.i &gt; d.sub.k)                  
                           ! A.sub.2 -peak is                             
                            contained                                     
     (c.sub.k,d.sub.k) → (a.sub.i,b.sub.i)                         
                           ! in the A.sub.1 -peak                         
     k = k + 1                                                            
     IF (k &gt; K) GO TO 2.7                                                 
     GO TO 2.3                                                            
     END IF                                                               
     IF (c.sub.k ≦ a.sub.i AND d.sub.k ≧ b.sub.i)           
                           ! A.sub.1 -peak is                             
                            contained                                     
     a.sub.i = c.sub.k     ! in the A.sub.2 -peak                         
     b.sub.i = d.sub.k     ! replace the                                  
                            A.sub.1 -peak                                 
     k = k + 1             ! with the A.sub.2 -peak                       
     IF (k &gt; K) GO TO 2.7                                                 
     GO TO 2.3                                                            
     END IF                                                               
2.4. IF (c.sub.k ≦  a.sub.i ≦ d.sub.k) THEN                 
                           ! (c.sub.k,d.sub.k) overlaps                   
                            with                                          
                           ! (a.sub.i,b.sub.i) from left                  
P.sub.k.sup.L = [P(d.sub.k)-p(a.sub.i)]/[p(d.sub.k)-p(c.sub.k)]           
                           ! left overlap                                 
                            percentage                                    
        IF(P.sub.k.sup.L ≧ P.sub.L)THEN                            
                           ! overlap signifi-                             
                            cance                                         
                           ! check. P.sub.L is the                        
                            left                                          
                           ! overlap signifi-                             
                            cance                                         
                           ! measure                                      
        (c.sub.k,d.sub.k) → (a.sub.i,b.sub.i)                      
        k = k + 1                                                         
        IF (k &gt; K) GO TO 2.7                                              
        GO TO 2.3                                                         
        ELSE                                                              
        (c.sub.k,d.sub.k) is independent                                  
        k = k + 1                                                         
        IF (k &gt; K) GO TO 2.7                                              
        GO TO 2.3                                                         
        END IF                                                            
END IF                                                                    
2.5. IF (c.sub.k  ≦ b.sub.i ≦ d.sub.k) THEN                 
                       ! (c.sub.k,d.sub.k) overlaps with                  
                       ! (a.sub.i,b.sub.i) from right                     
P.sub.k.sup.R = [p(b.sub.i)-p(c.sub.k)]/[p(d.sub.k)-p(c.sub.k)]           
                         ! right overlap                                  
                          percentage                                      
IF (i &lt; I) P.sub.k.sup.L = [p(d.sub.k)-p(a.sub.i+1)]/[p(d.sub.k)-p(c.sub.k
)]                                                                        
                 ! check the possibility                                  
                  of                                                      
                 ! left overlap with                                      
                 ! (a.sub.i+1,b.sub.i+1)                                  
        IF (P.sub.k.sup.R ≧ P.sub.k.sup.L ) THEN                   
                     ! right overlap                                      
          IF (P.sub.k.sup.R ≧ P.sub.R) THEN                        
                       ! overlap signifi-                                 
                        cance                                             
                       ! check. P.sub.R is the                            
                        right                                             
                       ! overlap signifi-                                 
                        cance                                             
                       ! measure                                          
            (c.sub.k,d.sub.k) → (a.sub.i,b.sub.i)                  
            k = k + 1                                                     
            IF (k &gt; K) GO TO 2.7                                          
            GO TO 2.3                                                     
          ELSE                                                            
            (c.sub.k,d.sub.k) is independent                              
            k = k + 1                                                     
            IF (k &gt; K) GO TO 2.7                                          
            GO TO 2.3                                                     
          END IF                                                          
        ELSE           ! left overlap with                                
                        (a.sub.i+1,b.sub.i+1)                             
          IF (P.sub.k.sup.L ≧ P.sub.L) THEN                        
                       ! overlap signifi-                                 
                        cance check                                       
            (c.sub.k,d.sub.k) → (a.sub.i+1,b.sub.i+1)              
            k = k + 1                                                     
            i = i + 1                                                     
            IF (k &gt; K) GO TO 2.7                                          
            GO TO 2.3                                                     
          ELSE                                                            
            (c.sub.k,d.sub.k) is independent                              
            k = k + 1                                                     
            IF (k &gt; K) GO TO 2.7                                          
            GO TO 2.3                                                     
          END IF                                                          
        END IF                                                            
END IF                                                                    
2.6. IF (d.sub.k &lt; a.sub.i) THEN                                          
                      ! (c.sub.k,d.sub.k) lies to the                     
                       left of                                            
     (c.sub.k,d.sub.k) is independent                                     
                      ! (a.sub.i,b.sub.i) with no overlap                 
     k = k + 1                                                            
     IF (k &gt; K) GO TO 2.7                                                 
     GO TO 2.3                                                            
     ELSE             ! (c.sub.k,d.sub.k) lies to the                     
                       right of                                           
                      ! (a.sub.i,b.sub.i) with no overlap                 
IF (i ≧ I) THEN                                                    
                  ! it lies to the right                                  
                   of the                                                 
                  ! last A.sub.1 -peak                                    
        (c.sub.k,d.sub.k) is independent                                  
        k = k + 1                                                         
        IF (k &gt; K) GO TO 2.7                                              
        GO TO 2.3                                                         
END IF                                                                    
DO LL = i + 1, I      ! check for possible                                
                       overlaps                                           
                      ! with upcoming                                     
                       A.sub.1 -peaks                                     
IF (a.sub.LL ≦ d.sub.k ≦ b.sub.LL) THEN                     
                      ! an overlap exists                                 
i = LL                                                                    
GO TO 2.3                                                                 
ELSE                                                                      
CONTINUE                                                                  
END IF                                                                    
ENDDO                                                                     
(c.sub.k,d.sub.k) is independent                                          
                      ! no overlap                                        
k = k + 1                                                                 
IF (k &gt; K) GO TO 2.7                                                      
GO TO 2.3                                                                 
END IF                                                                    
Note:    P.sub.L and R.sub.R are the left and the right                   
         overlap significance criteria respectively.                      
         P.sub.L = P.sub.R = P.sub.O without loss of                      
         generality. P.sub.O is determined                                
         heuristically.                                                   
2.7.     A.sub.1 -peaks that either do not overlap with                   
         any of the A.sub.2 -peaks or overlap with                        
         A.sub.2 -peaks insignificantly are independent                   
         peaks.                                                           
STOP                                                                      
______________________________________                                    
 
    
     The window sizes w 1  and w 2  and the criteria R maj , and t can be determined empirically for the class of images that is of interest. The general threshold-selection technique is illustrated in FIG. 8. The general technique was applied to a radiograph of human hands having the histogram shown in FIG. 9. The parameters were set as follows: 
     μ=0 
     N=12 
     w 1  =541 
     w 2  =271 
     t=1 
     P S  =10.0 
     m=5 
     P sig  =5.0 
     P L  =P R  =P O  =90.0 
     R maj  =0.45 
     The following sets of peaks were obtained with w 1  =541 and w 2  =271: 
     
         A.sub.1 ={(0,1385),(1484,2319),(2436,2902)}(w.sub.1 =541) 
    
     and 
     
         A.sub.2 ={(509,1385),(1496,1744),(1785,2006),(2014,2303),(2428,2623),(2662,2902)}(w.sub.2 =271). 
    
     The set C of major peaks was 
     
         C={(509,1385),(1496,2006),(2014,2303),(2428,2623),(2662,2902)}. 
    
     The corresponding thresholds n T .sbsb.1 =1496, n T .sbsb.2 =2014, n T .sbsb.3 =2428, and n T .sbsb.4 =2662 provided a satisfactory segmentation of the hands radiograph. 
     INDUSTRIAL APPLICABILITY AND ADVANTAGES 
     The present invention provides a method for automatically detecting peaks in a gray level histogram of a digital image, and for selecting the gray level threshold values between distinguishable structures in the digital image. The method is useful in the field of digital image processing, particularly in the field of digital radiography. The method has the advantages that peaks are reliably detected in the presence of noise and gray level threshold values are selected automatically without the need for human intervention, thereby simplifying the digital image processing procedure making it more practical and useful.