Mathematica Stack Exchange is a question and answer site for users of Mathematica. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I would like to know if someone has tried to link Mathematica with ITK code (call ITK code in Mathematica)?

share|improve this question
It looks like it's written in C++, so this more general information might be useful. – b.gatessucks Jul 19 '12 at 14:26
It seems you've been looking for something like this for a while: It's the only related post Google gives me. If you implement it yourself, be sure to let us know! – Szabolcs Jul 19 '12 at 14:28
From what I can tell ITK is already integreated, run a WatershedComponents filter and watch for an ITK process to appear. – s0rce Jul 30 '12 at 0:06
Maybe we should give this a go using LTemplate ... I actually wanted to use an ITK filter from Mathematica today, but didn't have time to figure it out. Never used ITK before. – Szabolcs Oct 12 '15 at 19:48
Try evaluating ?Image`ITK`*. – Szabolcs Oct 19 '15 at 15:43

ITK seems to have already been implemented using MathLink. Watch your processes when you run a WatershedComponents filter, you can see an ITK.exe process appear. I'm not too familiar with MathLink but maybe this very simple starting point can be taken further by people who know how to use MathLink.

This is a Windows-centric example:

itk = LinkLaunch["C:\\Program Files\\Wolfram Research\\Mathematica\\8.0\\SystemFiles\\\Converters\\Binaries\\Windows\\ITK.exe"]

LinkObject["C:\\Program Files\\Wolfram \Research\\Mathematica\\8.0\\SystemFiles\\Converters\\Binaries\\\Windows\\ITK.exe", 33, 12] 





LinkWrite[itk, 5]

"Image`ITK::filterr = \"`1` generated code `2`: `3`\";"

It would be nice to have the source code of the compiled ITK MathLink executable. ITK is released under an Apache or BSD license which, I think, means that Wolfram can use the code in a closed source application and not release it as long as they provide a copy of the license.

share|improve this answer
It is there: FindList[FileNameJoin[{$TopDirectory, "SystemFiles", "FrontEnd", "TextResources", "AboutBox.nb"}], {"ITK", "Insight"}] gives {"Cell[\"ITK\", \"LicenseText\",", "Copyright (c) 1999-2003 Insight \ Software Consortium All rights reserved.\\", "* Neither the name of \ the Insight Software Consortium nor the names of its \\"} – Rolf Mertig Jul 31 '12 at 20:19

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.