help > Warp field error
Showing 1-2 of 2 posts
Apr 22, 2016 10:04 PM | Mark Wagshul
Warp field error
I am using ART for registration on a large data set (200 subjects).
The registrations are good, but I would like to determine if the
quality of the registrations in individual subjects is affecting
the results. Does anyone know of a way to output an error "field",
i.e., a voxel-wise map of the residuals of the warp? This would
provide me with a regional measure of quality of the fit. Thanks.
Mark Wagshul
Mark Wagshul
Apr 26, 2016 01:04 PM | Babak Ardekani
RE: Warp field error
Originally posted by Mark Wagshul:
Dear Mark,
3dwarper does automatically generate a displacement vector field called _wrp.nii in standard NIFTI vector field format. The following text helps interpreting the vectors stored in this field which have been denoted below as (si,sj,sk).
Best regards
Babak
First let me define some notation:
target image (aka template image): the image to which other images are registered
subject image: the image that is warped or spatially normalized to match the target image
(i, j, k): index location on the target image
nx = number of columns in the target image (i=0, 1, ... , nx-1)
ny = number of rows in the target image (j=0, 1, ..., ny-1)
nz = number of slices in the target image (k=0, 1, ..., nz-1)
dx = distance in mm between centers of two adjacent columns in the target image
dy = distance in mm between centers of two adjacent rows in the target image
dz = distance in mm between centers of two adjacent slices in the target image
(i', j', k'): index location on the subject image
nx' = number of columns in the subject image (i'=0, 1, ... , nx'-1)
ny' = number of rows in the subject image (j'=0, 1, ..., ny'-1)
nz' = number of slices in the subject image (k'=0, 1, ..., nz'-1)
dx' = distance in mm between centers of two adjacent columns in the subject image
dy' = distance in mm between centers of two adjacent rows in the subject image
dz' = distance in mm between centers of two adjacent slices in the subject image
Now if define the process of image registration to be that of assigning to each voxel location (i, j, k) in the target (template) image a corresponding voxel location (i', j', k') in the subject image, then the "displacement field" output of 3dwarper, which is written as a NIFTI vector field, should be interpreted as follows.
As you have noticed, the "displacement field" has the same matrix dimensions as the target image (i.e., nx * ny * nz). Therefore, it contains a displacement vector (si, sj, sk) corresponding to each voxel (i, j, k) of the target image. Using this displacement vector, the following three steps precisely define the voxel location (i', j', k') that should be assigned to voxel (i, j, k). Hence specifying the registration.
Step 1: Compute the target image coordinates (x, y, z) in mm corresponding to (i, j, k)
x = [ i-(nx-1)/2.0 ]*dx
y = [ j-(ny-1)/2.0 ]*dy
z = [k-(nz-1)/2.0]*dz
Note that (x, y, z) is with respect to the center of the target image FOV.
Step 2: Compute the corresponding subject image coordinates (x', y', z') using the displacement vector (si, sj, sk).
x' = x + si
y' = y + sj
z' = z + sk
This step tells you what the displacement vectors really mean.
Step 3: Compute the subject image voxel location (i', j', k').
i' = (x'/dx') + (nx'-1)/2.0
j' = (y'/dy') + (ny'-1)/2.0
k' = (z'/dz') + (nz'-1)/2.0
Note that step 3 is the inverse of step 1. In general, (i', j', k') will not be whole integers. So some kind of interpolation is necessary to find the corresponding gray level on the subject image.
The only other thing I should mention is that the displacement vectors (si, sj, sk) have been scaled and stored as type 'signed short integer' in the *_wrp.nii file. To convert them back to millimeters, please multiply their value by the scl_slope field of the NIFTI
header.
I am using ART for registration on a large data
set (200 subjects). The registrations are good, but I would like to
determine if the quality of the registrations in individual
subjects is affecting the results. Does anyone know of a way to
output an error "field", i.e., a voxel-wise map of the residuals of
the warp? This would provide me with a regional measure of quality
of the fit. Thanks.
Mark Wagshul
Mark Wagshul
Dear Mark,
3dwarper does automatically generate a displacement vector field called _wrp.nii in standard NIFTI vector field format. The following text helps interpreting the vectors stored in this field which have been denoted below as (si,sj,sk).
Best regards
Babak
First let me define some notation:
target image (aka template image): the image to which other images are registered
subject image: the image that is warped or spatially normalized to match the target image
(i, j, k): index location on the target image
nx = number of columns in the target image (i=0, 1, ... , nx-1)
ny = number of rows in the target image (j=0, 1, ..., ny-1)
nz = number of slices in the target image (k=0, 1, ..., nz-1)
dx = distance in mm between centers of two adjacent columns in the target image
dy = distance in mm between centers of two adjacent rows in the target image
dz = distance in mm between centers of two adjacent slices in the target image
(i', j', k'): index location on the subject image
nx' = number of columns in the subject image (i'=0, 1, ... , nx'-1)
ny' = number of rows in the subject image (j'=0, 1, ..., ny'-1)
nz' = number of slices in the subject image (k'=0, 1, ..., nz'-1)
dx' = distance in mm between centers of two adjacent columns in the subject image
dy' = distance in mm between centers of two adjacent rows in the subject image
dz' = distance in mm between centers of two adjacent slices in the subject image
Now if define the process of image registration to be that of assigning to each voxel location (i, j, k) in the target (template) image a corresponding voxel location (i', j', k') in the subject image, then the "displacement field" output of 3dwarper, which is written as a NIFTI vector field, should be interpreted as follows.
As you have noticed, the "displacement field" has the same matrix dimensions as the target image (i.e., nx * ny * nz). Therefore, it contains a displacement vector (si, sj, sk) corresponding to each voxel (i, j, k) of the target image. Using this displacement vector, the following three steps precisely define the voxel location (i', j', k') that should be assigned to voxel (i, j, k). Hence specifying the registration.
Step 1: Compute the target image coordinates (x, y, z) in mm corresponding to (i, j, k)
x = [ i-(nx-1)/2.0 ]*dx
y = [ j-(ny-1)/2.0 ]*dy
z = [k-(nz-1)/2.0]*dz
Note that (x, y, z) is with respect to the center of the target image FOV.
Step 2: Compute the corresponding subject image coordinates (x', y', z') using the displacement vector (si, sj, sk).
x' = x + si
y' = y + sj
z' = z + sk
This step tells you what the displacement vectors really mean.
Step 3: Compute the subject image voxel location (i', j', k').
i' = (x'/dx') + (nx'-1)/2.0
j' = (y'/dy') + (ny'-1)/2.0
k' = (z'/dz') + (nz'-1)/2.0
Note that step 3 is the inverse of step 1. In general, (i', j', k') will not be whole integers. So some kind of interpolation is necessary to find the corresponding gray level on the subject image.
The only other thing I should mention is that the displacement vectors (si, sj, sk) have been scaled and stored as type 'signed short integer' in the *_wrp.nii file. To convert them back to millimeters, please multiply their value by the scl_slope field of the NIFTI
header.