Survey
* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
Euclidean vector wikipedia , lookup
Non-negative matrix factorization wikipedia , lookup
Singular-value decomposition wikipedia , lookup
Perron–Frobenius theorem wikipedia , lookup
Cayley–Hamilton theorem wikipedia , lookup
Rotation matrix wikipedia , lookup
Orthogonal matrix wikipedia , lookup
Gaussian elimination wikipedia , lookup
Covariance and contravariance of vectors wikipedia , lookup
Matrix multiplication wikipedia , lookup
Computational Aspects of MRI Geometrical Transforms References Geometrical Transformations David Atkinson • Foley, van Dam, Feiner, Hughes. Computer Graphics: Principles and Practice. Chapter 5. • Wolfram MathWorld http://mathworld.wolfram.com/ [email protected] • • • • • • Computational Aspects of MRI Computational Aspects of MRI Outline Geometrical Transforms in Therapy Motivation Vectors and coordinates Coordinate systems Homogeneous coordinates Geometrical transforms DICOM Computational Aspects of MRI and display [VisionRT] Computational Aspects of MRI and Image Registration Non-Rigid Registration between baseline and follow-up Jacobian map within brain area Modat et al., “Fast FFD using the NMI gradient and GPU”, 10th September, HP-MICCAI 08 workshop Computational Aspects of MRI Computational Aspects of MRI 1 Computational Aspects of MRI Geometrical Transforms Registration Matrix Calculation Overall registration transform is composed of a series of stages Calibration + tracking during intervention M1 Scanner Space 3D Image Space The XMR suite at Guy’s Hospital (KCL) M2 Catheter in human heart Computational Aspects of MRI Geometry: Coordinates and Vectors Dicom image header M1 Calibration M2, T, P Tracking M3 Patient imaging λ, R M3 [Kawal Rhode, KCL] 2D Image Space Scalar Product (dot product, inner product) ĵ (4,2,1) r X-ray C-arm Space R*P y r = 4xˆ + 2yˆ + zˆ r = 4ˆi + 2ˆj + kˆ λT X-ray Table Space r.ˆj = r ˆj cos(θ ) r θ x r length of vector r ˆj = 1 (unit vector with length 1) z Norm (length) r or r 2 = 4 2 + 2 2 + 12 Scalar product is length of projection of r onto unit vector ĵ unit vector ˆj = 0 2 + 12 + 0 2 = 1 2 Computational Aspects of MRI Scalar product in component form u = u1ˆi + u2 ˆj + u3kˆ [MathWorld] Computational Aspects of MRI Vector (Cross) product • Cross product of two vectors u and v is a third vector perpendicular to u and v. • E.g. z axis is cross product of x and y. v = v1ˆi + v2 ˆj + v3kˆ 3 u ⋅ v = ∑ ui vi = u1v1 + u2 v2 + u3v3 i =1 u× v u θ v Computational Aspects of MRI Computational Aspects of MRI 2 Computational Aspects of MRI Geometrical Transforms Vector product u× v Right Handed Coordinate System u x u = u1ˆi + u2 ˆj + u3kˆ y θ v = v1ˆi + v2 ˆj + v3kˆ thumb v 1st finger u × v = ˆi (u y v z − u z v y ) + ˆj(u z v x − u x v z ) + kˆ (u x v y − u y v x ) u × v = ( u v sin θ )nˆ z 2nd finger Computational Aspects of MRI Computational Aspects of MRI Example Scanner and Patient Coordinate Systems Radiographic Presentations Anterior L Left P Posterior H Head Z/H X/L Head: “superior” (S) Foot: “inferior” (I) Y/P Left Right Head For a supine (face-up) patient Axial / Transverse Posterior Head Sagittal Coronal Right Left Posterior Anterior Foot Foot Computational Aspectsfoot of MRI View patient from Left Computational Aspects of MRI Rotation Transformation • Rotation matrix transforms coordinates of a point by a rotation. b yb ya xb = xa cosθ − ya sin θ yb = xa sin θ + ya cosθ ⎡ xb ⎤ ⎡cosθ ⎢ y ⎥ = ⎢ sin θ ⎣ b⎦ ⎣ − sin θ ⎤ ⎡ xa ⎤ cosθ ⎥⎦ ⎢⎣ ya ⎥⎦ Computational Aspects of MRI a θ xb xa • Rotations and scales can be expressed using 2x2 matrices for 2D coordinates (3x3 for 3D). • However, translations cannot so use Homogeneous Coordinates. – Add another dimension with value 1 to the coordinates. – Add another row and column to the transform matrix. Computational Aspects of MRI 3 Computational Aspects of MRI Geometrical Transforms Homogeneous Coordinates • A convenient way of representing coordinates that allows for geometric transformations including translations. • Add an extra dimension. w P 1 x [Foley] xb = xa cosθ − ya sin θ yb = xa sin θ + ya cosθ ⎡ xb ⎤ ⎡cosθ ⎢ y ⎥ = ⎢ sin θ ⎣ b⎦ ⎣ − sin θ ⎤ ⎡ xa ⎤ cosθ ⎥⎦ ⎢⎣ ya ⎥⎦ ⎡ xb ⎤ ⎡cosθ ⎢ y ⎥ = ⎢ sin θ ⎢ b⎥ ⎢ ⎣⎢ 1 ⎦⎥ ⎣⎢ 0 − sin θ cosθ 0 0⎤ ⎡ xa ⎤ 0 ⎥ ⎢ ya ⎥ ⎥⎢ ⎥ 1⎦⎥ ⎣⎢ 1 ⎦⎥ ⎡ xb ⎤ ⎡1 0 t x ⎤ ⎡ xa ⎤ ⎢ y ⎥ = ⎢0 1 t ⎥ ⎢ y ⎥ y ⎥⎢ a ⎥ ⎢ b⎥ ⎢ ⎣⎢ 1 ⎦⎥ ⎣⎢0 0 1 ⎦⎥ ⎢⎣ 1 ⎦⎥ xb = xa + t x y b = ya + t y y Computational Aspects of MRI Computational Aspects of MRI Alternative row-vector x matrix representation [xb y b ] = [ xa ⎡ cosθ ya ] ⎢ ⎣− sin θ [xb y b 1] = [xa ya [xb y b 1] = [xa ⎡⋅ ⎢ ya 1] ⎢ ⋅ ⎣⎢t x Note transpose! sin θ ⎤ cosθ ⎥⎦ ⎡ cosθ 1] ⎢− sin θ ⎢ ⎣⎢ 0 ⋅ ⋅ ty (MP) T = P T M T Coords as columns of P post multiplying M sin θ cosθ 0 0⎤ 0⎥ ⎥ 1⎦⎥ 0⎤ ⎥ 0⎥ 1⎥⎦ MATLAB maketform but makehgtform uses matrix vector convention! Row vectors pre-multiplying MT Computational Aspects of MRI Computational Aspects of MRI Comments Affine Transforms • Homogeneous coordinates allow representation of affine transformations. • Transforms can be concatenated (composed) into a series of matrix multiplications - in the correct order. • Take care assembling the matrix – is it for row-vector*matrix, or, matrix*columnvector? Computational Aspects of MRI • An affine transform keeps parallel lines parallel. • Includes: – translations, – rotations, – scale changes, – skews. Computational Aspects of MRI 4 Computational Aspects of MRI Geometrical Transforms Affine Transformation Matrices (3D, matrix * column-vector format) ⎡s x ⎢0 scale ⎢ ⎢0 ⎢0 ⎣ 0 0 sy 0 0 0 sz 0 … 3D rotations 0 ⎡1 ⎢0 cosθ ⎢ Rx = ⎢0 sin θ ⎢ 0 ⎣0 ⎡ cosθ 0 ⎢ 0 1 Ry = ⎢ ⎢− sin θ 0 ⎢ 0 ⎣ 0 0⎤ 0⎥ ⎥ 0⎥ 1⎥⎦ ⎡1 ⎢λ 2D skew or shear ⎢ y ⎢0 ⎢0 ⎣ λx 1 0 0 0 0⎤ 0 0⎥ ⎥ 1 0⎥ 0 1⎥⎦ ⎡1 ⎢0 translation ⎢ ⎢0 ⎢0 ⎣ 0 0 tx ⎤ 1 0 ty ⎥ ⎥ 0 1 tz ⎥ 0 0 1 ⎥⎦ ⎡cosθ ⎢ sin θ Rz = ⎢ ⎢ 0 ⎢ ⎣ 0 Computational Aspects of MRI Applying transforms to coordinates • transform applied to multiple coordinates to transform an object. • in homogeneous coordinates, matrices can be multiplied to compose transforms 0 − sin θ cosθ 0 sin θ 0 cosθ − sin θ cosθ 0 0 0 0⎤ 0⎥ ⎥ 0⎥ ⎥ 1⎦ 0⎤ 0⎥ ⎥ 0⎥ ⎥ 1⎦ 0 0⎤ 0 0⎥ ⎥ 1 0⎥ 0 1⎥⎦ Computational Aspects of MRI • Compose transforms into one matrix. • Arrange multiple coordinates into one Transform matrix ⎡ xb ⎤ ⎡ ⋅ ⋅ ⋅ ⎤ ⎡ xa ⎤ ⎢ y ⎥ = ⎢ ⋅ ⋅ ⋅⎥⎢ y ⎥ ⎥⎢ a ⎥ ⎢ b⎥ ⎢ ⎣⎢ 1 ⎥⎦ ⎣⎢0 0 1⎥⎦ ⎢⎣ 1 ⎥⎦ ⎡ xb ⎢y ⎢ b ⎣⎢ 1 ub L vb L 1 1 One coordinate ⎤ ⎡ ⋅ ⋅ ⋅ ⎤ ⎡ xa ⎥ = ⎢ ⋅ ⋅ ⋅⎥⎢ y ⎥⎢ a ⎥ ⎢ ⎦⎥ ⎣⎢0 0 1⎦⎥ ⎣⎢ 1 ua L va L 1 1 ⎤ ⎥ ⎥ ⎦⎥ Multiple coordinates Computational Aspects of MRI Computational Aspects of MRI Coordinate and Rotation Origins Summary • Coordinate origin usually does not coincide with image centre. • Affine R matrix assumes rotation about coordinate origin. • Recipe: Translate image such that origin is at centre, apply rotation, translate back. These can be composed, note order is important. Computational Aspects of MRI • Work in a right-handed coordinate system. • To compose rotations, translations, or any affine transform, use homogeneous coordinates. • The order of transformations is important. Computational Aspects of MRI 5