Example code on how to apply machine learning methods to medical images. Contains code (python and python notebooks) and data (NIfTI)
Welcome to this repository designed to help you learn about machine learning and how it can be applied to medical images!
This tutorial requires that you execute some programs, and ideally, you edit and change some of the programs to whet your curiosity. In order to do this, you must:
-
have python 3.5 or later. While python is already present on Mac and Linux machines, it is probably version 2.7 or earlier. There are important but incompatible differences between python 2.x and 3.x. Python 3.3 and later also includes pip, which is needed for installing packages. We recommend updating to 3.x. The instructions for getting python for all major platforms is at Python.org.
-
install libraries that let you access DICOM files, and access the machine learning libraries we will use. Since version 3.3 of python, the python package installer pip has been included. Therefore, to install the packages we need, execute the following commands: pip install numpy pip install scipy pip install matplotlib pip install scikit-learn pip install pydicom
-
You ideally will have an editor that lets you see and edit the python code. On windows, the easiest tool is Notepad (though Notepad++ is a free tool that makes editing much easier and clearer). For Mac, you can use TextEdit. For Linux, you can use vi, vim, or any other tool you might choose (if you are using Linux, you probably already know this and have a favorite). Alternatively, you can use the ipython notebook. This allows you to edit and run code from within a browser. We refer you to the many excellent tutorials on how to install and use ipython notebooks on the web.
Once you have done the above, you should be ready to begin. The contents of this repository are organized into /code and /data. You may 'cd' into the code directory and list the directory to see the examples. These are all set up to expect to have the data arranged the way the repository had it arranged, so do not change this unless you know what you are donig.
If you know how to run and use IPython/Jupyter, the notebooks are in the /notebooks directory.
Please feel free to make changes and suggest improvements. We hope this helps to accelerate the use of machine learning methods in medical imaging, for the improved care of our patients.
Sincerely,
Mayo Radiology Informatics Laboratory
- Bradley J Erickson, MD PhD <bje at Mayo.edu>
- Panagiotis Korfiatis, PhD <Korfiatis.Panagiotis at Mayo.edu>
- Zeynettin Akkus, PhD <Akkus.Zeynettin at Mayo.edu>
- Timothy Kline, PhD < Kline.Timothy at Mayo.edu>