Test for the TomoBox


In [1]:
import tomobox
import simulate

In [3]:
# Initialize a synthetic sinogram
tomo = tomobox.tomogram()
tomo.io.manual_init()

simulate.tomography.project(simulate.phantom.shepp3d(256), tomo)


---------------------------------------------------------------------------
KeyError                                  Traceback (most recent call last)
<ipython-input-3-45a6c344cf6b> in <module>()
      3 tomo.io.manual_init()
      4 
----> 5 simulate.tomography.project(simulate.phantom.shepp3d(256), tomo)

/ufs/kostenko/GitProjects/tomo_box/simulate.py in project(volume, tomo)
    136         Forward projects a volume into a tomogram
    137         '''
--> 138         tomo.reconstruct._initialize_astra()
    139 
    140         tomo.meta.history['N.B.'] = 'simulate.tomography.project is used to generate the data'

/ufs/kostenko/GitProjects/tomo_box/tomobox.py in _initialize_astra(self, sz, det_pixel_size, det2obj, src2obj, theta, vec_geom)
   1561         self.proj_geom = astra.create_proj_geom('cone', magnification, magnification, det_count_z, det_count_x, theta, (src2obj*magnification)/det_pixel_size, (det2obj*magnification)/det_pixel_size)
   1562 
-> 1563         if not (self._parent.meta.geometry['det_offset'] == [0,0]):
   1564             # Use now vec proj geometry to gain degrees of freedom
   1565             self.proj_geom = astra.functions.geom_2vec(self.proj_geom)

KeyError: 'det_offset'

In [5]:
simulate.tomography.project(vol_zero, tomo)


Out[5]:
{'det2obj': 100,
 'det_pixel': 0.1,
 'nb_angle': 128,
 'rot_step': 0.04908738521234052,
 'src2det': 200,
 'src2obj': 100,
 'theta_range': [0, 6.283185307179586]}