Protozoa recognition : Looking for help

Hi !
We are a group of 5 French students in engineering and we are working on a project about bacteria recognition. We chose the Fiji application to make analyses on microscope pictures for its simplicity and free availability. We are not that experienced with the imageJ application but we tried several plugins to detect the different bacteria but it’s not really efficient. Actually, we tried the shape filter plugin and the colony counter plugin which are helpful for saving the characteristics of the bacteria on a particular picture, but it’s almost useless to use these characteristics on other pictures to detect bacteria. We tried also to dilate and then use the “fill holes” option, but this method make the picture lose information so it does not work perfectly.
I included a picture to give you an example. There are seven bacteria at the top center of the picture and just one at the bottom center.
I would like to know your opinion about our problem and eventually if you have any suggestions for us, we would be glad to hear it !

Thank you so much for your answers !

Can you give us information about the microscope setup (magnification, NA, illumination etc.). And point us that what is a single bacterium in the image?

Because to me it looks like you imaged debris and not bacteria.


We are working with others students specialized in environnement engineering. They are in charge of taking and sending pictures to us. Right now we do not know about the microscope setup specifics.
Sorry for the misunderstanding, specifically we are looking for recognizing the protozoa on the one hand.

Here is the photo with the protozoa circled.

Oh ok.
The things I have tried (Weka segmentation) have failed, sorry.

Hi Tiaho

I did the following and got OK results

  1. Crop image such that there is less background and junk, but the image contains all the cells and enough “junk” so that processing isn’t trivial. This is just to make testing faster. Eventually I would go back and process the entire image.

  2. Make image gray scale (I cropped out channel 2)

  3. Rescale the image (again just to make testing faster)

  4. Apply ‘Auto Local Threshold’, using Otsu, radius=150, white background.

  5. Run Binary->Fill Holes

  6. Run Binary->Watershed (I attached what the image looks like after this step).

  7. Run “Analyze Particles” with size=500-4000.

This process seems to find all the cells, but still identifies a few false positives, I suspect you could refine this, by using smoothing and binary operations, to make the cells smoother, then add a circularity criteria, and/or make the size constraints tighter.

If you have time, I would also recommend a product called KNIME. It allows you to do all the same things as imageJ, but also has more sophisticated means of analyzing tabular data. Once you segment your cells, you end up with a big table of data (shape, size, intensity, etc.), and you can apply data analysis and machine learning to it.

You could also experiment further with the pixel based machine learning methods such as Weka, I see @tinevez tried, but often it is hard to get good results on the first try (no matter what approach you use). Often times in image processing, you have to work all day (or all week, or all month, or all year), to get good results. The results you see on a forum can be greatly improved on with determination.


Hi @Tiaho_Yannick

I got a good looking result with KNIME Image Processing:

In a first step I segmented everything which is not background and then followed it up by feature extraction and a Random Forest classifier.

The Random Forest is learned on a random sub-set of the hand-labelled segments. If you re-execute the workflow the segmentation could be different (false-positives). If you want to apply this segmentation on more images I would suggest that you hand-lable more examples of positive and negative ROIs and create a more robust model.

Here you can download the workflow (10.0 MB).


Hey ! Thank you so much for all your answers.
@tibuch at the moment we’re trying to use KNIME. We encounter some difficulties to execute your workflow. We do not know how to use this software so we cannot understand how your current workflow works. Could you give us some explanation or some advice to get started with KNIME image processing.

What happens if you import the workflow and press the green double-arrow?


In addition to @tibuch: You can find some more information about how to get started with KNIME Image Processing at (e.g. a youtube video, example workflows, etc). Also, we have recently published a tutorial,just send me ( an e-mail, then I can send you a pre-print.

I hope this helps,



Here are the logs :

Log file is located at: C:\Users\m\knime-workspace\.metadata\knime\knime.log
WARN  RowID                2:51:44    No row key column selected generate a new one
WARN  Image Reader         2:1        Encountered exception while reading image: C:\home\tibuch\Downloads\protozoa.JPG! view log for more info.
WARN  Image Reader         2:1        Encountered errors during execution!
WARN  RowID                2:51:44    No row key column selected generate a new one
WARN  Colorspace Converter 2:49:2     Missing cell was ignored at row C:\home\tibuch\Downloads\protozoa.JPG
WARN  Splitter             2:49:5     Missing cell in row C:\home\tibuch\Downloads\protozoa.JPG. Row skipped!
WARN  Splitter             2:49:5     Rows with missing cells have been removed!
WARN  Inverter             2:49:11    Invalid column selection. All columns are selected!
ERROR Random Forest Predictor 2:37       Configure failed (NullPointerException): null
WARN  Inverter             2:49:11    Invalid column selection. All columns are selected!
WARN  Inverter             2:49:11    Invalid column selection. All columns are selected!
ERROR Random Forest Predictor 2:37       Configure failed (NullPointerException): null
WARN  Image Segment Features 2:50:22    No overlapping segment found for segment with label: 88


WARN  RowID                2:51:48    No row key column selected generate a new one
WARN  RowID                2:51:45    No row key column selected generate a new one
WARN  Interactive Segmentation View 2:23       No column specified as LabelingValue: auto detection suggested column Compose Labeling(Bitmask)
WARN  Row Filter           2:50:32    Node created an empty data table.
WARN  Row Sampling         2:50:38    Node created an empty data table.
ERROR Random Forest Learner 2:35       Execute failed: The input table must contain at least 2 rows!

I assume the training-labels are gone.

If you open Configure of the “Interactive Labeling Editor”-Node (right click -> configure or double click) you should see something like this:

Maybe your pos and neg classes are empty (don’t forget to select “Highlight new?”)?

If this is the case, create the new classes pos and neg and select a couple cells for each.

1 Like

Thank you for help! It works more or less.

This is our current result:

This software is still new for us. We would like to use this in a production environnement, is there any way to export the workflow as an executable file for example? or to connect it with any programming language?

1 Like

It should work better if you have more training labels :slight_smile:.

It is not possible to create a stand-alone application from a workflow. But dependent on what you would like to do with the current result you can continue with KNIME (do some data analysis, create nice graphs with R-Nodes, create reports).

1 Like

You can run KNIME headless (i.e. without UI). Like that you can connect it to arbitrary programming languages which are able to start processes (see Furthermore, KNIME integrates with Python, Java, R, and other languages, i.e. you can call these languages from KNIME (other way round).

Hope this helps,


@tibuch @dietzc thank you again!
Running KNIME headless would be great!
Is it possible to edit the workflow parameters using a programming language (or an knime extension…) like the input image for example?

Sure you can. One way to accomplish this is partially described in this example: You would use a List Files Node which is configured by a workflow_variable which can in turn be passed via the command-line call. See for example:

and/or for the full documentation of the batch execution

./knime -nosplash -application org.knime.product.KNIME_BATCH_APPLICATION.

Hope this helps,