[Insight-users] ITK 4.3.1 Python error trying to use Python

Ariel Hernán Curiale curiale at gmail.com
Fri Jan 18 13:49:20 EST 2013


Hi,

I found the itk.py class in the directory <ITK-build>/Wrapping/Generators/Python/ then I decided to include this path and  <ITK-build>/lib/ into  PYTHONPATH. Doing this I could read an image, but I don't know if this is the correct setting for the PYTHONPATH. 
If anyone that use ITK and  python could help me it would be great.

Thanks,
__________________________________
| Ariel Hernán Curiale Ph.D Student
| ETSI Telecomunicación
| Universidad de Valladolid
| Campus Miguel Delibes
| 47011 Valladolid, Spain
| Phone: 983-423000 ext. 5590
| Web: www.curiale.com.ar
|_________________________________

El 17/01/2013, a las 11:29, Ariel Hernán Curiale escribió:

> Hi all,
> 
> I built ITK-4.3.1 to use Python successfully and configure this variables:
> PYTHONPATH=$PYTHONPATH:<path to itk build>/lib/ 
> DYLD_LIBRARY_PATH =$DYLD_LIBRARY_PATH:<path to itk build>
> 
> All looks fine an when use ipython I can see all the clases, but I cant import itk how the example in the wiki (the error said No module named itk) and when I import for example FileReader doing: import itkImageFileReaderPython as reader; I get the following error:
> ---------------------------------------------------------------------------
> ImportError                               Traceback (most recent call last)
> <ipython-input-1-76aad2624ebf> in <module>()
> ----> 1 import itkImageFileReaderPython as reader;
> 
> /Users/ariel/Applications/InsightToolkit-4.3.1-build/lib/itkImageFileReaderPython.py in <module>()
>      28                 fp.close()
>      29             return _mod
> ---> 30     _itkImageFileReaderPython = swig_import_helper()
>      31     del swig_import_helper
>      32 else:
> 
> /Users/ariel/Applications/InsightToolkit-4.3.1-build/lib/itkImageFileReaderPython.py in swig_import_helper()
>      20             fp, pathname, description = imp.find_module('_itkImageFileReaderPython', [dirname(__file__)])
>      21         except ImportError:
> ---> 22             import _itkImageFileReaderPython
>      23             return _itkImageFileReaderPython
>      24         if fp is not None:
> 
> ImportError: No module named _itkImageFileReaderPython
> 
> 
> And effectively the _itkImageFileReaderPython class or file  doesn't exist inside the lib directory. I have some _ITK libraries but no one _itk. Am I doing something wrong ? Did I configure itk wrong ?
> 
> I could import all these clases:
> ITKAnisotropicSmoothingPython          ITKIOJPEGPython                        ITKMathematicalMorphologyPython
> ITKAntiAliasPython                     ITKIOLSMPython                         ITKMeshPython
> ITKBinaryMathematicalMorphologyPython  ITKIOMetaPython                        ITKNarrowBandBasePython
> ITKClassifiersPython                   ITKIONIFTIPython                       ITKNarrowBandPython
> ITKColormapPython                      ITKIONRRDPython                        ITKOptimizersBasePython
> ITKCommonBasePython                    ITKIOPNGPython                         ITKOptimizersPython
> ITKCommonPython                        ITKIORAWPython                         ITKOptimizersv4Python
> ITKConnectedComponentsPython           ITKIOSiemensPython                     ITKPDEDeformableRegistrationPython
> ITKConvolutionPython                   ITKIOSpatialObjectsPython              ITKPathPython
> ITKCostFunctionsPython                 ITKIOStimulatePython                   ITKPyBasePython
> ITKCurvatureFlowPython                 ITKIOTIFFPython                        ITKPyUtilsPython
> ITKDeconvolutionPython                 ITKIOVTKPython                         ITKQuadEdgeMeshBasePython
> ITKDisplacementFieldPython             ITKImageComparePython                  ITKQuadEdgeMeshFilteringPython
> ITKDistanceMapPython                   ITKImageComposePython                  ITKQuadEdgeMeshPython
> ITKEigenPython                         ITKImageFeaturePython                  ITKRegionGrowingPython
> ITKFFTPython                           ITKImageFilterBasePython               ITKRegistrationCommonPython
> ITKFastMarchingBasePython              ITKImageFunctionPython                 ITKReviewPython
> ITKFastMarchingPython                  ITKImageFusionPython                   ITKSmoothingPython
> ITKFiniteDifferencePython              ITKImageGradientPython                 ITKSpatialObjectsPython
> ITKIOBMPPython                         ITKImageGridPython                     ITKStatisticsPython
> ITKIOBioRadPython                      ITKImageIntensityPython                ITKTestKernelPython
> ITKIOGDCMPython                        ITKImageLabelPython                    ITKThresholdingPython
> ITKIOGEPython                          ITKImageSourcesPython                  ITKTransformPython
> ITKIOGIPLPython                        ITKImageStatisticsPython               ITKVTKPython
> ITKIOHDF5Python                        ITKLabelMapBasePython                  ITKVoronoiPython
> ITKIOIPLPython                         ITKLabelMapPython                      ITKVtkGluePython
> ITKIOImageBaseBasePython               ITKLabelVotingPython                   ITKWatershedsPython
> ITKIOImageBasePython                   ITKLevelSetsPython
> 
> 
> And this classes have a _ITK library inside the lib directory.
> 
> 
> 
> Thanks a lot,
> __________________________________
> | Ariel Hernán Curiale Ph.D Student
> | ETSI Telecomunicación
> | Universidad de Valladolid
> | Campus Miguel Delibes
> | 47011 Valladolid, Spain
> | Phone: 983-423000 ext. 5590
> | Web: www.curiale.com.ar
> |_________________________________
> 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.itk.org/pipermail/insight-users/attachments/20130118/bfdef104/attachment.htm>


More information about the Insight-users mailing list