[Insight-users] The easy way to wrap.

James Carroll jim at microbrightfield.com
Fri, 30 Apr 2004 17:51:05 -0400


Thank you Luis for the instructions on building wrappers.  I think I
almost have Python working.

The build gave a lot of warnings (in step 5) about not being able to
find wrappers, but the build completed with zero errors.

If I simply add C:\jimc\prj\Insight\lib\Wrapping\CSwig\Python\Release to
my python-Path (Following the Wrapping\CSwig\Readme), then it can't find

anything.  I'm not sure I understand the last line of the readme:
"     - Python must be built Release of RelWithDebInfo on windows."

Now I'm copying files to my Python lib/site-packages to see if I can
start using Insight from python. =20

(I'm using CVS Head for Insight, VC6.0 SP6, on Windows XP)

When I import InsightToolkit, I get the following error:


>>> import InsightToolkit as itk
Traceback (most recent call last):
  File "<stdin>", line 1, in ?
  File
"C:/jimc/prj/Insight/lib/Wrapping/CSwig/Python\Release\InsightToolkit.py
", line 1, in ?
    from itkalgorithms import *
  File
"C:/jimc/prj/Insight/lib/Wrapping/CSwig/Python\Release\itkalgorithms.py"
, line 1, in ?
    from itkbasicfilters import *
  File
"C:/jimc/prj/Insight/lib/Wrapping/CSwig/Python\Release\itkbasicfilters.p
y ", line 3, in ?
    from ITKBasicFiltersPython import *
  File "ITKBasicFiltersPython.py", line 33, in ?
    from itkAnisotropicDiffusionImageFilter import *
  File "itkAnisotropicDiffusionImageFilter.py", line 136, in ?
    class
itkAnisotropicDiffusionImageFilterSI3SI3(itkExtractImageFilter.itkImageT
oImageFilterSI3SI3):
AttributeError: 'module' object has no attribute
'itkImageToImageFilterSI3SI3'
>>>

Does anyone have an insight for me on Python?

Thank you kindly,
-Jim

I've created an itk.pth file, and copied other stuff this way:

in python233\lib\site-packages\  file
    itk.pyth
has contents:   =20
       InsightToolkit
   =20

in python233\lib\site-packages\InsightToolkit files:
   =20
    InsightToolkit.py
    InsightToolkit.pyc
    itkalgorithms.py
    itkalgorithms.pyc
    itkbase.py
    itkbase.pyc
    itkbasicfilters.py
    itkbasicfilters.pyc
    ITKCommon.dll
    itkcommon.py
    itkcommon.pyc
    itkdata.py
    itkdata.pyc
    itkio.py
    itkio.pyc
    itknumerics.py
    itknumerics.pyc
    itktesting.py
    itktesting.pyc
    SwigRuntimePython.dll
    vxlnumerics.py
    vxlnumerics.pyc
    _ITKAlgorithmsPython.dll
    _ITKBasicFiltersBPython.dll
    _ITKBasicFiltersPython.dll
    _ITKCommonPython.dll
    _ITKIOPython.dll
    _ITKNumericsPython.dll
    _VXLNumericsPython.dll
   =20


-----Original Message-----
From: insight-users-admin at itk.org [mailto:insight-users-admin at itk.org]
On Behalf Of Luis Ibanez
Sent: Friday, April 30, 2004 10:16 AM
To: Vidina Monagas
Cc: Insight-users at itk.org
Subject: [Insight-users] The easy way to wrap.


Hi Vidina,


Here is the easy way to build ITK:

1) Run CMake
    Disable TESTING,
    Disable EXAMPLES
    Disable WRAPPING
    Enable  SHARED libraries
    configure in this way.


2) Open the Workspace in Visual Studio
    Select ALL_BUILD
    Select build for Release
    Build the project
    It should take 15 minutes


3) Download CableSwig
    and put it in the Utilities
    Subdirectory of ITK.
    It will look like:

    Insight/Utilities/CableSwig

    By doing this, CableSwig will be
    built along with ITK.


4) Close the ITK workspace,
    Re-run CMake
    Enable Wrapping (for the scripting
    language you are interested on).
    configure this way.


5) Open the ITK Workspace
    Select ALL_BUILD
    Select build for Release
    build the project
    This time it will take
    about 1.5 hours.


Please let us know if you still find
any problems,


    Thanks



      Luis


---------------------
Vidina Monagas wrote:
> Should I compile CableSwig before ITK?
>=20
> ----- Original Message -----=20
> From: "Luis Ibanez" <luis.ibanez at kitware.com>
> To: "Vidina Monagas" <vidina at ctm.ulpgc.es>
> Cc: <Insight-users at itk.org>
> Sent: Friday, April 30, 2004 12:18 AM
> Subject: Re: 24 hours is too long :-)
>=20
>=20
>=20
>>Hi Vidina,
>>
>>The compilation should not take 24 hours,   :-)
>>
>>There is definitely something wrong.
>>
>>The typical ITK build should take 15 minutes,
>>when you disable Testing and Examples.
>>
>>Did you changed any of the CMake default
>>options when you configured ITK ?
>=20
>=20
>=20
>>Or did you make any changes to the workspace
>>file after loading it in Visual Studio ?
>>
>>I didn't see anything strange in your
>>CMakeCache.txt...
>>
>>Do you have other versions of VisualStudio
>>installed in the same machine ?
>>
>>Do you trust your VisualStudion installation ?
>>(that is, have you used for building any
>>serious-size project ? )
>>
>>
>>I would suggest you to delete the binary
>>directory where you are attempting this
>>build, and restart from scratch.
>>
>>Please follow the instruction in the tutorials
>>
>>    http://www.itk.org/HTML/Tutorials.htm
>>
>>Let us know if you still have any problems,
>>
>>
>>   Thanks
>>
>>
>>     Luis
>>
>>


_______________________________________________
Insight-users mailing list
Insight-users at itk.org
http://www.itk.org/mailman/listinfo/insight-users