MATITK: EXTENDING MATLAB WITH ITK
Abstract
To facilitate the analysis of medical image data in research environment, MATITK is developed to allow ITK algorithms to be called in MATLAB. ITK is a powerful open-source image analysis toolkit, but it requires the knowledge of C++ to use it. With the help of MATITK, researchers familiar with MATLAB can harness the power of ITK without learning C++ and worrying about low-level programming issues. A common set of C++ classes have also been produced to allow future ITK methods to be added to MATITK therefore callable in MATLAB without the bothersome translation between MATLAB and ITK.
Keywords
Source Code and Data
File
Image
Image
Select a file to preview
Reviews
Karthik Krishnan
Monday 30 January 2006
Compiling matitk.dll I was able to compile the code with VS71 as the compiler. If the matlab version you have is old (for instance 6.5), you will need to get the options file for VS71.
I made the suggested changes to the bin/win32/mexopts/msvc71opts.bat file. (setting ITKBIN, ITKSRC environment variables and adding the working directory to the list paths. path(path,“c:/tmp/foo”)).
I had two errors compiling the code, since the code was instantiating curvature flow filters etc on unsigned int images. The errors were trivial to remove. Below is the patch to remove the compiler errors and will be fixed in ITK CVS.
Regarding the dll shipped with the paper, the permissions of the dll needs to have executable permission otherwise matlab fails to load the dll.
Testing
I was able to load the built in mri dataset and perform filtering etc in a jiffy. That was convenient.
Usability
Traditionally matlab has been a storehouse for well established image processing/ enhancement algorithms. There are several external analysis packages available such as LightSpeed, SPM etc.. I do not know of any packages that perform registration. ITK on the other hand has bleeding edge segmentation and registration algorithms along with basic image processing algorithms.
A very useful thing to do will be to conveniently perform registration in ITK and continue with filtering and analysis in MATLAB, since MATLAB lacks registration algorithms. MATITK provides two registration algorithms, Demos and TPS. I tried out Demons and it seemed to work fine. It should probably supply a lot more registration algorithms. Also, there is no way to currently specify the origin or the images. For instance the fixed and moving images could be acquired in different reference frames.
Any submission to MATLAB central ?
Inclusion in the toolkit
I propose the framework be included with InsightApplications. I am sure many in the academic community would find it useful.
Index: Algorithms/itkMinMaxCurvatureFlowFunction.txx
RCS file: /cvsroot/Insight/Insight/Code/Algorithms/itkMinMaxCurvatureFlowFunction.txx,v retrieving revision 1.23 diff -u -b -r1.23 itkMinMaxCurvatureFlowFunction.txx --- Algorithms/itkMinMaxCurvatureFlowFunction.txx 13 Mar 2005 23:19:40 -0000 1.23
@@ -369,7 +369,7 @@ { gradient[2] = -1.0; }
theta = acos( gradient[2] );
theta = acos( (double)gradient[2] );
if ( gradient[0] == 0 ) { @@ -377,7 +377,7 @@ } else {
phi = atan( gradient[1]/ gradient[0] );
phi = atan( (double)gradient[1]/ (double)gradient[0] ); }
Index: BasicFilters/itkSparseFieldLevelSetImageFilter.txx
RCS file: /cvsroot/Insight/Insight/Code/BasicFilters/itkSparseFieldLevelSetImageFilter.txx,v retrieving revision 1.36 diff -u -b -r1.36 itkSparseFieldLevelSetImageFilter.txx --- BasicFilters/itkSparseFieldLevelSetImageFilter.txx 22 Dec 2004 15:18:23 -0000 1.36
@@ -480,7 +480,7 @@
{ this->SetRMSChange(static_cast
this->SetRMSChange(static_cast
( vcl_sqrt(rms_change_accumulator / static_cast (counter)) ) );
this->SetRMSChange(static_cast
( vcl_sqrt((double)(rms_change_accumulator / static_cast (counter)) )) ); } }
@@ -841,7 +841,7 @@ length += dx_backward * dx_backward; } }
length = vcl_sqrt(length) + MIN_NORM;
length = vcl_sqrt((double)length) + MIN_NORM; distance = shiftedIt.GetCenterPixel() / length;
output->SetPixel( activeIt->m_Value ,
