matteo-ronchetti / torch-radon

Computational Tomography in PyTorch
https://torch-radon.readthedocs.io
GNU General Public License v3.0
219 stars 45 forks source link

Importing exception #25

Closed Guaishou74851 closed 3 years ago

Guaishou74851 commented 3 years ago

I installed torch_radon successfully through:

wget -qO- https://raw.githubusercontent.com/matteo-ronchetti/torch-radon/master/auto_install.py  | python -

and wrote the below codes for testing:

import numpy as np
from torch_radon import Radon, RadonFanbeam
my_radon = Radon(362, np.linspace(0, np.pi, 60, endpoint=False))

But I got:

Importing exception
Importing exception
Traceback (most recent call last):
  File "model.py", line 3, in <module>
    my_radon = Radon(362, np.linspace(0, np.pi, 60, endpoint=False))
  File "/usr/local/lib/python3.6/dist-packages/torch_radon/__init__.py", line 169, in __init__
    rays_cfg = RaysCfg(resolution, resolution, det_count, det_spacing, len(angles), clip_to_circle)
NameError: name 'RaysCfg' is not defined
Exception ignored in: <bound method BaseRadon.__del__ of <torch_radon.Radon object at 0x7f12d9f51e80>>
Traceback (most recent call last):
  File "/usr/local/lib/python3.6/dist-packages/torch_radon/__init__.py", line 140, in __del__
    self.noise_generator.free()
AttributeError: 'Radon' object has no attribute 'noise_generator'

What should I do?

Guaishou74851 commented 3 years ago
# python 
Python 3.6.7 (default, Oct 21 2018, 04:56:05) 
[GCC 5.4.0 20160609] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import numpy as np
>>> from torch_radon import Radon, RadonFanbeam
Importing exception
Importing exception
>>> my_radon = Radon(362, np.linspace(0, np.pi, 60, endpoint=False))
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/local/lib/python3.6/dist-packages/torch_radon/__init__.py", line 169, in __init__
    rays_cfg = RaysCfg(resolution, resolution, det_count, det_spacing, len(angles), clip_to_circle)
NameError: name 'RaysCfg' is not defined
>>> 
Exception ignored in: <bound method BaseRadon.__del__ of <torch_radon.Radon object at 0x7f80e16b84e0>>
Traceback (most recent call last):
  File "/usr/local/lib/python3.6/dist-packages/torch_radon/__init__.py", line 140, in __del__
    self.noise_generator.free()
AttributeError: 'Radon' object has no attribute 'noise_generator'
stefenmax commented 3 years ago

Have u solved it yet? You may didn't complied it like python setup.py But I can't comile it with the upper code,could u help me? thx