Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Open mha image files in Python (2015 brats challenge dataset)

I want to use deep learning for medical image segmentation as my graduation thesis, the data used is 2015 brats challenge.

for example: MHA file

but i don't how to open the .mha files by use python.I use the tensorflow framework, so it's more convenient to use python, and besides that, I need to do some preprocessing of the data graph.

from medpy.io import load
url = r'G:\path\to\mine.mha'
mage_data,image_header = load(url)

Then:

medpy.core.exceptions.DependencyError: Loading images of type Itk/Vtk MetaImage (.mhd, .mha/.raw) requires a third-party module that could not be encountered. Reason: No module named 'filter'.

The brats challenge is an international competition.But I don't know what network structure I'm supposed to use to train my network. If you have good advice, please let me know.

like image 994
hey6775 Avatar asked Dec 23 '22 12:12

hey6775


1 Answers

You can use MedPy package for this.

sudo apt-get install python-pip python-numpy python-scipy libboost-python-dev build-essential

Then:

sudo pip install nibabel pydicom medpy

And the Python usage:

from medpy.io import load
mage_data, image_header = load('/path/to/image.mha')

The library supports some useful preprocessing and analysis functions as well.

Good luck!

like image 155
rkellerm Avatar answered Mar 24 '23 00:03

rkellerm