Python for Brain Image Analysis
Python is one of the most common modern scripting languages. It is easy to learn, and has a nearly endless supply of specialized libraries and functions. Python was originally created to be a scripting language, so it excels at processing strings and filenames, processing files, and process control, e.g. calling other programs that do the actual work. Recent additions to Python (e.g. numpy) provide Matlab-like abilities to perform full-fledged data processing.
Getting more information:
There are many excellent books that explain Python programming details. Three of my favorites are:
- Python in a Nutshell, Alex Martelli, O'Reilly. A dense but informative and fairly readable tutorial and reference. If you only get one book, get this one.
- Text Processing in Python, David Mertz, Addison-Wesley. Extremely useful examples for text-processing, which is one of the chores Python excels at.
- Core Python Programming, Wesley Chun, Prentice Hall. A nice thick book, aimed primarily at teaching how to use Python. Very readable style, also good as a reference.
It is nice to have a few books to thumb through when you run into trouble, but the best reference source is the web. Python has a very useful website:
Running a Python script:
To alert the computer that you would like to run a text-file as a Python program, paste something like this at the top of the file:
Local Python links:
Terry Oakes' Python libraries, for brain image analysis.
Batch script example using Python.