SCIRun User Mailing List

Text archives Help

[SCIRUN-USERS] running ITK filters from Matlab: new architecture

Chronological Thread 
  • From: Ramón Casero Cañas <>
  • To: Mailing list SCIRun <>
  • Subject: [SCIRUN-USERS] running ITK filters from Matlab: new architecture
  • Date: Sat, 21 May 2011 13:04:07 +0100

Dear Utah group,

This is a bit off-topic, but because the function can read your NRRD format, I thought you may be interested.

Our group (lead by Vicente Grau, Blanca Rodríguez, Peter Kohl and David Gavaghan) is developing a function to run ITK filters from Matlab. Like MATITK, but as far as I know, they don't provide the source code, while ours is open source.

More details below, in the original release email.

Best regards,



Hi all,

Exciting news, after a substantial change in the architecture of itk_imfilter(), the Matlab function that allows to run ITK filters from Matlab has a new release

Now it looks more like a software project rather than a quick-and-dirty hack. (Despite the lack of testing units or documentation! ;) )

First of all, many thanks to Miguel Bernabeu, Joe Pitt-Francis, Raf Bordas and Pras Pathmanathan, for the useful discussions, pointing in the right direction, solving compilation problems, etc. Without their vast programming knowledge and willingness to help, I doubt this could have been finished.

Features in the new release:

- Any type of Matlab data is accepted at the input (boolean, double, single, uint8, int8, etc). Also empty matrices.

- Output type is automatically computed depending on the filter and the image.

- 2D/3D Images can be loaded as a Matlab array, or an NRRD struct (e.g. images produced by Seg3D), so it's possible to work in voxel units or real world units.

- Currently, 3 filters are available: 3D skeletonization, Signed Maurer distance map, and Danielsson distance map.

- Multiple output arguments are allowed, if the corresponding ITK filter produces more than 1 output.

- The new architecture makes it quite easy to add new filters to the program.

- Project built with CMake, so in theory it should be multi-platform and work with Linux, Windows and MacOS X. (But I have tested it only with Linux.)

- Polymorphism and dynamic casting are used to have a BaseFilter class with the default code for typical filters, while at the same time it's possible to override the defaults for filters with special requirements.

- Parser functions allow to map the run time input/output voxel type and filter type variables to compilation time templates as required by ITK without having to code a nesting nightmare.

- General code has been written for all input/output type combination. Thanks to a macro FILTEREXCLUDE, forbidden combinations can be cleanly prevented from compilation.

- Code distributed in several files makes compilation a lot faster and the code easier to expand and maintain.

- A macro FILTERINST is used for clean explicit template instantiation of the allowed input/output type combinations.

- The filtering process is clearly split up into:

   + filter->CopyMatlabInputsToItkImages();
   + filter->FilterSetup();
   + filter->RunFilter();
   + filter->CopyAllFilterOutputsToMatlab();

Best regards,


Dr. Ramón Casero Cañas

Computational Biology
Computing Laboratory
University of Oxford
Wolfson Building, Parks Rd
Oxford OX1 3QD

tlf     +44 (0) 1865 610737

Archive powered by MHonArc 2.6.16.

Top of page