== Typical problems in vector reconstruction and their solutions == Most commonly available 2D atlases were not designed to be used as sources for 3D models generation. Precision of contour definitions and label placement is sufficient for standard use, but not always for the automatic reconstruction process. For example, in some published atlases one may find a number of deliberate simplifications e.g. labels are omitted because names of some areas are considered obvious or labels are literally too large to put them inside the represented area. Such omissions have to be fixed in order to get a correct 3D reconstruction, indeed for any systematic computer processing. [[Image(006__final_comparison.gif)]] === Non-interactive error correction === The vector parser tries to automatically deal with troublesome situations. However, if it is unable to correct a problem automatically, the program will notify the user and save all the important information about the case as a thumbnail image including name of the problematic label and its location. These data help the user to solve the problem manually by removing ambiguities from contour slides. Below we discuss common inconveniences and our strategies for fixing them. === Leaking structures === The most common defect is gaps in structure outlines. It frequently 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 the 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 the spot indicated by a red arrow on Fig.~3A)'''. === Gap filling algorithm === It is handled by a heuristic gap filling algorithm ([wiki:barSoftwareGapFillDetails detailed description]). The main idea behind this algorithm is to expand the contours by applying a [http://en.wikipedia.org/wiki/Mathematical_morphology dilation] filter ([http://www.imageprocessingplace.com/DIP-3E/dip3e_main_page.htm Gonzalez2008]) until the boundary closes. 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. For the atlases we tested, the gap filling algorithm performed well, the reconstructed structures were adequate and the gains in time were tremendous as compared with manual cleaning. [[Image(002__gapfill.gif)]] === Duplicated labels within a single contour === Another common difficulty is an absence of borders drawn within an outline containing multiple labels. This can be a consequence of improper drawing but often simply follows from lack of sharp transitions between structures ('''see cortical areas in Figure...'''). When the parser detects two or more overlapping regions that were created based on different labels such labels are changed to spotlabels in the CAF slide and a notification is logged. Neither path is removed as there is no way to determine which one should be discarded and which should be kept. After tracing, the user is notified about ambiguous delineation and should review the slide in question and correct it. === Labels placed over contours === Error correction procedure also looks for labels anchored directly above contours which may happen when a structure is defined as a thin strip between other structures or placed outside the brain outline. Since tracing contours themselves is not allowed, such incidents are recorded and a thumbnail image is generated allowing user to examine and correct the error. Tracing of a region corresponding to the particular label is skipped but in general tracing is not interrupted as the whole procedure works non-interactively. [[Image(003__invalid_labels.gif)]] === Unlabelled area === Another problem we encountered during tracing was the lack of labels attributed to some areas. 3dBAR vector parser automatically detects such unlabeled regions by comparing the sum of traced paths with the total area of the ''Brain'' structure. The parser locates all contiguous unlabelled regions consisting of more than a given number of pixels and traces them. The resulting structures are called ''Unlabelled'' and may be indexed and reconstructed similarly to the regular structures. [[Image(001__unlabelled.gif)]] [[Image(004__new_edges.gif)]] [[Image(007__final_electrode.gif)]]