Wiki

Clone wiki

DeTerm / Home

Download

In order to get the original version of DeTerm, you need to download the python source code (DeTerm), the network model, and the test data. Keep the network model folder in the same folder as the python sources.

In order to get the most recent/up-to-date version of DeTerm, you need to download the python source code (DeTerm) together with the test data and the network model (two separate files). Keep the network model folder in the same folder as the python sources. Please note that the results of the newest version might slightly differ from the original version.

Requirements

  • scikit-image numpy tensorflow roifile

[Updated Nov. 2020]: Here the library versions that work for me with newer versions of tensorflow: scikit-image==0.17.2, numpy==1.18.5, tensorflow==2.3.1

[Updated Sep. 2021]: Supports ImageJ roi format. You can now save the results directly into an imageJ roi file, revise it in imageJ (We recommend https://imagej.net/software/fiji/), and then use the new script "imagej_roi2csv.py" to convert the imageJ roi file (points) into a csv file.

Below the old requirements

If you are using the original version of DeTerm, then please ensure that the version of the skimage module (scikit-image) is 0.13.1, otherwise the program may not work - particularly with newer versions (it will just output an empty image without any detections). We will release a new version that is compatible with new versions of scikit-image in future. We further recommend numpy=1.14.2 and tensorflow=1.9.0.

Usage

usage: detect_terminals.py [-h] [--fg FG] [--invert] [--guess] [--prob PROB]
                        [--out OUT] [--dout DOUT] [--cout COUT]
                        [--cout_dark] [--csv CSV] [--roi ImageJ_Roi_file] [--model MODEL]
                        [--chkpt CHKPT] [--mask MASK]
                        [--mask_alpha MASK_ALPHA]
                        [--terminal_alpha TERMINAL_ALPHA]
                        [--terminal_size TERMINAL_SIZE]
                        [--myout MYOUT [MYOUT ...]] [--colorize COLORIZE]

optional arguments:
-h, --help            show this help message and exit
--fg FG               input image (if RGB, it will be converted to an
                        intensity image)
--invert              invert intensities
--guess               guess which intensity is FG and which is BG (auto
                        invert)
--prob PROB           probability threshold
--out OUT             a binary image with the detected locations
--dout DOUT           debug image
--cout COUT           an image with the detected locations in red, the input
                        image in green, a mask appears in blue
--cout_dark           with black background
--csv CSV             detected terminal postions as csv table
--roi ROI             detected terminal postions as imageJ roi file
--model MODEL         network model directory
--chkpt CHKPT         model checkpoint
--mask MASK           RGB img, where the RED channel is used as mask for the
                        terminals
--mask_alpha MASK_ALPHA
                        mask alpha
--terminal_alpha TERMINAL_ALPHA
                        terminal alpha
--terminal_size TERMINAL_SIZE
                        terminal_size
--myout MYOUT [MYOUT ...]
                        customized result image
--colorize COLORIZE   R,G,B/R,G,B/R,G,B (img,label,mask)

##Examples

###Example 1 python detect_terminals.py --fg ./input/Raw_image.tif --mask ./input/ROI_image.tif --guess --prob 0.7 --cout ./output/output_image_1.jpg --csv ./output/positional_data_1.csv --model model_20181126/terminal_det_net --chkpt 57500 --colorize 0,1,0/1,0,1/0.05,0.65,0.88 --terminal_size 4 --mask_alpha 0.7 --terminal_alpha 1

###Example 2 python detect_terminals.py --fg ./input/Raw_image.tif --mask ./input/ROI_image.tif --guess --prob 0.7 --cout ./output/output_image_2.jpg --csv ./output/positional_data_2.csv --model model_20181126/terminal_det_net --chkpt 57500 --colorize 1,1,1/0,1,0/0,0,1 --terminal_size 4 --mask_alpha 0 --terminal_alpha 1 --cout_dark

Troubleshooting

  • The program runs, but no terminals have been detected when using the image example from the repository

Please verify that you are using the correct versions of the skimage (0.13.1) and the numpy (1.14.2) modules. You can do that by running the following commands from the command line:

     python -c "import numpy; print(numpy.__version__);"
     python -c "import skimage; print(skimage.__version__);"

Updated