마스크

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

Stephen Bailey

Instructor

마스크

원본 이미지

전체 뇌

이미지 마스크

마스크

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

마스크 생성

논리 연산은 각 픽셀에서 True / False를 반환합니다

mat = np.array([[1, 2, 3],
                [4, 5, 6],
                [7, 8, 9]])

mat > 5
np.array([[False, False, False],
          [False, False, True ],
          [True,  True,  True ]])

주요 연산

연산 예시
초과 im > 0
같음 im == 1
X 그리고 Y (im > 0) & (im < 5)
X 또는 Y (im > 10) | (im < 5)
Python을 활용한 생의학 영상 분석

마스크 생성

 

hist=ndi.histogram(im, 0, 255, 256)

 

mask1 = im > 32

발 히스토그램

발 마스크 1

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

마스크 생성

 

mask2 = im > 64

 

mask3 = mask1 & ~mask2

발 마스크 2

발 마스크 1과 2

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

마스크 적용

np.where(condition, x, y)  마스크를 통과할 데이터를 제어합니다.

import numpy as np

im_bone = np.where(im > 64, im, 0)
plt.imshow(im_bone, cmap='gray')
plt.axis('off')
plt.show()

비골격 영역이 제거된 이미지

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

마스크 조정

m = np.where(im > 64, 1, 0)

발 마스크 1

ndi.binary_dilation(m,iterations=5)

발 마스크 이진 팽창

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

마스크 조정

ndi.binary_erosion(m,iterations=5)

발 마스크 이진 침식

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

연습해 봅시다!

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

Preparing Video For Download...