Latest Page Update: 23-09-2026
Install Conda and VS Code¶
We strongly recommend to use Conda (miniforge) for your Python installation and other tools. If you do not have it installed already follow the guides at Python Support for your operating system.
To edit the code given in this course we use VS Code, but if you are more familiar with other editors then feel free to use them. However, the TAs might not be able to help with editor(IDE) specific questions. If you do not have a working installation of VS Code, we recommend downloading it from VS Code and chose your operating system.
Virtual environments¶
When you have installed Conda and VS Code, you can start by creating a virtual environment. A virtual environment is a practical way of keeping a specific Python interpreter, installed libraries and scrips isolated. So if you have several projects that each requires different libraries, they can be kept separate.
Creating and activating a conda environment¶
Start an VS Code terminal and do:
here a new virtual environment called imageanalysis is created and activated. If you want more details on how setup environments there is a guide from Python support.
Python scripts or Notebooks¶
In this course, there are basically two ways that you can do the exercises:
- Jupyter notebooks is a notebook file with a mix of text(Markdown text) snippets and code blocks, where you can run Python code. We recommend using Visual Studio Code to open and edit the notebooks. For more information and tutorial, we recommend looking at Python Support.
- Python scripts are text files with the
.pyending (for examplemyscript.py). Python scripts are normally edited and executed using a dedicated code editor (IDE). We recommend Visual Studio Code or alternatively use Spyder or PyCharm.
We provide the exercise code as pieces of Python code, and it is your decision if you want to use them in a Notebook or in a script. The exercise solutions will be given in Notebook-format.
Please see Figures in Notebooks for details on figures in notebooks.
If you need an introduction or a refresher to Jupyter notebooks, Python, NumPY and Matplotlib, you can find a good introduction at: Introduction to Jupyter notebooks and Python.
It is important that your Notebook, VS Code, Spyder, Pycharm or other development tool is set to use the virtual environment that you created before. To select the right environment in VS Code:
1. Press crtl + shift + P
2. Select Python: Select Interpreter and press enter
3. Choose the option with the ending (imageanalysis)
For checking this in Jupyter Notebooks run the following commands in code cell:
Installing Python packages¶
In this course, we will use several Python packages. We will install them as needed. To install the package scikit-image (skimage), start an VS Code terminal and do:
Further info can be found here: sci-kit image.
You should also install - matplotlib - pydicom