Changes between Version 16 and Version 17 of barSoftwareGapFillDetails


Ignore:
Timestamp:
07/28/11 16:33:07 (13 years ago)
Author:
pmajka
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • barSoftwareGapFillDetails

    v16 v17  
    66The most common defect encountered in digital (e.g. PDF) versions of published atlases are gaps in structures' outlines. It commonly happens when two contour lines which should touch are drawn so that they leave a little space in between. Such an arrangement may not be visible in a printed atlas but it greatly disturbs tracing process where every pixel may influence the results. In this case the structure being traced overtakes the space of its neighbour through the broken contour which we call leaking of the structure (see figure below). 
    77 
    8 [[Image(debug_100_99_vBrain_step_0.gif)]] 
     8  [[Image(debug_100_99_vBrain_step_0.gif)]] 
     9 
     10  '''Figure 1''': Examples of gaps in structures contours. 
    911 
    1012Fragment of rasterized contor slide based on Paxinos and Franklin ''The Mouse Brain In Stereotaxic Coordinates, third edition''. 
    1113 
    12 Leaking structures are handled in 3dBAR by ''gap filling'' algorithm, an extension of the basic tracing procedure. The algorithm requires single input parameter – `MaxGrowLevel` describing maximal size of the gaps that will be closed during tracing of a particular area. The algorithm creates multiple (`n=MaxGrowLevel+1`) copies of initial input bitmap, each with the contours expanded using the [http://en.wikipedia.org/wiki/Dilation_%28morphology%29 dilation filter]  approximately by one pixel. 
     14Leaking structures are handled in 3dBAR by ''gap filling'' algorithm, an extension of the basic tracing procedure. 
     15The main idea behind this algorithm is to expand the contours by applying [http://en.wikipedia.org/wiki/Dilation_%28morphology%29 dilation filter] filter until the boundary closes. 
    1316 
    14 [[Image(debug_460_461_VO_step_0-anim.gif)]] 
     17The algorithm requires single input parameter – `MaxGrowLevel` describing maximal size of the gaps that may be closed during tracing of a particular area.  
    1518 
    16 Consecutive flood-filled areas are dilated the same number of times as the boundaries were grown to make the area of the resulting path unbiased. If it remains stable or slightly lowers (less than 2% in our implementation) at consecutive stages of the algorithm it means that most probably the boundaries of the structure in question do not have any gaps (see Fig. 3). 
     19First, the initial bitmap is duplicated. Dilation filter is applied to the copy and the result is 
     20also cached. This procedure is repeated `MaxGrowLevel` times. Each application of the 
     21dilation filter causes the boundaries of the structures to grow approximately 1 pixel in diameter. 
     22As a result, `MaxGrowLevel+1` bitmaps are cached with the first being the rasterized version of the original contour slide (see Figure 2 below). 
    1723 
    18 [[Image(debug_460_461_VO_step_0-anim-AOP.gif)]] 
     24  [[Image(debug_460_461_VO_step_0-anim.gif)]] 
    1925 
    20   '''Figure 3''': Structure without gaps does not express significant changes of its area across different stages of algorithm (see table below). 
     26  '''Figure 2''': Consecutive application of dilation filter to rasterized contour slide. 
     27 
     28Structure areas on each cached bitmap are flood-filled and then dilated the same number of times as the boundaries were grown to ensure that the area of the resulting path stays unbiased. If it remains stable or slightly lowers (less than 2% in our implementation) at consecutive stages of the algorithm it means that most probably the boundaries of the structure in question do not have any gaps (see Fig. 3). 
     29 
     30  [[Image(debug_460_461_VO_step_0-anim-AOP.gif)]] 
     31 
     32  '''Figure 3''': Structure without gaps does not express significant changes of its area across different stages of the algorithm (see table below). 
    2133  ||= growlevel =||= area of the structure in pixels =|| 
    2234  ||  0          ||  51124  || 
     
    2840 
    2941 
    30 [[Image(debug_460_461_VO_step_0-anim-VO.gif)]] 
     42If the reduction of flooded area at certain stage of filter application is grater than defined threshold (15-20% in our implementation), it means that boundary gap must have been closed (see Figure 4 below). After finding the optimal number of border expansions (denoted by `growlevel`) the corresponding bitmap is passed to [http://potrace.sourceforge.net/ PoTrace].  
     43 
     44  [[Image(debug_460_461_VO_step_0-anim-VO.gif)]] 
    3145 
    3246  '''Figure 4''': Structure with gap(s) in it's contour expresses significant changes of its area. 
     
    4155  ||  5          ||  84309  || 
    4256 
    43 If the reduction of flooded area at certain stage of filter application is grater than defined threshold (15-20% in our implementation), it means that boundary gap must have been closed (see Figure 4 above). After finding the optimal number of border expansions (denoted by `growlevel`) and the bitmap is passed to [http://potrace.sourceforge.net/ PoTrace].  
    4457 
    45 The gap filling algorithm is applied individually for each seed label thus different regions may be processed with different value of `GrowLevel`. Information about which `GrowLevel` was used to trace a particular path is stored in its attributes. 
     58The gap filling algorithm is applied individually for each seed label thus different regions may be processed with different value of `growlevel`. Information about which `growlevel` was used to trace a particular path is stored in its attributes. 
    4659 
    4760=== Preconfiguration === 
    4861 
    49 The gap filling algorithm may also be preconfigured during the preparation of a contour slide. Preconfiguration is carried out by assigning `bar:growlevel` 
     62The gap filling algorithm may be preconfigured during the preparation of a contour slide. The preconfiguration is carried out by assigning `bar:growlevel` 
    5063attribute to the label used as the seed for tracing. The value of this attribute 
    5164should be an integer between -1 and `MaxGrowLevel`.  Assigning `-1` means 
    52 that `GrowLevel` is undefined and has to be selected automatically, `0` means 
     65that `growlevel` is undefined and has to be selected automatically, `0` means 
    5366that gap filling should not be used for this particular label. Other values 
    5467denote the number of dilation filter applications.  
     
    5669=== Algorithm efficacy and limitations === 
    5770 
    58 Exemplary result of the gap filling algorithm applied to 47 paths from 13th coronal section (2.1mm ant. from bregma) from Paxinos and Franklin ''The Mouse Brain In Stereotaxic Coordinates, third edition''. 
     71Table below summarizes result of the gap filling algorithm applied to 47 paths from 13th coronal section (2.1mm ant. from bregma) from Paxinos and Franklin ''The Mouse Brain In Stereotaxic Coordinates, third edition''. 
    5972 
    6073||= optimal grow level =||= number of paths =|| 
     
    6376||  2       ||  10  || 
    6477 
    65 The performance of the algorithm depends on the initial size of the structure and on the resolution of input data but in practice, already for structures on the order of diameter around 10 pixels, gap detection works well. Intensive use of this algorithm may distort or even erase the some (particularly narrow) structures. There is no specific mechanism implemented against such behaviour but in practice we have not encountered problems of this type. If a very accurate reconstruction is required, the best policy is to prepare a precise contour slide so there is no need to apply gap filling. 
     78The performance of the algorithm depends on the initial size of the structure and on the bitmap resolution. Intensive use of this algorithm may distort or even erase some (particularly narrow) structures. There is no specific mechanism implemented against such behaviour. If a very accurate reconstruction is required, the best policy is to carefully prepare contour slides adjusting stroke width and slice resterization resolution so there is no need to apply gap filling. 
    6679 
    6780{{{ 
friendster counter