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.

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

numpy.ndarray – the sinogram with added noise.

astra.functions.clear()[source]

Clears all used memory of the ASTRA Toolbox.

Note

This is irreversible.

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

Perform data operation on data.

Parameters:
  • 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.
astra.functions.geom_2vec(proj_geom)[source]

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.

Parameters:
  • 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.

Parameters:
  • 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
Returns:

dict – Volume geometry with the new center