SimpleElastix icon indicating copy to clipboard operation
SimpleElastix copied to clipboard

AttributeError: module 'SimpleITK' has no attribute 'ReadParameterFile'

Open nrpark opened this issue 4 years ago • 5 comments

I'm using a GUI (https://github.com/NHPatterson/regToolboxMSRC/tree/master/regToolboxMSRC) that uses SimpleElastix for image registration. I'm trying to do 'single section single image registration' (screenshot of the screen attached), image

but I'm getting this error message when I input my image files and try to register them:


self.testing = sitk.ReadParameterFile(
AttributeError: module 'SimpleITK' has no attribute 'ReadParameterFile'

Are there any suggestions? I have a Mac Os Catalina, processor is 1.7 GHz Quad-Core Intel Core i7 and 16GB memory. Thanks in advance!

nrpark avatar May 14 '20 12:05 nrpark

Hi @nrpark, I'm not sure this issue is directly related to SimpleElastix, but may be more related to my software package, which admittedly, is quite out of date. That said, sitk.ReadParameterFile is unlikely to be deprecated in SimpleElastix. Maybe it is worth checking your SimpleITK version?

import SimpleITK as sitk
print(sitk.Version())

Did you build SimpleElastix from source or possibly installed SimpleITK from using pip or conda. It is a bit confusing but SimpleElastix uses SimpleITK internals with added elastix functionality, but when you install SimpleITK from pip or conda, you are only getting SimpleITK functions as this is a seperately maintained package. ReadParameterFile is a function of SimpleElastix, which, when installed, masks the module SimpleITK.

If you try

import SimpleITK as sitk
sitk.ImageFileReader() #no error

sitk.ElastixImageFilter() #attribute error

Do you get:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
AttributeError: module 'SimpleITK' has no attribute 'ElastixImageFilter'

If you have further errors with the registration toolbox, it may be easier for me to respond if you raise an issue at that repository.

NHPatterson avatar May 14 '20 13:05 NHPatterson

Hi Heath,

Thanks so much for your prompt response.

SimpleITK Version: 1.1.0 (ITK 4.13) Compiled: Mar 22 2018 14:02:27

This is the version I’m getting. I compiled it from source inside a conda environment so it can compile against my conda python binaries (v. 3.5), following the workaround with clang that’s documented on the website:

And I also turned off the Ruby wraparound because that was another error that I was getting. And for your last question:

I’m getting errors for imagefilereader too.

On May 14, 2020, at 9:50 AM, Heath Patterson [email protected] wrote:

Hi @nrpark https://github.com/nrpark, I'm not sure this issue is directly related to SimpleElastix, but may be more related to my software package, which admittedly, is quite out of date. That said, sitk.ReadParameterFile is unlikely to be deprecated in SimpleElastix. Maybe it is worth checking your SimpleITK version?

import SimpleITK as sitk print(sitk.Version()) Did you build SimpleElastix from source or possibly installed SimpleITK from using pip or conda. It is a bit confusing but SimpleElastix uses SimpleITK internals with added elastix functionality, but when you install SimpleITK from pip or conda, you are only getting SimpleITK functions as this is a seperately maintained package. ReadParameterFile is a function of SimpleElastix, which, when installed, masks the module SimpleITK.

If you try

import SimpleITK as sitk sitk.ImageFileReader() #no error

sitk.ElastixImageFilter() #attribute error Do you get:

Traceback (most recent call last): File "", line 1, in AttributeError: module 'SimpleITK' has no attribute 'ElastixImageFilter' If you have further errors with the registration toolbox, it may be easier for me to respond if you raise an issue at that repository.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/SuperElastix/SimpleElastix/issues/376#issuecomment-628649679, or unsubscribe https://github.com/notifications/unsubscribe-auth/APSSC4EIHKLLDZTIHLKWB7DRRPZLBANCNFSM4NAU7WVQ.

nrpark avatar May 14 '20 13:05 nrpark

Hi Heath,

Bumping this up to see if there are any new ideas on this issue?

Cheers, Noel

On May 14, 2020, at 9:55 AM, Noel Park [email protected] wrote:

Hi Heath,

Thanks so much for your prompt response.

SimpleITK Version: 1.1.0 (ITK 4.13) Compiled: Mar 22 2018 14:02:27

This is the version I’m getting. I compiled it from source inside a conda environment so it can compile against my conda python binaries (v. 3.5), following the workaround with clang that’s documented on the website: <PastedGraphic-5.png> And I also turned off the Ruby wraparound because that was another error that I was getting. And for your last question: <PastedGraphic-7.png> I’m getting errors for imagefilereader too.

On May 14, 2020, at 9:50 AM, Heath Patterson <[email protected] mailto:[email protected]> wrote:

Hi @nrpark https://github.com/nrpark, I'm not sure this issue is directly related to SimpleElastix, but may be more related to my software package, which admittedly, is quite out of date. That said, sitk.ReadParameterFile is unlikely to be deprecated in SimpleElastix. Maybe it is worth checking your SimpleITK version?

import SimpleITK as sitk print(sitk.Version()) Did you build SimpleElastix from source or possibly installed SimpleITK from using pip or conda. It is a bit confusing but SimpleElastix uses SimpleITK internals with added elastix functionality, but when you install SimpleITK from pip or conda, you are only getting SimpleITK functions as this is a seperately maintained package. ReadParameterFile is a function of SimpleElastix, which, when installed, masks the module SimpleITK.

If you try

import SimpleITK as sitk sitk.ImageFileReader() #no error

sitk.ElastixImageFilter() #attribute error Do you get:

Traceback (most recent call last): File "", line 1, in AttributeError: module 'SimpleITK' has no attribute 'ElastixImageFilter' If you have further errors with the registration toolbox, it may be easier for me to respond if you raise an issue at that repository.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/SuperElastix/SimpleElastix/issues/376#issuecomment-628649679, or unsubscribe https://github.com/notifications/unsubscribe-auth/APSSC4EIHKLLDZTIHLKWB7DRRPZLBANCNFSM4NAU7WVQ.

nrpark avatar May 18 '20 14:05 nrpark

Hi, I got the same error only for sitk.ElastixImageFilter(). AttributeError: module 'SimpleITK' has no attribute 'ElastixImageFilter'

MOAMSA avatar Sep 27 '21 20:09 MOAMSA

Also, I got the same error only for sitk.ElastixImageFilter(). AttributeError: module 'SimpleITK' has no attribute 'ElastixImageFilter'. And my SimpleITK‘s version is 2.1.1, it trouble me a lot.

Magician0619 avatar Apr 08 '22 09:04 Magician0619