On to., 2009-01-29 at 14:03 +0000, A Navaei wrote: > 2009/1/29 Kent Andre <[email protected]>: > > On ti., 2009-01-27 at 12:34 +0000, A Navaei wrote: > >> Kent: Luca is right about the lack of wrapping for double type. I was > >> not aware that you were using the debian package available in ubuntu, > >> that binary (which has been nicely packaged) is now a bit out of date > >> and uses an old design of wrapitk while only the types that Luca > >> mentioned are wrapped. If you have access to a fast server, compiling > >> wrapitk is not that bad, simply turn python wrapping and double type > >> supporting on in the cmake gui, and you're good to go. If you turn the > >> cpack debian option on, it will also automatically generate a ready to > >> use debian package. > >> > > > > > > > > So I have to used the svn version of both ITK and wrapitk ? Or can I > > download ITK 3.10 and compile with doubles. Anyway, I guess I the image > > pixels are of integer type and I don't need to convert these to > > doubles. > > itk 3.10 is buggy and some classes will not compile when wrapping, > please use the development version and follow the instructions in > http://code.google.com/p/wrapitk/ . (Note that when you compile itk, > only a small fraction of the library is actually compiled, the rest > are simply templates which need to be instantiated. wrapitk > instantiates and compiles every single class, and that's where the > buggs are discovered.) > > It doesn't matter if your input images are not of double type. Since > your output images must be of double type, in order to connect them to > dolfin, you must have double type wrapping on. If you want to use > numpy as a glue, you might be able to cast the interface numpy array > from int to double. Let me know if there are any problems.
So I modified your code slightly to get it work using ubuntu packages, (I will go to the newer version ... :) ) from dolfin import * from numpy import * import itk dim = 2 inType = itk.Image[itk.UC, dim] reader = itk.ImageFileReader[inType].New(FileName="bowling.jpg") reader.Update() itk_py_converter = itk.PyBuffer[inType] image_array = itk_py_converter.GetArrayFromImage( reader.GetOutput() ) I have a 150x150 pixel images (in jpg) and running the above code takes like 10 seconds ? What is wrong ? Kent _______________________________________________ DOLFIN-dev mailing list [email protected] http://www.fenics.org/mailman/listinfo/dolfin-dev
