TomographicImaging / CIL

A versatile python framework for tomographic imaging
https://tomographicimaging.github.io/CIL/
Apache License 2.0
98 stars 45 forks source link

show_geometry attribute error #858

Closed epapoutsellis closed 3 years ago

epapoutsellis commented 3 years ago

For the walnut data

print(ig3D)

Number of channels: 1 channel_spacing: 1.0 voxel_num : x1024,y1024,z1024 voxel_size : x0.04607780456542968,y0.04607780456542968,z0.04607780456542968 center : x0,y0,z0

print(ag3D)

3D Cone-beam tomography System configuration: Source position: [ 0. , -105.05081, 0. ] Rotation axis position: [0., 0., 0.] Rotation axis direction: [0., 0., 1.] Detector position: [ 0. , 45.087574, 0. ] Detector direction x: [1., 0., 0.] Detector direction y: [0., 0., 1.] Panel configuration: Number of pixels: [1024, 1024] Pixel size: [0.06585429546903238, 0.06585429546903238] Pixel origin: bottom-left Channel configuration: Number of channels: 1 Acquisition description: Number of positions: 1601 Angles 0-20 in radians: [3.1415665, 3.1377017, 3.1337626, 3.1298182, 3.125836 , 3.1219127, 3.1180956, 3.1140666, 3.1101887, 3.1062822, 3.1022923, 3.0984268, 3.0944946, 3.0905435, 3.0865552, 3.082691 , 3.0787866, 3.074828 , 3.0708766, 3.0669732]

and the error is:

---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
<ipython-input-5-15cc2e68fe4f> in <module>
----> 1 show_geometry(ag3D)

~/miniconda3/envs/cil_binder_intel/lib/python3.7/site-packages/cil/utilities/display.py in show_geometry(acquisition_geometry, image_geometry, elevation, azimuthal, view_distance, grid, figsize, fontsize)
    693 
    694     display = _ShowGeometry(acquisition_geometry, image_geometry)
--> 695     display.draw(elev=elevation, azim=azimuthal, view_distance=view_distance, grid=grid, figsize=(10,10), fontsize=10)

~/miniconda3/envs/cil_binder_intel/lib/python3.7/site-packages/cil/utilities/display.py in draw(self, elev, azim, view_distance, grid, figsize, fontsize)
    419         #to force aspect ratio 1:1:1
    420         world_limits = self.ax.get_w_lims()
--> 421         self.ax.set_box_aspect((world_limits[1]-world_limits[0],world_limits[3]-world_limits[2],world_limits[5]-world_limits[4]))
    422 
    423         l = self.ax.plot(np.NaN, np.NaN, '-', color='none', label='')[0]

AttributeError: 'Axes3DSubplot' object has no attribute 'set_box_aspect'
gfardell commented 3 years ago

I can't reproduce this, I get the following:

from cil.framework import AcquisitionGeometry
from cil.utilities.display import show_geometry

ag = AcquisitionGeometry.create_Cone3D([ 0. , -105.05081, 0. ],[ 0. , 45.087574, 0. ])\
                        .set_angles(angles=[-0,-90,-180])\
                        .set_panel( [1024,1024],[0.06585429546903238,0.06585429546903238] )
show_geometry(ag)

image

Could you try my code snippet and paste the output you get. And also what version of cil and matplotlib you are using.

epapoutsellis commented 3 years ago

Error is caused from a specific matplotlib intel version matplotlib 3.1.2 py37h1cb6e45_6 intel/label/oneapibeta

For matplotlib 3.4.2 py38h578d9bd_0 conda-forge there is no problem.