Project Description

For computation of motion estimation in tagged-MRI, the interactive and augmented modelling group  has developed the Harmonic Phase Flow (HPF) plugin. HPF is a variational approach that works in the Gabor domain, ensuring optical flow invariance as well as motion tracking robustness. Additionally, HPF computes wall deformation without overestimating motion at injured areas.

  Clinical diagnosis


Hospital Sant Pau


Tagged MRI

Since the development of Tagged MRI, in the late 80’s, many analysis techniques have been developed for motion extraction. Unfortunately, tagging studies are still not widely used in the clinical routine for two reasons:

  1.  There is a lack of reference values for new data derived from such imaging modality (stress, strain, torsion)
  2.  commercial software capable of dealing efficiently with the great amount of data provided by the tagging studies is scarce.

Clinical tool

Osirix is a popular opensource DICOM viewer for the Mac. It is actively developed by Pixmeo , Switzerland. It has become popular in the last years, since it integrates a user friendly interface for medical imaging visualisation with powerfull plugin system that extends its functionaly, enabling advanced image processing techniques

The Sant Pau hospital uses OsiriX as the preferred tool for TMR sequence viewing. Because of this, it is interested in the development of a plug-in for the extraction and validation of myocardial torsion from their TMR sequences. We have previously built a prototype in Matlab for this purpose. However, communication between Matlab and OsiriX is slow and memory intensive. Therefore we have decided to port existing code into Objective C.



An object oriented framework for Mac OS X. Communication between the graphical user interface elements and inner data requires the design of cocoa objects with the Objective-C language

Objective C

A dynamic, object-oriented language, based on a set of extensions of ANSI C. It is the language of choice for Cocoa development.


The graphics API choice for both 2d and 3d rendering. At large sequence lengths, it is beneficial for fast visualisation operations.


The Visualization Toolkit (VTK) manipulates data, reconstruct multiplanar slices, performs volume and surface rendering with 2D or 3D texturing.


The Insight Toolkit (ITK) is an open-source library for image registration and segmentation written in C++. Its foundation is the VNL (numerics) library for matrix algebra, which we also use in our own code.


Papyrus toolkit and DICOM Offis (DCMTK) handle specific details of the DICOM image format used by the TMR sequences.


Core-plot is a recent plotting library for MAC OSX and IOS. It allows for rich visualization of the torsion data.


The Fastest Fourier Transform in the West (FFTW) is an implementation of the discrete Fourier transform (DFT) that adapts to the hardware in order to maximize performance.


Alglib is a cross-platform numerical analysis and data processing library used for interpolation of the rotation of two LV views with different -end-diastole lengths

Our Solution

We implemented an in-house fully automated method for tissue deformation estimation in tagged magnetic resonance images (TMRI). We call this schema the Harmonic Phase Flow. The method consists of two main stages, namely Gabor Filter Bank computation and sequence filtering.

Gabor Filter Bank computation

We built two Gabor filter banks for each tag orientation. Both banks are fine-tuned  for each left ventricle level. This allows for an optimally filtering of  complex images. This is crutial, since  the complex phase   remains constant along the cardiac cycle. This  brightness constancy condition is required by classical optical flow (OF) methods.

Sequence Filtering

Both filtered sequences belonging to a variational formulation schema  are used in a to obtain a dense continuous deformation map. We consider this as Harmonic Phase Flow.

This method has been used to determine reference values of ventricular torsion (VT) in a set of 40 healthy volunteers. The results encourage the use of ventricular torsion as a useful parameter for ventricular function assessment in clinical routine.


Due to the complexity of the original implementation, we broke down the process into several tasks.

OsiriX platform acquaintance

To translate Matlab code into native Objective C, we looked at other existing plug-in implementations, such as Brian Jensen’s NMSegmentation plugin from the Technische Universität München. In order to familiarise with the OsiriX plug-in SDK, we developed an initial version which only used a fixed set of points as the input LV. After this, we evolved these points in time using a set of pre-calculated HPF motion matrices. We consider the ventricular torsion as the difference in rotation at two different Short Axis views of the same sequence. To validate our results, we measured the absolute error between the global mean VT of our prototype and Matlab. Additionally, we ensured that the plot curves followed the expected tendency in both cases

HPF computation

HPF is a regularised spectral optical flow, under a variational framework that uses the maximum response of a set of Gabor filters banks. This flow characterises the ventricular torsion in healthy subjects.  In step 1, we detect the harmonic peak which we use for building the Gabor filter banks (step 2). The combination of the response of banks produces a complex image whose phase is related to tissue motion (module 3). Finally, the we track the amplitude of the maximum response for building the displacement map.

Get the plugin now!


This tool is designed for clinical research only. Harmonic Phase Flow is not a medical device, and is not certified by any official organism, including the Federal Drug Agency (FDA) or the European Medicines Agency .

Licence: GNU public licence v3.


Albert Andaluz, Francesc Carreras, Cristina Santa Marta, & Debora Gil. (2012). Myocardial torsion estimation with Tagged-MRI in the OsiriX platform. In Wiro Niessen(Erasmus MC) and Marc Modat(UCL) (Ed.), ISBI Workshop on Open Source Medical Image Analysis software. IEEE.


Get the binaries!

This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>.


Get the sources!







User's guide


ISBI2012 Poster


Short overview

Back to Top