For making images and movies from microscopy images in a Jupyter notebook. Requires the following packages:
numpy
skimage
matplotlib
urlib
os
shutil
subprocess
ipywidgets
glob
csv
optional
czifile
- for reading in .czi files. Can be installed by running pip install czifile
from the conda prompt (Windows) or terminal (Mac)
You should have all these packages installed by default if you installed python via Anaconda. If you get errors importing any of them try running from the conda prompt (Windows) or terminal (Mac) conda install <package_name>
. If that doesn't work try installing the package via pip install <package_name>
.
Also requires ffmpeg
which runs from the command prompt. Installation instructions for ffmpeg are below
Instructions for adding folders to your pythonpath are also included below
3 Channel Example Image : https://www.dropbox.com/sh/cgq78z9zu1flz3l/AAADyhcdyEK6Zo9rJsVqA4zXa?dl=0
Timelapse Example Image : https://www.dropbox.com/sh/l96nf494bkq4gdq/AABXAKIqX1_4aRUrqVIqfBLLa?dl=0
A Jupyter notebook and example files are included in the repository.
Import appropriate toolboxes
import glob as glob
from image_plotting_tools import *
from interactive_plotting_tools import *
Overlay your images
file_list = glob.glob('Multichannel_image_example/*.tif')
interactive_overlay_images(file_list)
Make a movie
(where example3/finale_test.tif'
is the multicolor image overlay created in the cell above)
movie_maker_widget('Timelapse_Image_stacks_example/final_test.tif')
If you want to be able to import these files in any notebook you should add their file location to your python path. You should only need to do this once.
- Download the files from Github to a folder that will store your python code
- Navigate to your home folder (look for the house in the list of favorites in a finder window)
- Show hidden files by hitting
shift
+command
+.
- Right click on
.bash_profile
and select "Open With" in any text editor (e.g. TextEdit) - Add a line at the end with the following:
export PYTHONPATH=/Users/<username>/<path>
where<username>
is your home folder name and<path>
is the path to the folder where you saved the files - Save the file and press
shift
+command
+.
to hide hidden files again - Open a new terminal window for the changes to take effect
- Type
echo $PYTHONPATH$
- you should see the path to your folder
- Download the files from Github to a folder that will store your python code
- From the taskbar search for "Advanced System Settings"
- Click on "Environment variables" button at the bottom
- In the top half of the window, under "User Variables" click on "New"
- Enter
PYTHONPATH
as the variable name - Enter the path to your folder that you created in the value box
- Click OK to save the new variable. Make sure it shows up in the list
- From the search bar open up a command prompt by searching for
cmd
- At the prompt type
echo %PYTHONPATH%
- you should see the path to your folder
OS X ver. 10.15.4 (macOS Catalina) ffmpeg ver 4.2.2
To install:
-
Install homebrew by running the following command in a terminal window:
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"
-
Install ffmpeg by running:
brew install ffmpeg
-
Confirm that it is installed correctly by typing ffmpeg at the prompt. You should see details about version number and installed codecs, etc.
Windows 10 ffmpeg ver 4.2.2 - from here: https://ffmpeg.zeranoe.com/builds/
To install:
- Download ffmpeg from here: https://ffmpeg.zeranoe.com/builds/
- Unzip the contents into a folder on your computer
- Search for Advanced System Properties from the search menu
- Click on the Environment Variables button at the bottom
- In the top half of the window under User Variables, select Path and hit the Edit button
- Add the path to the directory where you unzipped ffmpeg and add
\bin\
to it - e.g.c:\ffmpeg\bin\
- Click OK
- Check to see if the path to the ffmpeg folder was added to the path variable. There should now be a
;
before and after it - Confirm that it is installed correctly by typing ffmpeg at the prompt. You should see details about version number and installed codecs, etc.