Identifying "blurred" and/or defocused microscopy images


I am using a nicely working KNIME + headless Ilastik workflow to segment and quantify four channel images originating from high-content screening. When taking images over several hours in multiple 384-well plates it is unfortunately unavoidable that some fields-of-view are de-focused occur as “blurry” and less intense or that some other areas are too bright due to debris or aggregates. To improve data quality and speed up the workflow (less bad data going through analysis for nothing), I would like to sort out such images at the beginning.
A number of pixel intensity-based statistical methods have been described, for example PLLS (Power log-log slope). It’s actually part of CellProfiler.

Question 1: Does such a field-of-view quality control tool/node exist already in KNIME?

In case not, I started to experiment with the FIJI plugin “Microscope Image Focus Quality”. It uses a pre-trained TensorFlow model to assess image focus in multiple tiles per image (Microscope Focus Quality). This works very well for my images. However, I don’t manage to run this macro in KNIME. The “ImageJ macro” node doesn’t execute this plugins macro code. I also could not get it working using the “Run Script” node. But I have to say I’m fairly new to combining ImageJ with KNIME, so I might be missing the obvious.

Question 2: What is the best way to run a non-preinstalled ImageJ macro in KNIME?

Thanks for your help!


Hi @jowilbertz,
Welcome to the Forum! I don’t know of a field-of-view quality control node/component in KNIME. You could probably build something with the “Image Features” node.

I am not sure about getting the “Microscope Image Focus Quality” plugin running in KNIME (I would need to investigate).
However, I have another idea that may be worth trying. You can try to use the TensorFlow model of the “Microscope Image Focus Quality” plugin with the KNIME TensorFlow Integration. The model can be downloaded from and directly loaded with the “TensorFlow Network Reader” node. You would need to reproduce the data preprocessing done by the ImageJ plugin: (I hope you know some Java :sweat_smile:).

Let me know if you need some help.

Did you try to add the plugin with the " ImageJ2 Integration (Beta)" like described here?
Note this:

Most importantly, ImageJ2 plugins can easily be added to KNIME via KNIME update sites or with the local installations of the plugins (mainly intended for development purposes). To test the local installation mode go to the Image Processing Preference Page (File → Preferences → KNIME → Image Processing Plugin) and select ImageJ2 Plugin Installation, then choose an ImageJ2 plugin jar-file, install it and restart KNIME. The plugins become availablevin the local node repository according to the menu annotations of the plugin.

(The magic does not always work – mainly depending on the parameters of the plugin)

Thanks for your suggestions @bwilhelm ! The quick fix via the ImageJ2 Plugin Installation unfortunately does not work (as you indicated), although the respective .jar file is located in the KNIME plugins folder where all the other ImageJ2 plugins are stored.

My Java skills are very limited, so I think for know I will use your first suggestion to identify blurred images.

In case someone is interested: Three methods for field-of-view quality control can be easily adapted using the Image Features node.

  1. Mean/SD ratio of the image pixel intensities
  2. Variance/Mean^2 ratio of the image pixel intensities
  3. Log-log slope of the power spectrum of pixel intensities (this one seems to perform best)

More details can be found in a publication by the Carpenter lab:

If they perform well, that’s fine for me. Otherwise I will use the KNIME TensorFlow Integration and see how far I can get.

Thanks again for all these suggestions!


Hi @jowilbertz

What do you mean by “this plugin’s macro code”? Did you record a macro call such as run("Microscope Image Focus Quality", " "); that runs well in Fiji, but doesn’t run in KNIME?
If so, did you make sure you pointed the KNIME ImageJ integration to an installation that contains your plugin, such as your local Fiji installation?

Just note that currently, the ImageJ2 integration is non-functional in KNIME 4.2, as noted by @stelfrich here:

I don’t know the current state of this issue, though.

That’s great news! Yes, the Image Features node is quite powerful for this task.

When switching to TensorFlow/Keras anyway, you might also want to train your own model for good/bad images (given that you have a sufficient amount of data). And while at it, you could probably boost performance of your whole workflow by replacing the ilastik pixel classification by a neural network as well :wink:

1 Like

Hello @imagejan

Yes, I used this ImageJ macro code in the ImageJ Macro node as “pure code”. I’m pointing KNIME to the correct FIJI plugin folder containing the corresponding .jar file. Plugin runs in FIJI, but not in KNIME. However, I’m now using the same ImageJ Macro node successfully with the external FeatureJ plugin to convolve the Gaussian smoothed nuclei channel with with a 3x3 Laplacian kernel. After calculating the variance of the resulting image and setting a threshold, the results are acceptable and I can filter out (partially) blurred images. The results are not perfect though and exploring DeepLearning in KNIME is on the list.

We have large datasets and I’m thinking about doing this, but we have many cell models with varying intensities/morphologies and at the moment I’m afraid that a lot of time will have to be invested to train models that can only be used for a very limited time. Ilastik already gives good results when training it on 5-10 images per channel, which takes only a few minutes, but course DL is the future :slight_smile:

1 Like

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.