Volumetric data formats supported by SBA Composer are:
From every supported volume file format we can extract at least the following:
Let's call the augmented (4x4) linear transformation matrix A
.
What we need to know in addition to place this data in atlas space is:
Part of this information is available in the volume file, but it is represented differently in each file format,
and it is often wrong or left out. In Nifti files for example, the orientation of the physical space is required to be RAS,
and the units are specified in the xyzt_units
field. The choice of origin cannot be specified at all. In practice we often find that the orientation is not RAS, and/or that the xyzt_units
field is not set.
We deal with this issue in several ways. For manually imported files, the user is presented with a dialog in which our best guess for the missing information can be adjusted. For automated imports, adjusted values can be specified via the 'brain addressing system' (BAS) meta data. In either case, we assume for the moment that the data fits the atlas in which the user tries to import the file.
Obtaining the best guess starts with decomposing the matrix A
into the product of four matrices:
A = T R S Q
, where
If we assume that R indeed rotates the data to RAS orientation (or for non-Nifti1 files, the specified orientation),
then we can apply the inverse rotation to find the orientation axes that align best with the brain in its original space.
We then define a matrix R* that re-orients data from these orientation axes to RAS, and use it to find the 'remainder matrix' Z:
A = T R* S Z => Z = inv(T R* S) A
, where
When either the user or the BAS meta data overrides the detected orientation, scaling and/or origin landmark, then A is recomputed by constructing T, R* and S from the new values, while keeping Z as is.
This is one of the most confusing aspects of image alignment. In the ideal world it is very simple. SBA Composer defines for each supported atlas an enclosing box that consists of three pairs of values that contain the minimum and maximum coordinate along each anatomical axis. The origin of the real-world space is defined as the point (0,0,0) in this enclosing box. The confusion arises due to the fact that SBA Composer makes a particular choice on the meaning of the point (0,0,0), while a dataset that is said to be aligned to the atlas may have a different idea of what the point (0,0,0) represents. The most common case is that one of the eight corners of the enclosing box acts as the origin, in particular the corner that corresponds to voxel (0,0,0) of the untransformed image. Other common choices are the center of the enclosing box, a stereotaxic landmark like bregma or interaural, or a point that marks an easily identifyable structure like anterior commissure. To deal with this, SBA Composer defines for each atlas a set of landmarks that can be used as the origin. The landmarks 'zero' and 'center' are always defined and refer to point (0,0,0) and the center of the enclosing box, respectively. The corner landmark is also defined for all atlases and represents the corner of the enclosing box that opposes the anatomical orientation of the untransformed image (i.e. closest to the first voxel of the image). In addition, a list of atlas-specific landmarks is defined as a list of key-value pairs. The landmark that is selected to represent the origin is called origin landmark.
None of the file formats caters for specifying the choice of origin, and this is one of the reasons that we developed the BAS supplementary meta data scheme. When SBA Composer imports an image, it derives the origin landmark from either the file import dialog or from the BAS meta data. In absence of these, it assumes the 'corner' landmark if the affine transformation has no translation component. Otherwise, the 'zero' landmark is chosen. Once the origin landmark of the imported data is known, SBA Composer adds a translation to the affine transformation to align the data with the default atlas origin.
Notes to obtain voxel-perfect alignments:
Two-dimensional image data formats supported by SBA Composer are:
We treat 2d-images as 3d-volumes with a cardinality of 1 in the 3rd dimension. Note that for two-dimensional images, there is no reasonable way to derive from the file contents what is their anatomical orientation and and origin; the best we can hope for is that the pixel resolution is specified. The other properties have to be specified in the dialog or via BAS meta data.