Get your Python 2.4-enabled VTK 5.1 (Paraview-3-0 branch as of 20070801) and ITK 3.2 Windows binaries by clicking on the following link: http://visualisation.tudelft.nl/~cpbotha/files/vtk_itk/
IMPORTANT: you HAVE TO to install the MS VS2005 vcredist_x86 package (free!) if you want to use these DLLs (thanks Jelle for pointing this out). In future, I might include the relevant assemblies in the downloads, I’ll let you know.
I’ve built these with Visual Studio 2005 (8.0) SP1 for Python 2.4.x (NOT 2.5) on Windows XP SP2. ITK has been built with the brilliant built-in WrapITK support. VTK has been modified with my python-exception-patches (I hope to commit these to VTK CVS soon). I’ve also rebased all DLL and PYD files so they don’t have to be relocated at run-time, saving you time and memory.
I’m making these available as they might coincidentally scratch someone else’s itch. I have no time to build binaries with your specific configuration requests, so please don’t ask.
That being said, please leave a comment on this blog posting if you use these. It’s almost like postcard-ware, but with blog comments. Please also link to this page and not directly to the download location, thanks!
To use this from Python, you need to add the following to your PATH:
- d:\opt\VTK\bin
- d:\opt\ITK\bin
- d:\opt\ITK\lib\InsightToolkit\WrapITK\lib
You also need to add all of the above to PYTHONPATH, as well as the following:
- d:\opt\ITK\lib\InsightToolkit\WrapITK\Python
- d:\opt\VTK\lib\site-packages
… where d:\opt is the drive and directory where you unpacked the two ZIP files.
Once you’ve done this and logged out and in again, “import vtk” and “import itk” should work at the Python prompt. Shameless plug: you can use my free envedit software to do the environment editing. It beats the default XP editing thingy.
UPDATES
- 20071015 M5: VTK now has Parallel kit built as well.
- 20070909 M4: Changed available types in ITK build. It now has: complex float, float, signed short, unsigned long and vector float, for 2 and 3D.
- 20070905 M3: Includes fix for extremely obscure progress-event-cancels-VTK-error-exception bug. It’s obscure (as in it was incredibly hard to find) but it could still bite you.
- 20070829 M2: I’ve put up new VTK binaries (see the M2 in the filename) that include my shader fixes and also an updated version of the wxVTKRenderWindowInteractor (from current CVS head) with more fixes to deal with the new VTK/Python exception support.

55 Comments to “Python-enabled VTK 5.1 and ITK 3.2 Windows binaries”
August 3, 2007
Hi Charl,
Really, you’re spoiling us! ITK can be quite a challenge to compile, not for the faint hearted. Did you use the cmake files supplied by the ITK CVS version out-of-the-box?
August 3, 2007
Hi there Jelle! Yes, this is a default ITK-3-2 checkout, so everything is out-of-the-box (AFAICR :).
August 3, 2007
Hi Charl,
Thanks so much!
Though I’d like to add (as you implicitely point out) that one has to have the vc8.0*sp1* runtime installed. It can be obtained from here: http://www.microsoft.com/downloads/thankyou.aspx?familyId=200b2fd9-ae1a-4a14-984d-389c36f85647&displayLang=en
(its a redistributable file, hint ;’)
Charl, just one tiny comment: vtk can be compiled with the GL2PS flag enabled, which offers a pretty spectacular feat in my mind: that of being able to output vector graphics (latex, pdf, ps, eps) of your scene. I can imagine your efforts might benefit from this.
i’m not hinting at specific config needs
all for the greater good!
August 3, 2007
Charl,
Seriously, the new error handling in vtk is the best thing since sliced bread! A massive improvement, thanks!
August 11, 2007
Just wanna say “thank you very much for this”!!!
I was looking around for about 1 month for a binary VTK package WITH python libraries….
(only thing to say; MinGW would be better compiler for this… but forget it, since you did it and I don’t…. ;))
August 13, 2007
DrTrigon, thanks for the thanks!
I usually try to use the compiler that most other VTK users use on that specific platform. That way, there’s a smaller chance that one runs into difficult-to-solve obscure compiler problems, as somebody else has probably run into it already and fixed it.
August 21, 2007
Hi! Have you managed to build the _d.dll python libraries (the debug ones, linked with python25_d.lib) ?
August 21, 2007
My binaries are built with the RelWithDebInfo target, so most of the VTK and ITK DLLs make possible debugging to a certain extent, but I did not link to the debug version of the Python DLL. Do you need to jump into the Python source?
August 28, 2007
hello, do you have some tcl-enabled ITK binaries? or could you roughly give me some guideline on how to make tcl to work with ITK. since last time when i played with VTK i choose to use tcl now i want to do something with ITK, it seems that i have to use c rather than tcl. please give some guidelines for it. thank you.
August 28, 2007
@vislab:
No, I have no tcl-enabled ITK binaries, I’ve also never built WrapITK with Tcl support. Have you tried the ITK mailing list? Alternatively, you could just switch to Python since it’s so much better than Tcl. ;P
September 5, 2007
Hi Charl,
Have you every tried creating a Windows executable using py2exe using python wrapped itk and vtk libs?
September 5, 2007
Howdy Pieter!!
I make the DeVIDE binaries (along with these VTK and ITK libraries) with PyInstaller, it does the same type of thing as py2exe. Due to the new-fangled MS side-by-side (sxs) embedded manifests and whatnot, I did have to do some extra work though. (in short, I checked with depends.exe which dependencies the VTK and ITK libraries have, and just included the complete Microsoft.VC80.CRT redist assembly, including the manifest file.) That way, I don’t have to ask users to install vcredist_x86. Also, a nice clean XP VMWare image helps testing immensely.
See you on Friday!
September 8, 2007
Charles,
I know you wrote don’t asked me to build your favourite configuration, well, my browser doesn’t show that part!
Here is the problem: the whatershed filter has this annoyingly fixed unsigned long output and it seems unsigned long is not wrapped in your binaries. So, when the pipeline reaches a watershed filter, that’s a deadend. Do you know any work arounds?
September 8, 2007
@Ali:
Oops, that is an oversight on my part. I used to build pre-3 binaries with unsigned long exactly for that reason, I just forgot this time. I don’t know of a work-around…
Next time I build (I don’t know exactly when), I’ll activate UL.
September 8, 2007
@Ali:
I just uploaded a new ITK build, see the “M4″ change note at the end of my posting. This one includes support for unsigned long (UL).
September 9, 2007
Thanks Charlie! Weekend and xmass delivery of binaries, impressive.
You did not exclude unsigned char did you?
September 9, 2007
@Ali:
Of course I did.
One can’t have one’s cake and eat it… if I include both types, I get errors in Visual Studio concerning too many segments per object. One could use /bigobj at strategic locations to work around this, but then it starts turning into a manual affair. What exactly do you need unsigned char for? Can’t you cast to signed short?
September 9, 2007
Charl,
- That error, is it limited to the VS compiler? would gcc have the same problem?
- I need the wrapper to read 8-bit images. Now if the wrapper does not come with the unsinged char type wrapped, I guess the c itk image reader class automatically casts whatever image type it reads to the type it was templated over. If that’s correct, I shouldn’t have a problem.
- This casting thing in the wrapped level is somehow confusing. If we do not have the UC type in python, we cannot create a casting object as the constructor needs an image type of UC type, is that right?
September 10, 2007
I haven’t compiled this specific release of ITK with this many wrappings on GCC yet, so I don’t know.
Judging by your explanation, this shouldn’t be a problem. ITK will internally cast the output of an itkImageFileReader for you, so if you instantiate a signed short reader like so:
r = itk.ImageFileReader[itk.Image[itk.SS, 2]].New()
ITK will try to cast the output to that. I’m not sure what it’s going to do with the RGB tuples (if you have those) though. Just give it a shot!
Are you working exclusively with ITK? I tend to do a lot of stuff with VTK (it’s much leaner and fits Python better as well) and only flip over to ITK when necessary.
September 10, 2007
I have to admit when you compared ITK and VTK like that, I had to double check the VTK nightly documentation to see if the project now includes serious image processing. Needless to say, the two project are not really comparable and the only overlapping parts of them would be mainly the beginning and end of their pipelines, that is, reading and writing images.
It is true that VTK fits Python better, and you can extend VTK classes in the wrapped languages easier. However, t the end of the day, VTK is and is intended to remain as a visualisation tool. If you want to implement some sophisticated image processing algorithm, you will need to re-implement many other dependencies, which already exist in ITK, in VTK — it’s just not practical.
WrapITK seems to be a good start for porting ITK to higher levels. It is true that it’s a pain to wrap a template-based library, it is even worse when the library is big and dynamically growing. But, to my mind, WrapITK does a good job for an start and potentially it can be much more optimised, both for compilation and runtime efficiency, as the wrapping architecture itself does not have the best design.
There is one more reason for me to stay with ITK. Recently, things like the insight-journal have inspired academia to contribute to the library. It is good to see that finally people who publish a paper, also publish the corresponding code as a part of an open source library. This is much more useful than mentioning in the paper that ‘we implemented the algorithm in [bloody] MATLAB’, which is not free, its image processing and visualisation is generally slow and it is very likely that if you contact the author for the code you will receive a ‘no’ if not nothing. Hopefully, wrapping ITK to higher level languages may make it, in practice, a fast and free version of MATLAB image processing toolbox which could encourage people to commit their free add-ons.
September 10, 2007
You speak as one who has read much documentation, but has had little practice.
I didn’t say that VTK could replace ITK, I said that I tend to use VTK most often and only flipped over to ITK when need be. In spite of all its functionality, Python-ITK can be a real pain, usage-wise, bug-wise and memory-wise. I’ve implemented a number of image processing routines as VTK filters, in spite of all the extra things one needs to code, for exactly that reason. Just to still any possible arguments, I’ve also coded image prcessing algorithms as ITK filters.
It’s probably a case of different folks, different strokes. Enjoy!
September 10, 2007
> I tend to use VTK most often and only flipped over to ITK when need be.
What is the advantage of doing so? Apart from being comfortable in the Python-VTK environment, I cannot think of anything else. It’s not even more efficient as if, in one of your ‘flips’, you call a little ITK class, it might wake up, invoke and load its whole giant family.
I used VTK heavily in my phd project, that was until about 2005 when ITK was mature and documented and I ported the image processing jobs to there. Of course I still use VTK for the visualisation part.
If you intend to write some good code, do not put it somewhere that may go down the sink!
September 25, 2007
Hi Charl,
I noticed there are quite a few swell addition in your distribution, I’m referring here to anything vtktud*.
Could you inform me about licensing related to this code?
Does this fall into the BSD / MIT / GNU category?
Thanks for your efforts!
-jelle
September 25, 2007
Charl,
The obvious next question would be if any docs are available related to the additional ( vtktud*/vtkdevide* ) functionality ;’)
cheers,
-jelle
October 6, 2007
@jelle:
These are two libraries that are used internally by our research group. Some of the code could be made available, but some of it is heavily proprietary (developed under contract, and what not).
October 11, 2007
And do you have Mac OS X version.
Just kidding. I’m compiling it now.
October 18, 2007
Hi,
Just a few words about the unsigned long issue: it shouldn’t be an issue
Several reasons for that :
* The watershed filter is limited to unsigned long (UL) as output but there are several filters to come back to a wrapped type (CastImageFilter and RelabelImageFilter) which should be usable for that task even when UL is not chosen in the options
* There is a new watershed filter (contributed by Richard Beare and I) which support other output types than UL
Gaëtan
November 30, 2007
Many thanks for making binaries available. I have tried and failed several times to build vtk with python. Interested to see if I can finally have a go at using it.
November 30, 2007
In case someone gets a message box with:
python.exe - Entry Point Not Found
The procedure entry point PyVTKClass_vtkOnePieceExtentTranslatorNew could not be located in the dynamic link library vtkCommonPythonD.dll
It is fixed by making sure the right dll’s come first in the path - I had some others floating around too.
March 9, 2008
Hi, can these binaries be used with Microsoft visual studio 2008 express.
if yes then please tell me what settings it requires.
I can not afford to compile ITK VTK
Please reply soon.
Thanks.
March 10, 2008
Probably not. They were built with VS 2005. I am not planning to upgrade to 2008 in the near future.
March 10, 2008
Hi Charl,
thanks a lot for the itk binaries, they work perfectly! I have built the external WrapITK project PyBuffer with VS 2003 and it works together with your binaries on my PC - but nowhere else (I still could’t find out why).
Do you have that feature running, possibly compiled with VS 2005? Or, do you think it’s possible to link to your prebuilt binaries when building external projects with VS 2005?
Thanks a lot,
Johannes.
March 10, 2008
Hi there Johannes!
Two things:
1. I have new ITK 3.4 binaries for Windows which I’ll upload soon. Also see the latest DeVIDE open source release for more fun and games: http://visualisation.tudelft.nl/Projects/DeVIDE
2. I will look into the PyBuffer compilation when I prepare my next build. I have now ported my build system (called “johannes”, I kid you not!) also to Windows. See here: http://code.google.com/p/devide/source/browse/trunk/johannes/README.txt
March 21, 2008
Hello, first sorry for my english
I have installed MS VS2005 vcredist_x86 package and add ‘C:\VTK\bin’ (I don’t need ITK, VTK is fine for me) to my Windows Environment (PATH) and also to PYTHONPATH here it is:
>>> sys.path
['', 'C:\\WINDOWS\\system32\\python24.zip', 'c:\\', 'C:\\Python24\\DLLs', 'C:\\Python24\\lib', 'C:\\Python24\\lib\\plat-win', 'C:\\Python24\\lib\\lib-tk', 'C:\\Python24', 'C:\\Python24\\lib\\site-packages', 'C:\\Python24\\lib\\site-packages\\win32', 'C:\\Python24\\lib\\site-packages\\win32\\lib', 'C:\\Python24\\lib\\site-packages\\Pythonwin', 'C:\\Python24\\lib\\site-packages\\wx-2.8-msw-unicode', 'C:\\VTK\\bin', 'C:\\VTK\\lib\\site-packages']
and when I try to import vtk
>>> import vtk
Traceback (most recent call last):
File “”, line 1, in ?
File “C:\VTK\lib\site-packages\vtk\__init__.py”, line 36, in ?
from common import *
File “C:\VTK\lib\site-packages\vtk\common.py”, line 9, in ?
from vtkCommonPython import *
ImportError: DLL load failed: This application has failed to start because the application configuration is incorrect. Reinstalling the application may fix this problem.
Can yo please tell me what I am doing wrong.
Much thanks.
March 21, 2008
Hmmm, this still does look suspiciously like a vcredist error. Could you download the dependency walker for your platform from http://www.dependencywalker.com/ and then open vtkCommonPython.dll with it to see what the errors are?
March 21, 2008
I can not find vtkCommonPython.dll, I have onle vtk.CommonPythonD.dll and for that one I am have missing dependency MSVCP80.DLL, MSVCR80.DLL, EFSADU.DLL, MSJAVA.DLL. I am not sure what MSJAVA.DLL has to do with all this.
I think this will solve my problem, thank you very much
sorry for my english
March 21, 2008
@srx: Aaah, that’s what I meant.
MSVCP80.DLL and MSVCR80.DLL are part of the VS 2005 redist. Which version of the vcredist did you install? Can you check that these DLLs are in your windows\system32 directory?
March 21, 2008
I have installed this one http://www.microsoft.com/downloads/details.aspx?familyid=32BC1BEE-A3F9-4C13-9C99-220B62A191EE&displaylang=en from start of the page. But search can not find any of this libraries in windows\system32 directory. I downloaded those library and place them in windows\system directory and run dependency walker and get this error:
Error: The Side-by-Side configuration information for “c:\program files\vtk\bin\VTKCOMMONPYTHOND.DLL” contains errors. This application has failed to start because the application configuration is incorrect. Reinstalling the application may fix this problem (14001).
I will try to reinstall VS 2005 redist.
March 21, 2008
@srx: The problem could be that with the new SxS (side-by-side) DLL configuration, having the DLL is not sufficient. There are also a number of manifest files in the vcredist package that have to be installed in the right place.
March 21, 2008
Yes, that’s it. Reinstall did the trick, I don’t know what happen the first time, but now everything works just fine. Thank you very much for help, and for great VTK win32 binary.
March 21, 2008
@srx: Glad I could help!
I’ll be uploading updated binaries (VTK 5.1 pv-3-2-1 tag and ITK 3.4, both for Python 2.5) soon. I’ll update this posting when that happens.
April 17, 2008
Hey cpbotha, i have the same problem as srx and i did the same things as he did to fix it, but it doesn’t work! Do you have another idea? The Dependency Walker says
Error: The Side-by-Side configuration information for “c:\python25\itk\bin\ITKCOMMON.DLL” contains errors. (14001).
Warning: At least one module has an unresolved import due to a missing export function in a delay-load dependent module.
I’ve already reinstalles VS 2005 redist. ITK works, but VTK makes problems
My path is:
>>> sys.path
['C:\\Python25', 'C:\\Python25\\Lib\\idlelib', 'C:\\PYTHON25', 'C:\\PYTHON25\\DLLS', 'C:\\PYTHON25\\LIB', 'C:\\PYTHON25\\LIB\\LIB-TK', 'C:\\Python25\\ITK\\bin', 'C:\\Python25\\ITK\\lib\\InsightToolkit\\WrapITK\\lib', 'C:\\Python25\\VTK\\bin', 'C:\\Python25\\VTK\\lib\\site-packages', 'C:\\Python25\\ITK\\lib\\InsightToolkit\\WrapITK\\Python', 'C:\\WINDOWS\\system32\\python25.zip', 'C:\\Python25\\lib\\plat-win', 'C:\\Python25\\lib\\site-packages']
April 17, 2008
So after you installed the redist, ITKCommon did not give errors any more, but VTK still gave errors? Your posting is slightly confusing, because your error message concerns ITK, but you say that ITK works and VTK doesn’t.
Which errors do you see with VTK?
April 17, 2008
Mo is using python 2.5. Can this be source of the problem?
sorry for my bad English
April 17, 2008
Oh Yes, i’m sorry, that was my mistake. I have stall deinstalled
and i’m not very familiar with this administration issues. So, when i open vtksys.dll or vtkCommonPython.dll or vtkCommon.dll with Dependency walker there’s always an error:
2.5 and installed 2.4. But it still isn’t working. Please help me because i’m running out of time
Error: The Side-by-Side configuration information for “c:\python24\vtk\bin\VTKCOMMONPYTHOND.DLL” contains errors. (14001).
Error: The Side-by-Side configuration information for “c:\python24\vtk\bin\VTKCOMMON.DLL” contains errors.
(14001).
Error: The Side-by-Side configuration information for “c:\python24\vtk\bin\VTKSYS.DLL” contains errors.
(14001).
Warning: At least one module has an unresolved import due to a missing export function in a delay-load dependent module.
and the MPR.DLL is red colored, but not missing. Whne i open MPR.DLL’s detail, there is a red line
N/A N/A WNetRestoreConnectionA NotBound
I’m sorry, i don’t understand that. Do you have any idea?
Thank you!
April 23, 2008
side-by-side error:
I have had the same errors with itk when I tried to run my code on another PC. Finally I had to suspect Microsoft for having changed the redist-package.. Instead of installing the redist from the download link I copied the MSVC80 parts of my WinSxS-Folder and the corresponding manifests to the other PC and it worked. (both WinXP Prof.)
Is MSVC80 preinstalled on VISTA? Then it could work without the redist-package at all…
May 2, 2008
Hi, cpbotha.
I’m using your wrapitk to read dicom files. It’s too slow to access pixel data and I think the reason is the function GetPixel([col,row]). Is there any efficient way to copy the all pixel data into one string or buffer or something like that? (I don’t speak English well, may be read strange)
Thanks.
May 2, 2008
This will always be a problem (reading pixel-by-pixel from Python). What exactly do you want to do with the data? I would recommend using one of the ITK classes to do the image operations instead.
May 2, 2008
I just want to show the image on the screen with PIL. For the case 16-bit, convert it to 8-bit.
Actually I’ve found some words said itk has an iterator to handle this, also PyBuffer can accept the pixel data. But they seem not to be in wrapitk.
May 2, 2008
Hmm, it’s true that PyBuffer isn’t there.
Two possibilities:
1. If you really need this, I can look into integrating PyBuffer into my new ITK 3.6 Windows builds.
2. You could consider looking into using GDCM + its VTK bridge instead. That is, unless you’re already using ITK for a number of other things.
Is this for a new application? Or do you just need this functionality for your research?
The new DeVIDE (visualisation.tudelft.nl/Projects/DeVIDE - upcoming 8.5 release) will have a fully functioning DICOM local database browser built in, based on the newest GDCM2 and its VTK bridge.
May 2, 2008
Thanks a lot for your earnest.
I will try GDCM then. It’s not a research after all, and I’m only an undergraduate working on a project (or assignment?).
June 25, 2008
Hi,
Are you still planning to share ITK binaries for Python 2.5?
I’ve been trying to build this library since monday (not full-time), first with MinGW32 (not supported), then with VS2003 (65k lines limitation issue), and now with VS2005…
Thanks
Pierre
June 25, 2008
Hi there Pierre, I definitely am! I have binaries of ITK 3.6 built with VS 2005 for Python 2.5. These are also used by the 8.5 release of DeVIDE ( http://visualisation.tudelft.nl/Projects/DeVIDE ), but I have not had the time to zip them up and make them available separately. Will do so within the next few days (because you asked
June 25, 2008
Ok, thanks a lot, that was quick
BTW, I rapidly took a look at DeVIDE: that is very impressive (a real good publicity for Python and its scientific applications). It doesn’t fit my needs but it has nothing to do with its fantastic features, very powerful. Congratulations.
Could I bother you with some questions on private? (on image processing with Python, ITK, …)
Thanks again for the binaries.
June 25, 2008
Thanks!
You can always send me mail, but I can’t guarantee a good answer.