This application reads an high resolution image file, extracts objects and gets the total count of them.
-
Download & Install Python using Anaconda or Miniconda (Recommended)
-
Open a terminal or command prompt and clone this repository. Then cd into the directory
git clone https://github.com/ukalwa/nematode_egg_counting cd nematode_egg_counting
-
Now, you can run the following commands to install required packages in an isolated conda environment
conda env create -f environment.yaml
It is compatible with both Python 2.7 and Python 3.5, however installing Python 3.5 or greater is recommended.
It was tested on Windows and Mac OS X.
Configuration file src/config.ini
contains all the settings for blob identification, fig sizes and so on. Before running the script, update it accordingly.
- Before running the application, cd to the cloned directory and activate the conda environment by running
activate egg_counting
Paths specified as command line arguments (file_path
, dir_path
) below should be enclosed in quotes(''
or ""
)
-
To process a single file with its known absolute file path
python run.py -f <file_path>
-
To process a directory full of images with known path
python run.py -d <dir_path>
-
To process only some files in a directory with known path
python run.py -d <dir_path> -p <pattern string>
-
To process a single file using file dialog GUI
python run.py (or) python run.py -uf
-
To process a directory full of image using file dialog GUI
python run.py -ud
The code performs these following steps:
- It extracts the configuration parameters related to blob identification, figure sizes, bounding box parameters and so on
- Read the image file as a 3-d numpy array and splits it into various blocks and stores them as a list of numpy arrays.
- It then loops though each block and detects any eggs based on parameters set in the config file and records the count and adds it to the total count
- After all the blocks are completed, total egg counts, blocks with bounding boxes around eggs, egg params are all saved in text files for reference and debugging purposes
The one on the left is a block of the original image and the one on the right is the processed image with eggs identified and labelled with bounding boxes
For generating documentation, please follow these steps:
- Make sure you have sphinx installed, you can install it like this
pip install sphinx sphinx_rtd_theme
- Move to the docs directory and run make. It takes couple of minutes to generate the build files.
cd docs
make html
explorer build\html\index.html
This code is GNU GENERAL PUBLIC LICENSED.
If you have any suggestions or identified bugs please feel free to post them!