[Insight-users] Re: WrapITK on Windows - how to include
ExternalProjects?
Gaëtan Lehmann
gaetan.lehmann at jouy.inra.fr
Fri Jun 22 13:36:18 EDT 2007
Hi Sven,
Le 22 juin 07 à 07:15, Sven Prevrhal a écrit :
> (former thread RE: [Insight-users] Passing ITK objects from Python
> to C code
> of a Python extension)
>
> Gaëtan,
>
>> I did not find a CmAke switch to have the ExternalProjects built -
>> do I
>> have cmake and to build them separately?
>
> So I answered that question with yes for myself.
Thanks to answering yourself to your questions - that's less work for
me :-)
> However, I found that the
> cmake for ItkVtkGlue has issues. The Tcl target will not build
> because it
> cannot resolve the references to the Itk and Vtk methods.
well, tcl shouldn't work currently. I'm still after someone with a
good enough knowledge of tcl to implement it.
> That is because
> these libraries
>
> itkSpatialObject.lib
> itkBasicFilters.lib
> itkCommon.lib
> vtkFiltering.lib
> vtkImaging.lib
Can you send a patch so I can try it and put it in ITK cvs ?
>
> are not specified as input! So then I fixed that and recompiled.
> Works fine
> now. However, the deprecation warning
>
>>>> import itk
>>>> import itkvtk
> Warning: ItkVtkGlue classes are available in itk module, without
> importing
> itkvt
> k.
> Warning: itkvtk is no more supported and will be removed soon.
>>>> import vtk
>>>> reader = itk.ImageFileReader.IUC3.New()
>>>> converter = itk.ImageToVTKImageFilter.IUC3.New(reader)
>>>> converter.GetOutput()
> <vtkFilteringPython.vtkImageData vtkobject at 00A7A278>
>>>>
>
> is weird because these lines (taken from your WrapITK description
> published
> in the Insight Journal) do _not_ work without importing itkvtk.
>
> Any advice? Did I make some huge mistake?
>
that's strange. itkvtk module does quite nothing. The only important
part was to import vtk, but that's now done in the class itself
(that's why this module is now useless).
Can you give the error message you get without importing that module ?
Thanks,
Gaëtan
> Thanks,
> Sven
>
> -----Original Message-----
> From: Gaëtan Lehmann [mailto:gaetan.lehmann at jouy.inra.fr]
> Sent: Wednesday, June 20, 2007 1:10 PM
> To: Sven Prevrhal
> Cc: Insight Users
> Subject: Re: [Insight-users] Passing ITK objects from Python to C
> code of a
> Python extension
>
>
> Le 20 juin 07 à 21:57, Sven Prevrhal a écrit :
>
>> Thanks Gaëtan,
>> Will WrapITK work on Win XP? I saw some warnings.
>
> it works for sure with visual studio express 2005
>
>> Also, where do I find the
>> insight journal archives?
>>
>
> http://insight-journal.org/
>
>>
>> Thanks,
>> Sven
>>
>> -----Original Message-----
>> From: Gaëtan Lehmann [mailto:gaetan.lehmann at jouy.inra.fr]
>> Sent: Wednesday, June 20, 2007 12:23 PM
>> To: Sven Prevrhal
>> Cc: insight-users at itk.org
>> Subject: Re: [Insight-users] Passing ITK objects from Python to C
>> code of a
>> Python extension
>>
>>
>> Hi Sven,
>>
>> You should use WrapITK to do that. Extending WrapITK is very easy in
>> python, and you can find several examples in the ExternalProjects
>> directory, and in my contributions to the insight journal.
>>
>> Regards,
>>
>> Gaëtan
>>
>>
>> Le 20 juin 07 à 04:32, Sven Prevrhal a écrit :
>>
>>> Since there are apparently some issues with converting strings and
>>> vectors
>>> of strings to/from Python and ITK and I have not figured out how
>>> to, from
>>> Python,
>>> - use DICOMSeriesFileNames to get a set of file names pertaining to
>>> one SeriesUID
>>> - read it with ImageSeriesReader
>>> - Use ConnectITKToVTK to transfer the images over to VTK for
>>> visualization
>>>
>>> I thought I would write a Python extension that would accept a
>>> SeriesUID,
>>> execute those steps and return a vtkImageData object to Python for
>>> further
>>> processing. But I fail to figure out how to pass an ITK object to my
>>> Python/C code.
>>>
>>> I was thinking something like this for Python extension .cxx file -
>>>
>>> static PyObject *
>>> PyITKHelloWorld_ITKHelloWorld(PyObject *self, PyObject *args)
>>> {
>>> ImageType::Pointer argImage;
>>> PyObject * arg1;
>>>
>>> if (!PyArg_ParseTuple(args, "O", &arg1))
>>> return NULL;
>>>
>>> // THIS LINE DOES NOT COMPILE
>>> argImage= (itk::Image< unsigned short, 3 >::Pointer) arg1;
>>> ...
>>>
>>>
>>> and in Python,
>>>
>>> im = itkImageUS3_New()
>>> PyITKHelloWorld.ITKHelloWorld(im.GetPointer())
>>>
>>> ...
>>>
>>>
>>> Needless to say, the code does not compile (can import my extension
>>> though,
>>> and I have a very simple method without passing an ITK object that
>>> works
>>> just fine, so the basics are OK). Am I completely off? Or what do I
>>> need to
>>> do?
>>>
>>> Thanks!
>>>
>>> Sven
>>>
>>>
>>>
>>>
>>> _______________________________________________
>>> Insight-users mailing list
>>> Insight-users at itk.org
>>> http://www.itk.org/mailman/listinfo/insight-users
>>
>> --
>> 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/20070622/8a822d2d/PGP-0001.pgp
More information about the Insight-users
mailing list