久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

在 python 中讀取 *.mhd/*.raw 格式

Reading *.mhd/*.raw format in python(在 python 中讀取 *.mhd/*.raw 格式)
本文介紹了在 python 中讀取 *.mhd/*.raw 格式的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

問題描述

誰能告訴我如何在 python 中讀取包含 .mhd/.raw 文件的數(shù)據(jù)集?

Can anyone please tell me the way I can read a dataset containing .mhd/.raw files in python?

推薦答案

最簡單的方法是使用 SimpleITK (MedPy 也將 ITK 用于 .mhd/.raw 文件).命令

The easiest way is to use SimpleITK (MedPy uses ITK for .mhd/.raw files too). Command

pip install SimpleITK

適用于許多 python 版本.要閱讀 .mhd/.raw,您可以使用此代碼 來自 kaggle

works for many python versions. For reading .mhd/.raw you can use this code from kaggle

import SimpleITK as sitk
import numpy as np
'''
This funciton reads a '.mhd' file using SimpleITK and return the image array, origin and spacing of the image.
'''

def load_itk(filename):
    # Reads the image using SimpleITK
    itkimage = sitk.ReadImage(filename)

    # Convert the image to a  numpy array first and then shuffle the dimensions to get axis in the order z,y,x
    ct_scan = sitk.GetArrayFromImage(itkimage)

    # Read the origin of the ct_scan, will be used to convert the coordinates from world to voxel and vice versa.
    origin = np.array(list(reversed(itkimage.GetOrigin())))

    # Read the spacing along each dimension
    spacing = np.array(list(reversed(itkimage.GetSpacing())))

    return ct_scan, origin, spacing

這篇關(guān)于在 python 中讀取 *.mhd/*.raw 格式的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網(wǎng)!

【網(wǎng)站聲明】本站部分內(nèi)容來源于互聯(lián)網(wǎng),旨在幫助大家更快的解決問題,如果有圖片或者內(nèi)容侵犯了您的權(quán)益,請聯(lián)系我們刪除處理,感謝您的支持!

相關(guān)文檔推薦

How to draw a rectangle around a region of interest in python(如何在python中的感興趣區(qū)域周圍繪制一個矩形)
How can I detect and track people using OpenCV?(如何使用 OpenCV 檢測和跟蹤人員?)
How to apply threshold within multiple rectangular bounding boxes in an image?(如何在圖像的多個矩形邊界框中應用閾值?)
How can I download a specific part of Coco Dataset?(如何下載 Coco Dataset 的特定部分?)
Detect image orientation angle based on text direction(根據(jù)文本方向檢測圖像方向角度)
Detect centre and angle of rectangles in an image using Opencv(使用 Opencv 檢測圖像中矩形的中心和角度)
主站蜘蛛池模板: 中文字幕一区二区三区精彩视频 | 欧美成年网站 | 欧美亚洲另类丝袜综合网动图 | 国产精品亚洲成在人线 | 日韩欧美国产不卡 | 国精品一区二区 | 91文字幕巨乱亚洲香蕉 | 亚洲一区二区不卡在线观看 | 亚洲视频在线一区 | 91玖玖| 亚洲一区 中文字幕 | 欧美又大粗又爽又黄大片视频 | 精品国产99 | 久久久久久久久国产精品 | 黄色成人免费在线观看 | 国产综合视频 | 日韩精品视频在线观看一区二区三区 | 日韩免费 | 精品一区二区三区四区在线 | 日本亚洲一区二区 | 国内91在线 | 日韩a在线| 国产激情在线 | 琪琪午夜伦伦电影福利片 | 国产不卡一区 | 久久99精品久久久久久 | av中文字幕网站 | 天堂资源最新在线 | 国产精品成人一区二区三区 | 国产亚洲一区二区三区在线观看 | 国产91在线 | 欧美 | 99久热| 中文字幕在线观看一区 | 欧美xxxx性xxxxx高清 | 日韩蜜桃视频 | 天天碰日日操 | 99久视频 | 亚洲毛片在线观看 | 天天曰夜夜| 国产成人午夜电影网 | 久久免费观看一级毛片 |