-
You need to have python3 on your computer. You can check by entering
python3in the terminal - you should see the python version you're using displayed and a >>> command prompt. If you see something like "COMMAND NOT FOUND", you'll have to install python3. I'm pretty sure Macs come with python 2.7, so you might have to install python3 - I think the Hitchikers Guide to Python (Installation Guide) for mac or linux are good. -
Python uses a lot of different packages, so it's important to have a package manager, like "pip". If you followed the python3 installation above, you already have pip. If you don't have pip installed, you'll get a "COMMAND NOT FOUND" error when you type "pip" into the terminal and press "ENTER". Check here for information on installing pip.
-
Now, you want to set up a virtual environment to manage your packages. This tutorial walks through installing venv (which is pretty straightforward if you have pip installed). To create a virtual environment, enter
virtualenv --python=python3 venv_namein the terminal. Then, entersource venv_name/bin/activateto activate your virtual environment. Here "venv_name" is whatever you choose to name your virtual environment (like "py35" or "pyaxon-dynamics"). -
You can install the required packages by navigating to this folder (enter
cd /pathway/to/axon-dynamics-codein the terminal), and enteringpip3 install -r requirements.txt
-
Clone this repository by entering
git clone https://github.com/thomaschristinck/axon-dynamics.gitin the terminal (mac/linux) in a directory of your chosing. Or download zip here. -
Set up a directory with the images you want to analyze. Type
mkdir /directory/inputswhere "directory" is some directory that you're going to do the processing in, and "inputs" is the folder where you should put your input .tiff images. Similarly, create a folder for preprocessed outputsmkdir /directory/outputs -
Now that you have everything set up, preprocess the images as
python3 preprocess.py -i /path/to/folder/for/inputs -o /path/to/folder/for/outputs. See the file "preprocess.py" for more info on this step. Running this file should take no more than a few minutes. -
Next, co-register all the processed images from 3 (above) with FIJI. To do this, you want to select all the images in your "outputs" folder and drag them to FIJI to open them. In the FIJI menu, navigate to
Plugins > Macros > Startup Macros.... Copy and paste the contents of thesample_macro.javafile into this window, and modify the "out_dir" and "nb_images" variables at the top of the .ijm file. Then click "RUN". This will take quite a while for FIJI to do, around 4 minutes per image. You might want to play around with the registration on Line 16 of the FIJI macro (e.g. change the tolerance to make the registration run faster, or the stop level). -
Now, you should have a bunch of coregistered images called "superimposed_x_y.tiff" in the folder specified by "out_dir" in step 4. We want to analyze the growth/loss between these registered images. This is why the registration step in 4 is important. Analyze the images by entering
python3 analyze.py -i /path/to/folder/with/superimposed/images/from4 -o /path/to/folder/for/analysis. See the file "analyze.py" for more info on this step. Running this file should take a minute or two.
The analysis folder you specify in step 5 should have a "Plots" folder and a "Results" folder. I find whether or not the plots are coherent depends on what the images look like. The results generally make more sense. I like to visualize the results by opening growth and loss images (e.g. "growth1.tiff and loss1.tiff") as well as the corresponding preprocessed image from step 3 (e.g. "cleaned_image_1.tiff"). In the FIJI menu, navigate to Image > Color > Merge Channels... and select "loss1.tiff" as red, "growth1.tiff" as green, and "cleaned_image_1.tiff" as blue.