next up previous contents
Next: Volume Objects Up: Volume Previous: Volume Data Layout   Contents


Volume Access - Iterators

We now present a more elaborate API to access the data voxels. Seperating data layout and access was a design decision in OpenVL which provided a lot of flexibility.

To give access to voxels in the data, we use iterators. An iterator is a concept in C++ used extensively by the standard template library [14]. An iterator is defined as an object that moves through a container of other objects and selects them one at a time, while hiding the implementation of that container. In our case, the container is the volume data stored in different layouts.

Figure 4: Data access using iterators in OpenVL.
\includegraphics[width=310pt]{images/iterator-overview.eps}

Figure 4 shows the design of iterators in OpenVL. The base for all iterators in OpenVL is the Volume Access API also known as the Iterator API. Any iterator in OpenVL implements this API. An iterator can be implemented for every data layout supported in OpenVL. Such iterators are given direct access to the data in the layout (Figure 2) to allow the most optimized access to the voxel data. For example, the Linear Iterator has direct access to the data stored in Linear Layout and implements the Iterator API to provide optimized access to the voxels stored in the layout.

Other than the iterators which are implemented for the data layouts, there are two special iterator implementations in OpenVL which are independent of the layouts: the Generic iterator and the VirtualCall iterator. The Generic iterator can be used to access data in a layout when there is no iterator specific to that layout. This iterator uses the minimal access API provided by the data layout API (Section 3.1) to access the data stored in the layout. This iterator can be useful when implementing a new layout. The new layout can be tested without actually implementing a native interator for it. This interator can also be useful in cases where a native iterator does not provide any significant performance gains.

The VirtualCall Iterator is responsible for abstracting the layout specific iterators from the user applications. This iterator acts like an interface between the Iterator API calls from user applications and the Iterator API of the layout being used. Any Iterator API calls received by this iterator are piped to the corresponding call of the underlying layout's native iterator or the generic iterator in the absense of a native iterator. Since this is done at run time, the user applications can work with volumes in any layout without needing a recompile. We will talk more about this special iterator when we look at its implementation in the following sections.

Iterators in OpenVL are designed so that they always point to a voxel in the volume. They can be moved around the volume to point to any other voxel. The iterator API is carefully chosen to give quick and easy access to the voxel data and the data stored in the neighboring voxels. The iterator can be divided into three categories:

It is also important to note that the Iterator API is the minimal API that each iterator has to implement. It is possible however to extend the API if a specific iterator needs to. For example, a layout might want to provide additional functions to access the data. In this case however, the user application will need to know the kind of layout and the iterator being used.


next up previous contents
Next: Volume Objects Up: Volume Previous: Volume Data Layout   Contents
Sarang Lakare 2002-12-23