This document discusses linear deformations and basic volumetric imaging concepts relevant to Lead-DBS workflows. It describes how linear (affine) transformations can be used to register different images of the same subject by preserving properties like parallel lines and ratios between points. These transformations map between voxel and world coordinate systems using transformation matrices stored in image headers. Rigid and affine transformations involving translation, rotation, scaling, and shearing are presented for realigning one image to another. Hands-on examples for importing and co-registering images are also mentioned.
7. Fused pre- and post
“Normalize”
(non-linear)
MNI space
MNI 152 2009a/b/c Nonlinear series
friederike.irmen@charite.deLead-DBS Workshop
Linear Deformations in Lead-DBS
8. LINEAR (AFFINE) TRANSFORMATION
- Preserves straight lines
- Preserves parallelism
- Preserves ratio between points on a line
- (Special case: Rigid transformation:
Distance between two points remains the same)
Used to register different images of the same subject!
friederike.irmen@charite.deLead-DBS Workshop
Linear Deformations in Lead-DBS
9. • Image itself is just a large matrix of data
• Divided into “voxels” (= volumetric pixels )
•
• Data header contains information
WHAT IS AN IMAGE?
Data type (integer, floating point etc)
Data scaling
Image dimensions
Voxel size
Voxelmm transformation matrix
friederike.irmen@charite.deLead-DBS Workshop
Linear Deformations in Lead-DBS
10. World coordinate system
Anatomical coordinate system
Image coordinate system
friederike.irmen@charite.deLead-DBS Workshop
Linear Deformations in Lead-DBS
(mm)
(voxel)
11. World coordinate systemImage coordinate system
Transformation matrix
friederike.irmen@charite.deLead-DBS Workshop
Linear Deformations in Lead-DBS
12. • Values in “voxel space” are defined
purely in terms of where they occur in
the image
• Values in “world space” are defined
in meaningful units (mm) of distance
from a point of origin
• Changing the transformation matrix
changes the relationship between
voxel coords and world coords
• The matrix can be used to store
transformations without having to
resample (reslice) the image
friederike.irmen@charite.deLead-DBS Workshop
Linear Deformations in Lead-DBS
13. – Matlab Demo –
Voxel vs. World space
Vox_World_Space_Demo.m
friederike.irmen@charite.deLead-DBS Workshop
Linear Deformations in Lead-DBS
15. TRANSFORMATION MATRIX OF THE MNI TEMPLATE
Transformation
Matrix
• Stored in Nifti header
• Allows for conversion from voxel to world
coordinates
This example (Lead-DBS T1 MNI-template):
• Voxel size: 0.5mm x 0.5mm x 0.5mm
• Dimension: 394 x 466 x 378
• Origin: [197 269 145]
friederike.irmen@charite.deLead-DBS Workshop
Linear Deformations in Lead-DBS
19. LINEAR (AFFINE) TRANSFORMATION
- Preserves straight lines
- Preserves parallelism
- Preserves ratio between points on a line
- (Special case: Rigid transformation:
Distance between two points remains the same)
Used to register different images of the same subject!
friederike.irmen@charite.deLead-DBS Workshop
Linear Deformations in Lead-DBS
20. REALIGN ONE IMAGE TO ANOTHER
Common Transformations:
1. Rigid body (6 DOF) – translation and rotation
2. Affine (12 DOF) – translation, rotation, scaling and shearing
friederike.irmen@charite.deLead-DBS Workshop
Linear Deformations in Lead-DBS
21. • Find optimal values for these 6 parameters
• Optimal values give the minimum value for the sum of squared difference between
consecutive images
• Successive approximation - start with one set of parameters and iteratively try different
combinations in order to find minimum sum of squared diffs
RIGID BODY TRANSFORMATION
friederike.irmen@charite.deLead-DBS Workshop
Linear Deformations in Lead-DBS
22. TRANSLATION
If a point x is translated by q units, the transformation is
y=x+q
In matrix terms, this can be considered as
𝑦1
𝑦2
𝑦3
1
=
1 0 0 𝑞1
0 1 0 𝑞2
0 0 1 𝑞3
0 0 0 1
x
𝑥1
𝑥2
𝑥3
1
y1= 1*x1+0*x2+0*x3+q1*1
y2=0*x1+1*x2+0*x3+q2*1
y3=0*x1+0*x2+1*x3+q3*1
(y4)=0*x1+0*x2+0*x3+1*1
friederike.irmen@charite.deLead-DBS Workshop
Linear Deformations in Lead-DBS
23. ROTATION
The matrix describing a rotation of q radians
is performed by:
𝑦1
𝑦2
𝑦3
1
=
1 0 0 0
0 cos(𝑞) sin(𝑞) 0
0 −sin(𝑞) cos(𝑞) 0
0 0 0 1
x
𝑥1
𝑥2
𝑥3
1
Along
1. Dimension
𝑦1
𝑦2
𝑦3
1
=
1 cos(𝑞) sin(𝑞) 0
0 1 0 0
0 −sin(𝑞) cos(𝑞) 0
0 0 0 1
x
𝑥1
𝑥2
𝑥3
1
Along
2. Dimension
𝑦1
𝑦2
𝑦3
1
=
1 cos(𝑞) sin(𝑞) 0
0 −sin(𝑞) cos(𝑞) 0
0 0 1 0
0 0 0 1
x
𝑥1
𝑥2
𝑥3
1
Along
3. Dimension
friederike.irmen@charite.deLead-DBS Workshop
Linear Deformations in Lead-DBS
24. RIGID BODY TRANSFORMATION
T =
1 0 0 𝑞1
0 1 0 𝑞2
0 0 1 𝑞3
0 0 0 1
M = TxR
R =
1 0 0 0
0 cos(𝑞4) sin(𝑞4) 0
0 −sin(𝑞4) cos(𝑞4) 0
0 0 0 1
x
1 cos(𝑞5) 𝑠𝑖𝑛(𝑞5) 0
0 1 0 0
0 −𝑠𝑖𝑛(𝑞5) cos(𝑞5) 0
0 0 0 1
x
1 cos(𝑞6) 𝑠𝑖𝑛(𝑞6) 0
0 −sin(𝑞6) cos(𝑞6) 0
0 0 1 0
0 0 0 1
Optimizing these 6 parameters in order to maximize similarity between two
images
friederike.irmen@charite.deLead-DBS Workshop
Linear Deformations in Lead-DBS
26. AFFINE TRANSFORMATION: ZOOM
Zooming allows for transformations between
images with different sizes and can be
represented as follows:
𝑦1
𝑦2
𝑦3
1
=
𝑞1 0 0 0
0 𝑞2 0 0
0 0 𝑞3 0
0 0 0 1
x
𝑥1
𝑥2
𝑥3
1
friederike.irmen@charite.deLead-DBS Workshop
Linear Deformations in Lead-DBS
27. AFFINE TRANSFORMATION: SHEAR
Shearing by parameters 𝑞1, 𝑞2 and 𝑞3 can be
performed by the following matrix
𝑦1
𝑦2
𝑦3
1
=
1 𝑞1 𝑞2 0
0 1 𝑞3 0
0 0 1 0
0 0 0 1
x
𝑥1
𝑥2
𝑥3
1
friederike.irmen@charite.deLead-DBS Workshop
Linear Deformations in Lead-DBS
28. Videos by Jan Rödiger
fixed image
moving image
Translation Rotation Zoom Shear
M =
1 0 𝑞1
0 1 𝑞2
0 0 1
x
cos(𝑞3) −sin(𝑞3) 0
sin(𝑞3) cos(𝑞3) 0
0 0 1
x
𝑞4 0 0
0 𝑞5 0
0 0 1
x
1 𝑞6 0
0 1 0
0 0 1
29. – Hands on Session –
Data import and co-registration
using Lead-DBS
friederike.irmen@charite.deLead-DBS Workshop
Linear Deformations in Lead-DBS