載入影像
在本章中,你會使用來自 The Cancer Imaging Archive 的電腦斷層(CT)掃描切片。CT 透過旋轉的 X 光管,建立目標區域的 3D 影像。
影像的實際內容取決於使用的儀器:相片測量可見光,X 光與 CT 測量輻射吸收,而 MRI 掃描儀測量磁場。
先暖身一下,使用 imageio 套件從掃描體積中載入一張 DICOM 影像,並查看它的一些屬性。
本練習屬於課程
Python 的生醫影像分析
練習說明
- 匯入
imageio。 - 使用
imread()函式讀取影像 "chest-220.dcm"。 - 印出
im的type()與shape(像素數)。
動手互動練習
試著完成這個範例程式碼,體驗一下這個練習。
# Import ImageIO
import imageio.v2 as ____
# Load "chest-220.dcm"
im = ____
# Print image attributes
print('Image type:', ____)
print('Shape of image array:', im.____)