This repository helps to set various tools external to the Java world:
- Deep learning tools via conda environments:
- cellpose, stardist(3D), deepslice
- Direct executable programs:
- elastix, transformix
On top of this, some converters that facilite the transmission of data to these external programs are part of this repository.
NOTE : up to cellpose 3.0
The Cellpose wrapper is an ImageJ2 command that enables using a working Cellpose virtual environment (either conda, or venv) from Fiji.
Briefly, Cellpose wrapper sequentially:
- saves the current Fiji image in a temporary folder
- starts the cellpose-env and runs Cellpose with defined parameters
- opens the created label image in Fiji
- cleans the temporary folder
You'll find here some instructions to install the Cellpose wrapper and some guidance to set up a Cellpose virtual environment.
NOTE : if you rely on conda, the Cellpose wrapper requires to enable the conda command outside of conda prompt cf installation instructions below.
You can find instructions to install Cellpose environment on Cellpose repo
Please find below some information, provided "as is" without any warranties of successful installation, nor further support.
NOTE : if you rely on conda, the Cellpose wrapper requires to enable the conda command outside of conda prompt, cf installation instructions below : .
You need to follow this two steps procedure to enable Windows to use conda from cmd.exe.
- 1-Into the environment variable , edit PATH , add path to your
..\Anaconda3\condabin
default would beC:\ProgramData\Anaconda3\condabin
- 2-Open a new PowerShell (and/or PowerShell (x86) ), run the following command once to initialize conda:
conda init
From now on you don't need to run a conda prompt you can simply activate a conda env from cmd.exe
.
To check if it works, you can:
- 1.Press windows key, type
cmd.exe
(to get a command prompt) - 2.Type
conda env list
You should get the list of your conda envs.
You can find instructions to install Cellpose environment on our wiki
Please find below some information, provided "as is" without any warranties of successful installation, nor further support.
You can find instructions to install Cellpose environment on Cellpose repo which work just fine for CPU ONLY.
Briefly , using the lines below:
conda create -n cellpose
conda activate cellpose
pip install cellpose
would do the job to have a working cellpose env (in CPU mode)!
Installation following Mac instructions worked for a couple of testers (no support)
NOTE The Fiji - Cellpose wrapper is useless without a working Cellpose environment, please see installation above.
To test if you have a working Cellpose environment:
- Start a terminal
- Activate your environment
- Type
python -m cellpose --help
You should not get an error ;)
From Fiji :
- Please activate our update site ( PTBIOP | https://biop.epfl.ch/Fiji-Update/ ) , find more details here.
- Restart Fiji
In the Fiji menu Plugins > BIOP > Cellpose/Omnipose
one will find :
Cellpose ...
Omnipose ...
When selected both command will start a similar (yet different) GUI as pictured below :
NOTE We recommend users to prepare in Fiji the minimal image to be processed by cellpose before using the plugin. For example, from a 4 channels image (with nuclei, membrane , proteinX, ... stainings) extract the membrane and nuclei channel, make a composite image and run cellpose command on it.
For more info about parameters please refer to cellpose.readthedocs.io
Please find an example of ImageJ macro and Groovy script
The StarDist3D wrapper is an ImageJ2 command that enables using a working StarDist virtual environment (either conda, or venv) from Fiji.
Briefly, StarDist3D wrapper sequentially:
- saves the current Fiji image in a temporary folder
- starts the stardist-env and runs stardist with defined parameters
- opens the created label image in Fiji
- cleans the temporary folder
BIOP StarDist3D model(s) (and training dataset) can be found on the zenodo repository
You can have a look to the StarDist installation, but for now it works from a branch of the project (@Scripts).
Recommended way is to use yml file you can find below (or in /resources
).
Please find below some information, provided "as is" without any warranties of successful installation, nor further support.
Please find here a very detailed installation procedure with venv.
NOTE : if you rely on conda, the StarDist3d wrapper requires to enable the conda command outside of conda prompt, cf installation instructions below : .
You need to follow this two steps procedure to enable Windows to use conda from cmd.exe.
- 1-Into the environment variable , edit PATH , add path to your
..\Anaconda3\condabin
default would beC:\ProgramData\Anaconda3\condabin
- 2-Open a new PowerShell (and/or PowerShell (x86) ), run the following command once to initialize conda:
conda init
From now on you don't need to run a conda prompt you can simply activate a conda env from cmd.exe
.
To check if it works, you can:
- 1.Press windows key, type
cmd.exe
(to get a command promt) - 2.Type
conda env list
You should get the list of your conda envs.
CUDA Toolkit | cuDNN | Tensorflow | stardist / branch | yml |
---|---|---|---|---|
CUDA Toolkit installer 10.0 ($) | 7.6.5 ($) | 1.15 ($) | 0.7.3 / @Scripts | stardist_scripts.yml file ($) |
CUDA Toolkit installer 10.0 ($) | 7.6.5 ($) | 1.15 ($) | 0.8.3 | stardist0.8_TF1.15.yml file ($) |
($) This combination CUDA Toolkit and CuDNN are required to work with Tensorflow 1.15 (lastest available on Fiji) to train model for StarDist2D. Other combinations might work but were not tested (yet).
The following procedure was validated on a Mac mini, M1 Chip 8-core CPU + 8-core GPU, 256GB SSD, 8GB Ram for CPU ONLY install.
First create a conda env in python 3.7 (otherwise I got issue with tensorflow)
conda create -n stardist_py37 python=3.7
Then activate the conda env
conda activate stardist_py37
Install tensorflow
conda install tensorflow
Install Stardist:
pip install stardist==0.8.3
Finally, I ran into an issue (OMP: Error #15: Initializing libomp.dylib, but found libomp.dylib already initialized) and I was lucky enough to found a fix using :
conda install nomkl
With all that I got a running conda env capable to run stardist-predict2D or -predict3D, in CPU.
NOTE The Fiji - StarDist3D wrapper is useless without a working StarDist3D environment, please see installation abobe (I.A.).
To test if you have a working StarDist3D environment:
1 - Activate your environment
2 - Type stardist-predict3d -h
You should not get an error and see available parameters
- Please use our update site (PTBIOP | https://biop.epfl.ch/Fiji-Update/) , find more details here.
- Restart Fiji
Plugins>BIOP>StarDist> StarDist setup...
- Select the path to your working StarDist virtual environment
- Select EnvType :
conda
orvenv
NOTE : on MacOS, for a default anaconda install and a default StarDist install, the path should be something like: /opt/anaconda3/envs/stardist_py37
(following the example above).
The more "flexible" command is StarDist3D... Advanced (own model)
which offers many parameters.
DeepSlice is a python library which automatically aligns mouse histology with the allen brain atlas common coordinate framework.
You'll find here some instructions to install the DeepSlice wrapper and some guidance to set up a DeepSlice virtual environment.
NOTE : the DeepSlice wrapper requires to enable the conda command outside of conda prompt cf instructions.
The DeepSlice wrapper requires a functioning conda environment with the DeepSlice library.
You need to install DeepSlice in a conda env that has python 3.7 (versions above do not work). You need to create an environment and install DeepSlice with pip.
conda create -n deepslice python=3.7
conda activate deepslice
conda install pip
pip install DeepSlice==1.1.5 # pinned version for which this wrapper has been tested
pip install urllib3==1.26.6 # see https://github.com/PolarBean/DeepSlice/issues/46
NOTE : if you rely on conda, the DeepSlice wrapper requires to enable the conda command outside of conda prompt, cf installation instructions.
You need to follow this two steps procedure to enable Windows to use conda from cmd.exe.
- 1-Into the environment variable , edit PATH , add path to your
..\Anaconda3\condabin
default would beC:\ProgramData\Anaconda3\condabin
- 2-Open a new PowerShell (and/or PowerShell (x86) ), run the following command once to initialize conda:
conda init
From now on you don't need to run a conda prompt you can simply activate a conda env from cmd.exe
.
To check if it works, you can:
- 1.Press windows key, type
cmd.exe
(to get a command prompt) - 2.Type
conda env list
You should get the list of your conda envs.
Nothing particular should be needed, but it has not been tested.
Nothing particular should be needed, but it has not been tested.
This wrapper essentially enables to run DeepSlice locally from within ABBA.
You can set up the location of the environment with the command Plugins>BIOP>DeepSlice>DeepSlice setup...
Note : this bridge only supports 2D registrations. For 3D registrations using elastix in Fiji, please look at https://github.com/embl-cba/elastixWrapper.
Elastix is a standalone program that performs image registration. It takes two images, a fixed and a moving one and outputs a transformation file.
The transformation file can then be used by Transformix to actually transform the moving image into the coordinates of the fixed image.
To use the wrapper, first install the binaries of elastix (transformix is included) for your OS. Then, in Fiji, you can start the Set and Check Wrappers
command:
and set the path to the elastix and transformix executable file:
You can then check whether the wrapper is working by running a test groovy gist. See how it should look like in this video.
A set of commands (= Fiji plugins) can now be used to register two images with Elastix. They are listed below
You can select the two images to register, a fixed and a moving one, and a model, optionnally a grid size for non-rigid registration, and the command returns a deformation field ( no image transformed ).
The deformation field can be saved as a zip file.
The deformation field can be reopened from the zip file.
The inverse of a deformation field can be computed with this command. You need to specify an image, which serves as defining the points over which the inverse computation will be optimized.
You can use this image and a transformation model to actually transform an image.
You can transform ROI located in the ROI Manager according to a deformation field with this plugin.