Python error: module 'itk' has no attribute 'ParameterObject'

Question:

I use ITK in python (https://itkpythonpackage.readthedocs.io/en/master/Quick_start_guide.html) and the package seems to work, but when I want to use a code I found on github (https://github.com/InsightSoftwareConsortium/ITKElastix/blob/master/wrapping/test/itkElastixRegistrationMethodTest.py) it gives me an error:

import itk
parameter_object = itk.ParameterObject.New()

module ‘itk’ has no attribute ‘ParameterObject’

unfortunately I could not find out why my itk has no ParameterObject attribute, but I found other code that also used this attribute. I tried to upgrade itk:

Requirement already satisfied: itk in /…/miniconda3/lib/python3.9/site-packages (5.2.1.post1)

I am new to ITK and I am not quite sure what I did wrong, can someone help me?

Asked By: CST

||

Answers:

You need ITKElastix. Get it via pip install itk-elastix.

If you are building ITK from source, you need to build ITKElastix from source and point to the main ITK build.

Answered By: Dženan

Have you solved it?
I had the same problem,only pip install itk-elastix,That’s all I did,and encounter this error messagePython error: module ‘itk’ has no attribute ‘ParameterObject’

Answered By: wangnn
Categories: questions Tags: ,
Answers are sorted by their score. The answer accepted by the question owner as the best is marked with
at the top-right corner.