Giving streaming and multi-threading capabilities to non-streamable ITK filters

Please use this identifier to cite or link to this publication:
This document describes a filter able to give streaming and multi-threading capabilities to those filters that can not be easily streamed or multi-threaded. The goal of this document is to explain the implementation of this filter, and how it can be used to turn non-streamable filters to streamble ones. It also describes the testing strategy.
minus 1 Dataset (11Mb)
There is no code review at this time.

minus A great contribution for streaming and multithreading by Gaetan Lehmann on 2009-01-04 12:32:58 for revision #2
starstarstarstarstar expertise: 4 sensitivity: 5

The author describe a new filter made to give streaming and threaded capabilities to non streamable and non multithreaded filters, at the cost of some possible differences in the resulting image.


Processing the image zones by zones should have a low impact on the produced image. The impact can be decreased by adding a margin to the zones to avoid the border effects on the border of the zones.


The author provide a test which show that this method can produce the exact same result with a large enough margin.

Open Science:

The source code is provided as well as the input images.


I've been able to download, build, run the code with the test program and validate the results with the test suite. Keep contributing thing as easy to reproduce as this one!

Use of Open Source Software:

ITK all the way

Open source Contributions:

The code is usable without any problem, and very clearly documented both in the article and in the code. Using it is a matter of minutes.

Code Quality :

The code is nice, even if it doesn't always follow the ITK coding style. You may want to check your code with KWStyle.


This contribution would allow to use many filter which were not usable on large images before that.

Free comment :

A few comments:

  • I think that it would be possible to extend the filter to be able to work with filters which requires more than one input. itk::SliceBySliceImageFilter is doing it already.

  • Don't you think that copying all the output of the internal filters in the outputs of the streamed filter would be better than selecting a single output?

  • I think that the streamed filter must call SetNumberOfThreads( 1 ) on the internal filter, to ensure that not more thread that what the user expect will be used.

  • I think that a non threaded version wich suports a pipeline of several filters would be useful: it would let the user stream a filter without having to subclass the streamed filter (as it is done with the slice by slice filter). Also, this kind of filter is easy to add in the wrappers, where type must be explicitely given a build time. On the opposite, the current version would be very hard to use in the wrapper.

  • We now have several filters in the Review directory and in the IJ which are calling user defined filters during there execution. We should look at all the implementations of that kind of filters around and see how we can reuse code, find common naming conventions and maybe add a similar class able to add either thread or pipeline support (itk::SliceBySliceImageFilter, itk::MiniPipelineSeparableImageFilter, itk::MaskAdaptorImageFilter, itk::ObjectByObjectLabelMapFilter, ...)


minus Great features to easily enable more filters to be used with big images/multiprocessors by Emmanuel Christophe on 2008-12-11 03:40:32 for revision #2
starstarstarstarstar expertise: 3 sensitivity: 5

One of the great point of ITK is its ability to take advantage of multiprocessor (threading) and to process large data-set without allocating too much memory (streaming).

However, some algorithms can't be easily process for only an extract of the data. This is visible in the ITK filters which internally require a call to LargestPossibleRegion().

In this paper, the author describe a way to implemente a simple wrap around these filter to enable threading and streaming capabilities.


The assumption made is that the algorithm is tolerant to boundary condition and that using only a small margin won't greatly affect the result.

This is a reasonable assumption given the fact that algorithm are usually applied to the arbitrarily limited image with artificial boundary conditions.


The wrap around the RecursiveGaussianImageFilter is provided. No difference is observed between the output of the streamed filter and the original one.

Open Science:

All the source code is provided, explanation are sufficient to reproduce the wrapping on other filters.


The code compiles well with InsightToolkit-3.10.1 and tests provided all pass.


Use of Open Source Software:

The author uses open source software in his work, but his experience with it is not described in the paper.

Open source Contributions:

All the source code is well detailed and don't take long to understand for an ITK user.

Code Quality :

I compile the source code on a linux system and I didn't noticed any non-portable mechanism. The code has plenty of comment and the corresponding doxygen documentation.

Quality of the data :

One color image is provided: 2272x1704 pixels.

The interest of the proposed method would be better demonstrated with a bigger image, but I believe that it is not convenient to upload huge data-set.


This method could be applied to any filter that can't be easily streamed and which need to be applied to big images.

Add a new review
Quick Comments

Download All
Download Source code

Statistics more
Global rating: starstarstarstarstar
Review rating: starstarstarstarstar [review]
Code rating:
Paper Quality: plus minus

Information more
Categories: Code memory optimization, Code speed optimization, Parallelization, SMP, Streaming
Keywords: Streaming, Multi-threading
Export citation:


Linked Publications more
Diffeomorphic Demons Using ITK's Finite Difference Solver Hierarchy Diffeomorphic Demons Using ITK's Finite Difference Solver Hierarchy
by Vercauteren T., Pennec X., Perchant A., Ayache N.
A Label Geometry Image Filter for Multiple Object Measurement A Label Geometry Image Filter for Multiple Object Measurement
by Padfield D., Miller J.

View license
Loading license...

Send a message to the author
Powered by Midas