AMI Research Group

AmiLabContours. A Software Tool for Image Structure Segmentation




AmiLabContours can be used freely for research purposes. If you use AmiLabContours to obtain structure segmentation, we just kindly ask you to cite in your publications the following references :

Alemán-Flores M., Alvarez L., Henriquez P.,2010,AmiLabContours: A tool for image structure segmentation, To appear in IADIS Multi Conference on Computer Science and Information Systems 2010.

Alvarez, L., Baumela L. , Henriquez P., Marquez P., 2010. Morphological Snakes. To appear in CVPR 2010 Conference.

L. Alvarez, L. Baumela, P. Marquez-Neila and P. Henriquez. A Real Time Morphological Snakes Algorithm, IPOL:Image Processing On Line, (In this reference you can find an Online Demo as well as the source code of snakes algorithm we use in AmiLabContours )


AmiLabContours is a general purpose tool for segmenting complex image structures. The main novelty of AmiLabContours is the inclusion, in a single software, of sophisticated computer vision tools to segment image structures, like alignment procedures, active contours, filters, etc., and a very friendly, reliable and efficient user interface including 3D geometry structure visualization. We'll show its ability to perform fast, reliable and efficient image structure segmentation. Not only does it allow extracting the boundaries of the structures in quite difficult situations, but it also includes 3D image processing in order to simplify the analysis of image sequences in a series.

In AmiLabContours, we focus on providing the user with some utilities and a friendly interface to select image structures. In order to achieve this goal, we have designed, using WxWidgets platform (see Smar et al., 2005), very flexible tools to create or modify structure contours and we have used active contours techniques (Alemán-Flores et al., 2007, Alvarez et al., 2010) to refine contour location, in such a way that, from a rough approximation of the structure contour, we can automatically refine it to fit properly the structure contour. Since we use a level set approach to adjust active contours, we also represent contours as level sets (i.e., a binary image which is different from zero inside the contour). This representation is also very useful for some contour manipulation tasks, such as adding or subtracting contours.

Using AmiLabContours



  1.1.Aligment of image stack

The usual way to process image sequences and extract the contours of the structures consists of four stages. First, the images in the stack must be aligned, since a certain shift when changing layer is often present. Second, a reference image is selected and an initial approximation is set for the contours of the structures. Third, the contours are modified if necessary using different automatic techniques which allow extracting more accurate results. Finally, the results for the reference image are progressively adapted to the other images in the series. AmiLabContours provides a tool to automatically align the sequences of images as shown in Figure 1. This tool is based on a correlation technique to estimate relative image shift (See Wu, 1995).

Figure 1. Contour of the same structure in two consecutive layers before alignment (left) and after alignment (right)


Sometimes,to perform the segmentation in an easier way, it is useful to apply filters to the image. In AmiLabContours many different filters can be applied. Like opening, closing, line opening, line closing and gaussian convolution.


  2.1.Creating new contours

For the configuration of the initial contour, AmiLabContours provides two different ways. In the first one, a contour is created as a polygon by clicking near the structure boundary and connecting the vertices using straight lines. In the second one, a contour is created by filling its level set using a brush tool to delineate the contour. Figure 2 illustrates both methods.

Figure 2. Creating new contours using a polygon (left) or using a brush (right)

  2.2.Modifying contours

The contours which are manually obtained, both, using the polygonal approximation and using a level set filling, are usually not precise enough for biomedical applications. Therefore, some further processing is often required to correct them. This can be performed in two different ways, manually or using active contours.

2.3.Manual contour modification

In order to manually modify an existing contour, we can use three different tools: The first option consists in dragging the contour points (see Figure 3). This implies adapting the neighborhood of that point so that a certain smoothness in the contour is preserved. The second method is adding a new contour to the existing one (see Figure 4), so that the resulting contour is the union of both. Finally, the third alternative included consists in subtracting a contour from the existing one (see Figure 5).

Figure 3. Dragging contour points: we move a contour point and those within a neighborhood are adjusted to generate a smooth result


Figure 4. Adding contours: we create a new contour starting in a point inside the existing one. Once the new contour is closed, it is added to the previous one


Figure 5. Subtracting contours: we create a new contour starting in a point outside the existing contour, but the new contour must intercept the existing one. Once it is closed, it is subtracted from the existing one

  2.4.Refining contours using active contours

Using manual operations, a quite precise contour can be obtained, but it is a time-consuming task and it is not reproducible, since it is highly user-dependent. For that reasons, some automatic techniques have been included to improve the results with less interaction. AmiLabContours provides three active contours (snakes) tools to automatically refine the contours (see Alvarez et al., 2009 for details). The first option, called center line snake tool, is designed to extract the boundaries of those structures which are surrounded by a dark outline. This tool moves the contour searching for the dark center line of the structure boundary (see Figure 6). The second option, called border snake tool, is aimed at extracting the boundaries of those structures which are highly contrasted with their background or surrounding elements. The contour is moved searching for high-contrast boundary areas (see Figure 7). Finally, the third option, called balloon snake tool, intends to extract the boundaries of homogeneous regions. It moves the contour expanding the initial approximation while the image grey level is similar enough to the mean of the inner region (see Figure 8).

Figure 6. Center line snake: we search for the dark center line in the structure boundary


Figure 7. Border snake: we search for boundaries of high-contrast areas


Figure 8. Balloon snake: we expand the original contour while the grey level is similar.


3.Three dimensional contours

In electron microscopy images, as in some other medical imaging modalities, a series of images are extracted corresponding to different parallel layers of the structures, tissues or organs. Since those layers are usually very close to each other, the variations in the contours of the structures are not very drastic. Therefore, the contours extracted for one of the layers can be used as initial approximation for the previous or next layer, and then improved with the active contours technique or manually.

3.1.Propagating contours across an image sequence

In AmiLabContours, when a contour is propagated, we can automatically apply a refining method using active contours. This action accelerates the segmentation, because it is not necessary to manually readjust the contour. This way, the user can segment an image sequence much faster. In Figure 9, a contour propagation and the automatic refining process with AmiLabContours are illustrated.

Figure 9. Contour propagation in the stack image sequence: both images correspond to the same region in two consecutive layers and the contour in the image on the left is adapted in the image on the right

  3.2.Manual modification of contours

Sometimes,the user prefers to modify the position of a contour by hand. This may happen because the contour is not accurate enough in the new layer or the propagation must be shifted. The user can do this with AmiLabContours by dragging the whole contour, as shown in Figure 10.

Figure 10. Moving the whole contour to compensate image shifting


4.Three-dimensional structure visualization

Once a whole stack has been processed, the structures can be visualized by layers, as shown in Figure 11, assigning a color to each structure, or by means of a three-dimensional reconstruction, as shown in Figure 12. As observed, several structures can be viewed simultaneously, but a single structure can be selected and analyzed independently, as shown in Figure 13. We use OpenGL library to perform 3D structure geometry visualization (see, for instance, Shreiner, 2009).

Figure 11. Example of the segmentation of different structures in the first (left) and last (right) images in a sequence


Figure 12. Example of the three-dimensional reconstruction of different structures obtained from an image stack


Figure 13. Reconstruction of a single structure


5.How to use

We include some videos that show AmiLabContours running, and the steps to segment a sequence and perform the 3D visualization:

  • Aligment tool
  • Original sequence
    Aligned sequence
  • Segmentation with AmiLabContours
  • Recover a contours backup
  • 3D Visualization