-
Notifications
You must be signed in to change notification settings - Fork 0
Python
Reproduced from https://www.geeksforgeeks.org/python-language-advantages-applications/
Python is a high-level, interpreted, and general-purpose dynamic programming language that focuses on code readability. It generally has small programs when compared to Java and C. It was founded in 1991 by developer Guido Van Rossum. Python ranks among the most popular and fastest-growing languages in the world. Python is a powerful, flexible, and easy-to-use language. In addition, the python community is very active. It is used in many organizations as it supports multiple programming paradigms. It also performs automatic memory management.
Python is an open-source, general-purpose programming language run by a US not-for-profit called the ‘Python Software Foundation’. Python is also extremely commonly used. If you see yourself as a hobbyist and like to run personal projects, it is great to learn Python. If you want any kind of ‘tech’ career, Python is an absolute must (and JavaScript, C#, Ruby etc; though Python makes it easier to learn these).
In neuroimaging, a lot of newer libraries and processing pipelines are being written in Python; particularly those using the BIDS framework. Familiarity with the syntax and structure of Python will help you understand these different tools, even if you aren't writing your own code in Python.
Step 1: Select your IDE of choice (Integrated Development Environment).
This is the software interface for Python that you’ll use to interact with your code. MASSIVE already has PyCharm and Spyder installed, so it’s easy to get started with these IDEs specifically when setting up your virtual environment (venv) on MASSIVE.
To use PyCharm:
-
Login to MASSIVE desktop
-
Go To Applications > Full List of Apps > PyCharm
-
Once PyCharm is up and running, select File, New Project
-
You will be presented with the Create Project window. Click on the arrow next to ‘Project Interpreter’
-
Select ‘Existing interpreter’ and click the ‘browse’ icon.
-
Browse to the location where you created your virtual environment, enter the ‘bin’ folder, then select the ‘python’ executable. Click OK.
-
Click OK
-
Back on the Create Project window, enter the new project name. Click OK. You now have a PyCharm project setup using your new virtual environment.
To use Spyder/conda: I WILL ADD THIS AFTER DINNER
- Download the base Python language here Any version should be fine, but we recommend at least 3.7+ for most neuroimaging packages
- Choose and download your IDE: PyCharm - freely available here Spyder - you can access through Anaconda, freely available here
Start with a simple self-paced course (intro to variables and if statements) ~1 hour. This will give you a very brief introduction to python and programming
Alternatively, try this intro to Python for data science course ~4 hours This covers a bit more, including functions, and an intro to stats in python
Introduction to plotting and data visualisation in Python via Matplotlib Most other plotting tools (including ones listed below) are built upon Matplotlib, so these are important fundamentals
Or this more comprehensive course on python for neuroscience This course does not include videos It covers basics from variables and loops, to data manipulation and statistics. It might be good to check it out to fill in the gaps in your knowledge
Start here: Introduction to MRI in Python ~1 hour Specifically, you should complete: Section 3: Anatomy of a NIfTI Section 5: Exploring open MRI datasets The other sections can provide a general overview of basic neuroimaging principles, but these two sections provide the best hands-on introduction to basic neuroimaging in Python
Next, complete these more detailed lessons as needed depending on what modality you’re working with: sMRI analysis in Python fMRI analysis in Python dMRI analysis in Python
Finally, familiarise yourself with some general purpose plotting tools in python via nilearn.plotting, including plotting of: Volumetric data Surface data FC matrices fMRI carpet plots
OPTIONAL (Complete if relevant to your project) MRI preprocessing pipelines in Python (warning: more complex than previous resources) Gradient analyses in Python (also includes examples for loading and plotting fMRI data and FC)
Machine Learning in Python Semi-introductory course to Python with an emphasis on ML
Python Cheat Sheet Basic guide that covers types of variables, lists, dicts, functions, numpy, matplotlib, etc
- 0.0 NSB Programming Courses (in ALPHA)
- 1.0 Working on the Cluster
- 2.0 Programming Languages
- 2.1 Python
- 2.1.1 Getting Set Up
- 2.1.2 Coding in Python
- 2.1.3 Applications of Python in Neuroimaging
- 2.2 MATLAB
- 2.3 R and RStudio
- 2.4 Programming Intro Exercises
- 2.5 git and GitHub
- 2.6 SLURM and Job Submission
- 2.1 Python
- 3.0 Neuroimaging Tools and Packages
- 3.1 BIDS
- 3.2 FreeSurfer
- 3.3 FSL
- 3.4 Connectome Workbench/wb_command
- 3.5 fMRIPrep
- 3.6 QSIPrep
- 3.7 MICApipe
- 3.8 MRIQC
- 4.0 Specialist Tools