空间变换

Python 中的生物医学图像分析

Stephen Bailey

Instructor

OASIS 数据库

OASIS 标志

Python 中的生物医学图像分析

显著差异

多脑图阵列

Python 中的生物医学图像分析

配准

  • 将图像与模板对齐
  • 最小化空间差异

  • 模板:

    • 可代表多名受试者
    • 可为"平均"图像
  • 需要多种空间变换

三幅图像配准

Python 中的生物医学图像分析

仿射变换保持点、线和平面

变换示例

Python 中的生物医学图像分析

平移

移位后的头部

import imageio.v2 as imageio
import scipy.ndimage as ndi

im=imageio.imread('OAS1036-2d.dcm')
im.shape
(256, 256)
com = ndi.center_of_mass(im)

d0 = 128 - com[0] d1 = 128 - com[1]
xfm = ndi.shift(im, shift=[d0, d1])
Python 中的生物医学图像分析

旋转

ndi.rotate(im,
           angle=25,
           axes=(0,1))

旋转后的头部

Python 中的生物医学图像分析

图像旋转

xfm = ndi.rotate(im, angle=25)

xfm.shape
(297, 297)

重塑后的旋转

xfm = ndi.rotate(im, angle=25, 
              reshape=False)
xfm.shape
(256, 256)

正常旋转

Python 中的生物医学图像分析

变换矩阵

"变换矩阵":对单幅图像应用以完成配准。

矩阵元素编码不同仿射变换的"指令"。

含四种变换的图像

Python 中的生物医学图像分析

应用变换矩阵

# Identity matrix
mat = [[1, 0, 0],
       [0, 1, 0],
       [0, 0, 1]]

xfm = ndi.affine_transform(im, mat)

原始图像

# 平移与缩放
mat = [[0.8, 0,   -20],
       [0,   0.8, -10],
       [0,   0,   1]]
xfm = ndi.affine_transform(im,
                           mat)

变换后的图像

Python 中的生物医学图像分析

让我们来练习!

Python 中的生物医学图像分析

Preparing Video For Download...