"A trous" filter module for CellProfiler


Hello list,

I finally managed to release my optimised 2-D / 3-D libatrous library, as well as a simple CellProfiler plugin (2-D), which I often use in CellProfiler 2.4 pipelines for cleaning images before “IdentifyPrimaryObjects”.


I do have a 2-D / 3-D plugin for CellProfiler 3.0 but I need to clean it up a bit before I release it.

The “A trous” filter works pretty well for detecting roundish objects of similar sizes in an image, even in the presence of speckled noise / high background. The filter uses combined “scales” to define a range of object / feature sizes to detect in the image.

Roughly (in my mind), scales correspond to a feature size of 2^(scale_index-1) to 2^(scale_index). So scale 1 would isolate features of 1-2 pixels in diameter, scale 2 2-4, scale 3 4-8, etc… So if you wanted to detect nuclei which are roughly 20 pixels in diameter and eliminate speckle noise (scale 1) as well as the image background, you could try to select scale 4 or scale 5 or scales 3-5.

Thresholding is important to use with this filter, because each scale may have positive and negative values. So thresholding at 0 or maybe just above 0 is important. The high value depends on what you’re trying to detect. Sometimes it’s advantageous to clip the high intensity values. So choose a high value and go down from there (test mode is your friend).

The filter can be used as a nuclei / spots detector in fluorescence images or (to some extent) can detect cells in brightfield images. You may need to invert the images first with ImageMath (as below) if the objects you are trying to detect are darker than the background.

The negative image below was filtered using the “B3 Spline 5x5” filter, scale 3-3, no residual low-pass, threshold 20-500 (was a 16 bit image). Output is not normalised.


In the primary objects detection, Global Otsu / 2 classes usually works quite well, and no additional smoothing is required (important).


This is the result of the primary object identification:

I will put some demo images / pipelines together on my github, to try and explain how to best use the filter. For now, I thought I’d just put it out there and see what people think :slight_smile:



Very cool! If you want, you could submit your module to the CellProfiler plugins repository . Thanks for letting us know about it, it seems great!


Thank you, I need to look into this. I have submitted patches to CellProfiler in the past.

A slight issue is that the plugin isn’t pure Python. It relies on “libatrous” to do all the heavy lifting. It’s a multi-threaded library written in C / OpenMP.

Unless there is an easy way for people to download it (maybe as part of CellProfiler or via pip install) the plugin is not going to be very easy to test.

Kind regards,


That’s not necessarily a dealbreaker for inclusion in the plugins repo; it’s ok for things there to have extra dependencies. If you can put instructions in the repo on what people would need to do to install “libatrous” on their own machine (and whatever requirements/dependencies that it needs), I think that would still be fine. At the very least feel free to make a PR, and then our software engineers can make more informed comments on it than I can.


Thank you for the advice! I’ll rise an issue / pull request on the plugins repository and take it from there.

I had a look at how to get my library into PYPI, together with using Travis CI to generate binaries automatically… Looks complicated.

The aim of course it to have people simply do a pip install libatrous so they can start using the library. To get to that point however may not be easy.

Anyway, I have written a jupyter-notebook with a few notes and examples, which hopefully explains how to use the library:

Watch this space! :slight_smile:



@EP.Zindy Do you know about PyWavelets?




I’m pretty sure I’ve used that one in the past. And “A trous” is just another name for undecimated wavelets, which PyWavelets also does.

But, my library can filter 3-D datasets (with rectangular voxels). It was written this way specifically for processing confocal image stacks. For example, we use this library as part of an Imaris XTension to clean-up the images before doing cell tracking in 3-D.

I’ve spent quite some time optimising the code, both using separable kernels (3 1-D successive convolutions instead of convolution with a 3-D kernel) and by using OpenMP to split the calculations among all the CPU cores available.

But yes, “Over 100 built-in wavelet filters and support for custom wavelets” sure sounds interesting, and libatrous accepts custom convolution kernels, so I need to look into that package again for inspiration.



@EP.Zindy The reason I mentioned PyWavelets is because we carry this package inside the CellProfiler distribution so it would not require any additional packages. Likewise, I imagine we will start carrying TensorFlow which includes a variety of wavelets that can run in serial or parallel environments.



I’m happy to adapt my plugin code to use the undecimated wavelets in PyWavelets instead of libatrous.

Until CellProfiler 3.0 is released, it won’t matter that PyWavelet doesn’t handle 3-D arrays.