Additional functions: the functions module

Additional functions for PyAstraToolbox.

astra.functions.add_noise_to_sino(sinogram_in, I0, seed=None)[source]

Adds Poisson noise to a sinogram.

  • sinogram_in (numpy.ndarray) – Sinogram to add noise to.
  • I0 (float) – Background intensity. Lower values lead to higher noise.

numpy.ndarray – the sinogram with added noise.


Clears all used memory of the ASTRA Toolbox.


This is irreversible.

astra.functions.data_op(op, data, scalar, gpu_core, mask=None)[source]

Perform data operation on data.

  • op – Operation to perform.
  • data – Data to perform operation on.
  • scalar – Scalar argument to data operation.
  • gpu_core – GPU core to perform operation on.
  • mask – Optional mask.

Returns a vector-based projection geometry from a basic projection geometry.

Parameters:proj_geom (dict) – Projection geometry to convert
astra.functions.geom_size(geom, dim=None)[source]

Returns the size of a volume or sinogram, based on the projection or volume geometry.

  • geom – Geometry to calculate size from
  • dim (int) – Optional axis index to return
astra.functions.move_vol_geom(geom, pos, is_relative=False)[source]

Moves center of volume geometry to new position.

  • geom (dict) – Input volume geometry
  • pos (tuple) – Tuple (x,y[,z]) for new position, with the center of the image at (0,0[,0])
  • is_relative (bool) – Whether new position is relative to the old position

dict – Volume geometry with the new center