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

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

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

問題描述

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

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

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

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

相關文檔推薦

How to draw a rectangle around a region of interest in python(如何在python中的感興趣區域周圍繪制一個矩形)
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(根據文本方向檢測圖像方向角度)
Detect centre and angle of rectangles in an image using Opencv(使用 Opencv 檢測圖像中矩形的中心和角度)
主站蜘蛛池模板: 在线观看国产视频 | 黄网站免费观看 | 免费精品 | 日本精品视频一区二区 | 成人亚洲性情网站www在线观看 | 亚洲精品二区 | 日韩在线小视频 | 亚洲a视频 | 亚洲欧美日韩国产综合 | 一级欧美黄色片 | 欧美综合色 | 国产韩国精品一区二区三区 | 久久精品91 | 久久午夜精品 | 国产成人免费视频网站高清观看视频 | 求毛片| 国产精品乱码一二三区的特点 | 国产精品久久av | 亚洲成人免费观看 | 欧美日韩最新 | 日日天天| 免费黄色日本 | 国产精品成人国产乱一区 | 国产美女黄色 | 国产成人久久 | 欧美不卡 | 夜夜爽99久久国产综合精品女不卡 | 国产精品免费观看 | 请别相信他免费喜剧电影在线观看 | 日韩欧美手机在线 | 狠狠撸在线视频 | 不卡的av在线| 丁香久久 | 一区二区三区免费网站 | 最新av中文字幕 | www.一区二区三区.com | 一区二区在线免费观看 | 黄色av观看 | 欧美日韩在线一区二区 | 久久机热 | 中文字幕一区二区三区精彩视频 |