Python을 활용한 생의학 영상 분석
Stephen Bailey
Instructor

공간적 변동성 최소화
템플릿:
다양한 공간 변환을 수반함

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])
ndi.rotate(im,
angle=25,
axes=(0,1))

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

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

변환 행렬: 정합을 위해 하나의 이미지에 적용됩니다.
행렬의 각 요소는 다양한 어파인 변환에 대한 "지시"를 인코딩합니다.

# Identity matrix mat = [[1, 0, 0], [0, 1, 0], [0, 0, 1]]xfm = ndi.affine_transform(im, mat)

# Translate and rescale
mat = [[0.8, 0, -20],
[0, 0.8, -10],
[0, 0, 1]]
xfm = ndi.affine_transform(im,
mat)

Python을 활용한 생의학 영상 분석