SCIRun User Mailing List

Text archives Help

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

Chronological Thread 
  • From: Ghassan Hamarneh <>
  • To: Mailing list SCIRun <>
  • Subject: [SCIRUN-USERS] Fwd: running ITK filters from Matlab: new architecture
  • Date: Mon, 23 May 2011 00:15:37 +0200
  • Domainkey-signature: a=rsa-sha1; c=nofws;; s=gamma; h=from:content-type:subject:date:references:to:message-id :mime-version:x-mailer; b=o4t9I5/vAMeMHBEQXR0fM59D3Aui31LoZYE3Xl4h1Cl/9whQAr7AASzvKvB6ANgHgE 1AAswa0zT1Ww9fYmA8egkjuxxYd3tThOX9pOprJ6GZCSsPQOHmSGEhAXjZBp5O+x08wV 0lgSVUdIMzzaS5iSg3oOxtl93VKNTwBAXOJ+U=

My email to the list from my university email account account was rejected. Re-sending from my gmail account. Please see below.  


From: Ghassan Hamarneh <>
Date: May 23, 2011 12:11:52 AM GMT+02:00
To: Ramón Casero Cañas <>
Cc: Mailing list SCIRun <>, Vincent Chu <>, Ghassan Hamarneh <>
Subject: Re: [SCIRUN-USERS] running ITK filters from Matlab: new architecture

Hello Ramón et al.

The source code for MATITK is available. We have made the code available as part of our Insight Journal publication:

Please let me (and/or Vincent, cc-ed) know if you have any questions.

Best regards,

Ghassan Hamarneh, PhD

School of Computing Science, Associate Professor
Medical Image Analysis Lab,  Co-founder/director
IEEE Senior Member and ACM Senior Member

Personal homepage:
Lab homepage:
Office: Technology and Science Complex (TASC): 9417
Tel: +1.778.782.3007
SofTel: +1.778.782.2214 (internet-based)
Fax: +1.778.782.3045
Postal Address:
School of Computing Science, Simon Fraser University,
8888 University Drive, Burnaby, BC  V5A 1S6, Canada

On 2011-05-21, at 2:04 PM, Ramón Casero Cañas wrote:

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

  • [SCIRUN-USERS] Fwd: running ITK filters from Matlab: new architecture, Ghassan Hamarneh, 05/22/2011

Archive powered by MHonArc 2.6.16.

Top of page