誰でも.mhd/ .rawファイルを含むデータセットをPythonで読むことができますか?Pythonで* .mhd/*。rawフォーマットを読む
5
A
答えて
5
最も簡単な方法は、SimpleITKを使用することです。コマンド
pip install SimpleITK
は多くのPythonバージョンで動作します。 .mhdを読み取るための/あなたはこのコードを使用すると、これは、zであなたにnumpyの配列を与えるSimpleITK
import skimage.io as io
img = io.imread('file.mhd', plugin='simpleitk')
インストール後も簡単かもしれskimageを使用して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
0
(MedPyがあまりにも.mhd /た.rawファイルに対してITKを使用しています)あなたはMedPyを使用しようとすることができたり、このmhd_utils script
3
を使用することができます.RAW、Y、 xソーティング。
関連する問題
- 1. ITKでの* .mhd/*。rawフォーマットの3D画像の読み込み
- 2. .mhd/.rawファイルをdicom pythonに変換する方法
- 3. Pythonのインプット読むフォーマット
- 4. RAW DNGファイルをアンドロイドで読む
- 5. Tensorflow:それはRAWファイルを読み込むのは簡単だUINT8でRAWファイルを読み込むとのfloat32
- 6. PythonでFortranフォーマットされていないファイルを読む
- 7. Python3:JuliaのJLDフォーマットを読む
- 8. Python - フォーマットされた列を持たないtxtファイルを読む
- 9. Pythonの特定のフォーマットにデータベースクエリを読む
- 10. アンドロイドでRaw Folderに保存されたPdfを読む
- 11. フォーマットの間違ったデータを読む
- 12. Pythonでバイナリファイルを読む
- 13. Pythonでファイルを読む
- 14. Pythonで.vtkファイルを読む
- 15. Pythonでバイナリファイル(.chn)を読む
- 16. Python 2.1でXMLを読む
- 17. Pythonで.dicファイルを読む
- 18. PythonでCSVファイルを読む
- 19. PythonでJSONデータを読む
- 20. pythonで* .lz4ファイルを読む
- 21. wavファイルをPythonで読む
- 22. Pythonでwarcファイルを読む
- 23. PDFポートフォリオをPythonで読む?
- 24. Python(ライブラリ)でマルチメディアプレイリストファイルを読む
- 25. Pythonで.tar.gzファイルを読む
- 26. PythonでOCR PDFを読む
- 27. python msilibでmsiを読む
- 28. Pythonでユニコードファイルを読む
- 29. Pythonでファイルを読む
- 30. hdf5 pythonでマトリックスを読む
BTW、[this](http://stackoverflow.com/questions/37989196/how-do-i-open-mhd-file-corresponding-to-a-raw-file-in-blender-3d-tool )質問は同じです。誰かをマージできますか? – savfod