cbi_toolbox.simu.imaging

The imaging module provides simulations of different imaging systems and acquisition techniques for microscopy.

Conventions:

arrays follow the ZXY convention, with

  • Z : depth axis (axial, focus axis)

  • X : horizontal axis (lateral)

  • Y : vertical axis (lateral, rotation axis when relevant)

sinograms follow the TPY convention, with

  • T : angles (theta)

  • P : captor axis

  • Y : rotation axis

cbi_toolbox.simu.imaging.fps_opt(obj, psf, pad=False, **kwargs)[source]

Simulate the FPS-OPT (focal plane scanning) imaging of an object

Parameters:
  • obj (array [ZXY]) – the object to be imaged

  • psf (array [ZXY] or array [XY]) – the PSF of the system, or projected PSF along the Z axis

  • pad (bool, optional) – pad the vield of view to see all contributions (required if the sample is not contained in the inner cylinder of the object), by default False

  • **kwargs – to be passed to the radon call

Returns:

the imaged sinogram

Return type:

array [TPY]

Raises:

ValueError – if the PSF is not 2D or 3D

cbi_toolbox.simu.imaging.fss_opt(obj, psf, illu, pad=False, **kwargs)[source]

Simulate the FSS-OPT (focal sheet scanning) imaging of an object

Parameters:
  • obj (array [ZXY]) – the object to be imaged

  • psf (array [ZXY] or array [XY]) – the PSF of the system

  • illu (array [ZXY]) – the illumination function of the SPIM

  • pad (bool, optional) – pad the vield of view to see all contributions if used, illu will be required to be bigger (required if the sample is not contained in the inner cylinder of the object), by default False

  • **kwargs – to be passed to the radon call

Returns:

the imaged sinogram

Return type:

array [TPY]

Raises:

ValueError – if the PSF dimensions do not fit the illumination if the illumination function has an incorrect shape

cbi_toolbox.simu.imaging.noise(image, photons=200, background=3, max_amp=None, clip=True, seed=None, in_place=False)[source]
Simulate the acquisition noise of the camera:

noise = shot noise

Parameters:
  • image (array [ZXY]) – the clean image

  • photons (float, optional) – the max level of photons per pixel, by default 150

  • background (float, optional) – the background level of photons per pixel, by default 3

  • max_amp (float, optional) – the value of a pixel corresponding to max photon count, by default None (uses the maximum value of the input image)

  • clip (bool, optional) – clip the output values to the range [0, max_amp], by default True

  • seed (int, optional) – the seed for rng, by default None

  • in_place (bool, optional) – perform computations in-place, modifying the input array to save space, by default False

Returns:

the noisy image

Return type:

array [ZXY]

cbi_toolbox.simu.imaging.opt(obj, psf, theta=None, pad=False)[source]

Simulate the OPT imaging of an object

Parameters:
  • obj (array [ZXY]) – the object to be imaged, ZX must be square

  • psf (array [ZXY]) – the PSF of the imaging system, Z dimension must match object ZX

  • theta (array, optional) – array of rotation angles (in degrees), by default None If None, uses numpy.arange(180).

  • pad (bool, optional) – extend the field of view to see all contributions (needed if the object is not contained in the inner cylinder to the array), by default False

Returns:

the imaged sinogram

Return type:

array [TPY]

Raises:

ValueError – if the PSF dimension does not match the object

cbi_toolbox.simu.imaging.quantize(image, bits=12)[source]

Perform quantization of a continuous array

Parameters:
  • image (array (float in [0,1])) – the continuous input array

  • bits (int, optional) – the number of bits to use for quantization, by default 12

Returns:

the quantized array

Return type:

array (int in [0, 2**bits - 1])

cbi_toolbox.simu.imaging.spim(obj, psf, illu, pad=False)[source]

Simulate the SPIM imaging of an object

Parameters:
  • obj (array [ZXY]) – the object to be imaged

  • psf (array [ZXY]) – the PSF of the imaging objective

  • illu (array [ZXY]) – the illumination function of the SPIM

  • pad (bool, optional) – pad the vield of view to see all contributions, by default False

cbi_toolbox.simu.imaging.widefield(obj, psf, pad=False)[source]

Simulate the widefield imaging of an object

Parameters:
  • obj (array [ZXY]) – the object to be imaged

  • psf (array [ZXY]) – the PSF of the imaging system

  • pad (bool, optional) – extend the field of view to see all contributions, by default False if False, the image will have the same size as the object

Returns:

the widefield image

Return type:

numpy.ndarray