久久久久久久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 檢測圖像中矩形的中心和角度)
主站蜘蛛池模板: 中文字幕在线人 | 久久久久久亚洲精品不卡 | 国产精品久久久久久一区二区三区 | 久久久久久久久久久一区二区 | 国产精品毛片久久久久久久 | 激情六月天| 欧美一区二区三区免费在线观看 | 91aiai| 黄色大片网 | 天天色天天色 | 午夜丁香视频在线观看 | 韩日在线 | 香蕉久久a毛片 | 色婷婷综合久久久中文字幕 | 久色视频在线观看 | 久久久久久久久淑女av国产精品 | 蜜臀网| 精品国产乱码久久久久久丨区2区 | 国产精品久久久久久 | 国产成人免费一区二区60岁 | 国产韩国精品一区二区三区 | 国产成人a亚洲精品 | 国产高潮好爽受不了了夜色 | 日韩中出 | 精品久久精品 | 一区二区三区四区在线 | 日韩在线精品视频 | 网色| 国产精品久久av | 国产精品中文字幕在线播放 | 国产免费一区二区 | 久久久中文 | 欧美aaa级| 国产精品成人在线播放 | 欧美在线观看一区二区 | 久久久国产亚洲精品 | 久久国产综合 | 九九视频网 | 一区二区三区视频免费看 | 亚洲美女av网站 | 天天插日日操 |