wiki:Spatial_Query_Framework
Last modified 12 years ago Last modified on 01/10/07 14:07:18

This is an overview that I wrote as a paper to help focus on paper writing. The description doesn't completely match with what was/will be implemented.

Framework of Spatial Query Services

I. Introduction

Labs are generating more and more volumetric neuroimaging data and want to pose increasingly complex queries on this information. To help accommodate this, we have developed 3 web accessible services for querying this data based on spatial characteristics. This framework consists of 1) a transformation service to convert data-points between anatomical spaces (i.e. magnet coordinates to normalized space), 2) an atlas server that can answer questions about individual points or export atlas surfaces for further processing and 3) a spatial query service that gives researchers the ability to pose complex spatial queries on their own data. These services are designed so that they can be integrated and used in many complex and novel ways by using the XQuery query language as the primary integrator.

While the system would be faster as a monolithic query services running locally, the flexibility offered by using the service based approach outweighs the wasted seconds. Most of the lost efficiency is due to network speeds and the overhead of packing and unpacking the data at both ends. While this is a slight concern, the extensibility and pliability offered by this framework allow researchers to quickly design and perform custom spatial queries. Furthermore, by making the primary integrator a query language, custom queries become much easier to write and tweak.

II. Methods

A. Transformation Service

The transformation service provides a central and interoperable way to warp coordinates and volumes from one set of spatial coordinates to another. It is extensible and can have many different types of transforms, but currently it supports linear and SPM's non-linear warps.

B. Volumetric Atlas Service

C. Spatial Query Service

The spatial query service allows scientists to query 3D and 4D volumetric imaging data. The system exposes the following methods for querying the data:

  1. files(url)
  2. query-stats(server-url, file-list)
  3. query-area(server-url, file-list, region)
  4. query-pnuts(server-url, file-list, region, script)

The server maintains a set of known files and metadata on them, which can be retrieved using method (a). This list can be supplied at startup or if the central list of files is maintained elsewhere, this list will be populated dynamically. In addition to providing a useful directory, the file list gives the server a welcome performance boost. By maintaining a directory of known files, the server only needs to examine available meta data the first time the data-set is seen or if it changes. At that time, we attempt to figure out: the coordinate system of the volume, the duration if it is a time series and the modality. After parsing the metadata, the image is also examined to compute global statistics. These global statistics are exposed through the query-stats method (b). This method can provide quick access to potentially useful measurements such as average intensity, standard deviation, the maximum and minimum and the bounding box of the volume.

For finer grained statistics, the query-area (c) method can be used. This technique computes the same statistics as (b) on the fly for a focused region of interest. The region is specified either by using a simple XML description, an image volume of weights or a url that specifies an image volume. The XML file can specify several simple shapes concisely (figure C1), but in order to specify less regular shapes, a volume must be used. The principal reason to support these complex shapes is to allow researchers to use areas exported by the atlas server described above.

Point at (0, 0, 0, 0): <Point x='0' y='0' z='0' t='0'/>
Sphere with radius 1 at any time: <Sphere x='0' y='0' z='0' t='*' radius='1'> </Sphere>
Box with a Gaussian <Box x='-1, 1' y='-1, 1' z='-1, 1' t='*'><Gausian stddev='1'/></Box>

Fig C1. Example syntax for specifying a simple region.

The final and most powerful query method is query-pnuts, which can process a script written in P-nuts. P-nuts is a simple and concise scripting language for the Java Virtual Machine. It has the advantage of integrating cleanly with the underlying system and yet providing a simpler syntax than Java. The system then provides easy access to the data in the filter region and global statistics. The results are then automatically formatted as XML and returned.

D. Integrator

import module SpatialServices as namespace spatial
let $threshold := 3.2
let $files := spatial:files('http://myserver/files')[space="MNI"]
let $area := spatial:area('Temporal Lobe')
return spatial:query_area('http://myserver/spatial'), $files,
     $area)[max > $threshold]

Fig D1. A simple query to return files with activation in the temporal lobe

III. Discussion