Python for Neuroimagers


What is Python?

Python is a widely-used programming language, similar to Unix and Matlab. Although the principles of the programming language are nearly identical to the others, it has a different syntax and coding style.

PythonForNeuroimagers/Python_Logo.jpeg

After learning so many other packages and programming languages in this e-book, you may wonder what the benefit is to learning yet another language. While you may have all the tools you need for most imaging analyses, certain advanced methods are most easily implemented in Python. This includes PyTorch, NiPype, and Hyperalignment, and will likely include many future neuroimaging methods as well. To put it another way, today’s neuroimaging researcher needs to have at least some familiarity with Python in order to stay current with the latest developments in the field.

The following tutorials are designed to help the novice neuroimager learn the basics of Python, and then learn how it is used to analyze imaging data, similar to how we have already learned to analyze data with SPM, FSL, and AFNI. We will then learn how to use Python to perform hyperalignment on a naturalistic dataset in which participants watched a TV show. Along the way, I will point out the similarities and differences between Python’s approach to neuroimaging and what you have probably already learned using any of the major software analysis packages.

This module closely follows Tal Yarkoni’s and Ariel Rokum’s excellent Neuroimaging and Data Science e-book, which is freely available online.