[Insight-users] Re: on wrap_itk
Gaëtan Lehmann
gaetan.lehmann at jouy.inra.fr
Sun Apr 15 03:36:45 EDT 2007
Le 15 avr. 07 à 00:49, anirudh vij a écrit :
> just found out a new problem:
> using qt-4.2.3 and pyqt 4,itk.show3D() cannot work because the file
> itkvtkextras.py in /usr/local/lib/InsightToolkit/Wrap_Itk/Python/
> itkExtras has a line
>
> import qt
>
> now,in pyqt4,the import syntax is
>
> import PyQt4
>
> so all code using the earlier syntax is broken.i fixed it in 1-2
> files,but this problem will keep coming up.is it possible to make a
> symlink in python's site-packages 'qt' to point to 'PyQt4'?
can you try to replace
import qt
by
try:
import qt
except ImportError:
import PyQt4 as qt
if it work for you, I'll put it in cvs.
Thanks,
Gaëtan
>
> On 4/15/07, anirudh vij <anirudhvij at gmail.com> wrote:
> >ItkVtkGlue is not properly installed on your system :-)
> that was indeed the problem.maybe i installed in the wrong prefix
> the last 2 times.
> >If you are interested by getting some infos on labelized objects, you
> >can install one of my contributions to ITK:
>
> >http://voxel.jouy.inra.fr/darcsweb/darcsweb.cgi ?
> >r=binaryAttributeMorphology;a
> >=summary
>
> >you can get it with darcs ( www.darcs.net):
>
> >darcs get http://voxel.jouy.inra.fr/darcs/contrib-itk/
> >binaryAttributeMorphology/
>
>
> unfortunately ,the proxy which i connect to has blocked the ports
> used by svn ,cvs,and darcs :(
> guess will have to wait till your contrib makes it to the itk source .
>
> On 4/15/07, Gaëtan Lehmann <gaetan.lehmann at jouy.inra.fr > wrote:
> Le 14 avr. 07 à 21:25, anirudh vij a écrit :
>
> > >You didn't sent me the content of your /usr/local/InsightToolkit/
> > >WrapITK/Python/itkExtras/ directory. Can you do that ?
> >
> > this directory contains an __init__.py file.the reference to show3d
> > () in this is:
> >
> > def show(input, **kargs) :
> > """display an image
> > """
> > import itk
> > img = image(input)
> > if img.GetImageDimension() == 3 and "show3D" in dir(itk):
> > return itk.show3D(input, **kargs)
> > else :
> > # print "2D not supported yet, use the 3D viewer."
> > return show2D(input, **kargs)
> >
>
> ItkVtkGlue is not properly installed on your system :-)
> Please go back to Wrapping/WrapITK/ExternalProjects/ItkVtkGlue/ and
> reinstall it. Be sure to set the same prefix than the one you used
> for ITK itself.
>
>
> > >Are you using PyBuffer to pass data from ITK to scipy ?
> >
> > afraid had'nt heard of it till now.was using the most primitive
> > way,temp files :)
> > but will try now for sure.
> >
> > there's something new thats come up in the meanwhile.the best way
> > to explain would be to paste ipython's output:
> >
> >
> > In [159]: bbox=lab_stat.GetBoundingBox(1)
> >
> > In [160]: bbox
> > Out[160]:
> > '_e0b9c208_p_std__vectorTlong_int_std__allocatorTlong_int_t_t'
> >
> > In [161]: type(bbox)
> > Out[161]: <type 'str'>
> >
> > here lab_stat is a itk.LabelStatisticsImageFilter instance.why is
> > bounding box being returned as string instead of std::vector?
> > is'nt std::vector wrapped by default?the wrap_itk paper mentions
> > that vector_double wrapping is off by default.is that so for
> > vector_long and vector_unsignedshort also?
>
> std::vector and itk::Vector are not the same classes.
> Some instantiations of itk::Vector are available, but sadely, there
> is no instantiation of std::vector available with wrapitk.
> If you are interested by getting some infos on labelized objects, you
> can install one of my contributions to ITK:
>
> http://voxel.jouy.inra.fr/darcsweb/darcsweb.cgi?
> r=binaryAttributeMorphology;a=summary
>
> you can get it with darcs ( www.darcs.net):
>
> darcs get http://voxel.jouy.inra.fr/darcs/contrib-itk/
> binaryAttributeMorphology/
>
> an example which use that contrib can be found at:
>
> http://voxel.jouy.inra.fr/darcs/agrobi/agrobi.py
>
> The bounding box is provided by the method GetRegion() of the
> LabelObject.
> There is not much doc for now I'm afraid.
>
> Gaëtan
>
> >
> > >Can you send a short script which reproduce
> > >the problem ?
> > this problem happens for all filters.i will send the script file in
> > a next post.
> >
> > On 4/14/07, Gaëtan Lehmann < gaetan.lehmann at jouy.inra.fr > wrote:
> > Hi,
> >
> > Please keep the discussions about wrapitk on the user list: it can
> > help others to fix there problems in the future :-)
> >
> > Le 14 avr. 07 à 11:09, anirudh vij a écrit :
> >
> > > hi gaetan,
> > > kudos once again for creating wrap itk.It has speeded up my work a
> > > lot.Prototyping is truly horrible in cpp.
> > >
> > > in course of my use i faced some problems.hope you'll be able to
> > > guide towards the solution.
> > >
> > > 1)still could'nt get show3d() working.my versions of qt and pyqt
> > > are both 4.2.3. maybe thats the problem.
> >
> > it shouldn't prevent you to see the show3D class in the itk module.
> >
> >
> > > anyway,i installed mayavi which has excellent python
> > > compatibility.i would like to write a wrapper for show3d() which
> > > would make a call to mayavi whenever show3d() is called,maybe with
> > > some extra options.where should i place the .py file give that no
> > > show3d.py currently exists in /usr/local/lib/InsightToolkit.maybe
> > > you could consider moving the itk.show framework entirely to
> mayavi
> > > in the future .it would mean fewer dependencies on one hand,and a
> > > unified show2d() and show3d() interface on the other(sice mayavi
> > > can show 2d images with extra options of visualization)
> >
> > I'm still looking for a good interface for python and ITK. I'm not
> > sure that mayavi is what I exactly what I want though, but have an
> > interface for it would be a great feature :-)
> > The best way to go, IMHO, is to create a mayavi function or class to
> > display the image, and to put that function in a module in the
> > itkExtras dir, so its content will automatically appear in the itk
> > module - show3D is made that way.
> >
> > >
> > > 2)whenever a filter is incorrectly initialized and an update is
> > > triggered,wrap_itk stops working for that session.subsequent
> > > imports produce the error:module swig not defined.
> > >
> > > 3)after succesfully triggering an update on a filter,if some
> > > parameters are changed subsequently,and an update is again
> > > triggered,there is no change.for example.
> > > dil= itl.BinaryDilateImageFilter.IFUS3US3.New()
> > > dil.SetKernel(se) #se is some strel
> > > dil.Update() #works fine
> > > dil.SetKernel(se2)
> > > dil.Update() #no change :(
> > >
> > > is it a problem with my installation or is this the way it is
> > > supposed to behave.
> >
> > it looks like a problem. Can you send a short script which reproduce
> > the problem ? It would help a lot to reproduce it and to debug.
> >
> > >
> > > currently i am trying to extend wrap_itk using scipy (i.e. make
> > > calls cleaner,add routines that directly do common tasks etc).
> >
> > Are you using PyBuffer to pass data from ITK to scipy ?
> >
> > > i will report any major successes.
> > >
> >
> > Please, do :-)
> >
> > Gaëtan
> >
> >
> > --
> > Gaëtan Lehmann
> > Biologie du Développement et de la Reproduction
> > INRA de Jouy-en-Josas (France)
> > tel: +33 1 34 65 29 66 fax: 01 34 65 29 09
> > http://voxel.jouy.inra.fr
> >
> >
> >
> >
> >
>
> --
> Gaëtan Lehmann
> Biologie du Développement et de la Reproduction
> INRA de Jouy-en-Josas (France)
> tel: +33 1 34 65 29 66 fax: 01 34 65 29 09
> http://voxel.jouy.inra.fr
>
>
>
>
>
>
--
Gaëtan Lehmann
Biologie du Développement et de la Reproduction
INRA de Jouy-en-Josas (France)
tel: +33 1 34 65 29 66 fax: 01 34 65 29 09
http://voxel.jouy.inra.fr
-------------- next part --------------
A non-text attachment was scrubbed...
Name: PGP.sig
Type: application/pgp-signature
Size: 186 bytes
Desc: =?ISO-8859-1?Q?Ceci_est_une_signature_=E9lectronique_PGP?=
Url : http://public.kitware.com/pipermail/insight-users/attachments/20070415/6ed4c50b/PGP-0001.pgp
More information about the Insight-users
mailing list