Skip to content

Image formation models¤

cryojax.simulator.AbstractImageModel

cryojax.simulator.AbstractImageModel ¤

Base class for an image formation model.

Call an AbstractImageModel's simulate routine.

raw_simulate ¤
raw_simulate(rng_key: PRNGKeyArray | None = None, *, outputs_real_space: bool = True) -> Array

Render an image without postprocessing.

cryojax.simulator.LinearImageModel(cryojax.simulator.AbstractImageModel) ¤

An simple image model in linear image formation theory.

__init__ ¤
__init__(volume_parametrization: cryojax.simulator.AbstractVolumeParametrization, pose: cryojax.simulator.AbstractPose, image_config: cryojax.simulator.AbstractImageConfig, transfer_theory: cryojax.simulator.ContrastTransferTheory, volume_integrator: cryojax.simulator.AbstractVolumeIntegrator = cryojax.simulator.AutoVolumeProjection(), *, transform: cryojax.ndimage.AbstractImageTransform | None = None, normalizes_signal: bool = False, signal_region: Bool[NDArrayLike, '_ _'] | None = None, signal_centering: Literal['bg', 'mean'] = 'mean', translate_mode: Literal['fft', 'atom', 'none'] = 'fft')

Arguments:

  • volume_parametrization: The parametrization of an imaging volume.
  • pose: The pose of the volume.
  • image_config: The configuration of the instrument, such as for the pixel size and the wavelength.
  • volume_integrator: The method for integrating the volume onto the plane.
  • transfer_theory: The contrast transfer theory.
  • transform: A cryojax.ndimage.AbstractImageTransform applied to the image after simulation.
  • normalizes_signal: Whether or not to normalize the output of image_model.simulate(). If True, see signal_centering for options.
  • signal_region: A boolean array that is 1 where there is signal, and 0 otherwise used to normalize the image. Must have shape equal to AbstractImageConfig.shape.
  • signal_centering: How to calculate the offset for normalization when normalizes_signal = True. Options are
    • 'mean': Normalize the image to be mean 0 within signal_region.
    • 'bg': Subtract mean value at the image edges. This makes the image fade to a background with values equal to zero. Requires that image_config.padded_shape is large enough so that the signal sufficiently decays. Ignored if normalizes_signal = False.
  • translate_mode: How to apply in-plane translation to the volume. Options are
simulate ¤
simulate(rng_key: PRNGKeyArray | None = None, *, outputs_real_space: bool = True, mask: cryojax.ndimage.AbstractMask | None = None, filter: cryojax.ndimage.AbstractFilter | None = None) -> Array

Render an image.

Arguments:

  • rng_key: The random number generator key. If not passed, render an image with no stochasticity.
  • outputs_real_space: If True, return the image in real space.
  • mask: Optionally apply a mask to the image.
  • filter: Optionally apply a filter to the image.
raw_simulate ¤
raw_simulate(rng_key: PRNGKeyArray | None = None, *, outputs_real_space: bool = True) -> Complex[Array, '{self.image_config.padded_y_dim} {self.image_config.padded_x_dim//2+1}']
postprocess ¤
postprocess(fourier_image: Array, *, outputs_real_space: bool = True, mask: cryojax.ndimage.AbstractMask | None = None, filter: cryojax.ndimage.AbstractFilter | None = None) -> Array

Return an image postprocessed with filters, cropping, masking, and normalization in either real or fourier space.


cryojax.simulator.ProjectionImageModel(cryojax.simulator.AbstractImageModel) ¤

An simple image model for computing a projection.

__init__ ¤
__init__(volume_parametrization: cryojax.simulator.AbstractVolumeParametrization, pose: cryojax.simulator.AbstractPose, image_config: cryojax.simulator.AbstractImageConfig, volume_integrator: cryojax.simulator.AbstractVolumeIntegrator = cryojax.simulator.AutoVolumeProjection(), *, transform: cryojax.ndimage.AbstractImageTransform | None = None, normalizes_signal: bool = False, signal_region: Bool[NDArrayLike, '_ _'] | None = None, signal_centering: Literal['bg', 'mean'] = 'mean', translate_mode: Literal['fft', 'atom', 'none'] = 'fft')

Arguments:

  • volume_parametrization: The parametrization of the imaging volume
  • pose: The pose of the volume.
  • image_config: The configuration of the instrument, such as for the pixel size and the wavelength.
  • volume_integrator: The method for integrating the volume onto the plane.
  • transform: A cryojax.ndimage.AbstractImageTransform applied to the image after simulation.
  • normalizes_signal: Whether or not to normalize the output of image_model.simulate(). If True, see signal_centering for options.
  • signal_region: A boolean array that is 1 where there is signal, and 0 otherwise used to normalize the image. Must have shape equal to AbstractImageConfig.shape.
  • signal_centering: How to calculate the offset for normalization when normalizes_signal = True. Options are
    • 'mean': Normalize the image to be mean 0 within signal_region.
    • 'bg': Subtract mean value at the image edges. This makes the image fade to a background with values equal to zero. Requires that image_config.padded_shape is large enough so that the signal sufficiently decays. Ignored if normalizes_signal = False.
  • translate_mode: How to apply in-plane translation to the volume. Options are
simulate ¤
simulate(rng_key: PRNGKeyArray | None = None, *, outputs_real_space: bool = True, mask: cryojax.ndimage.AbstractMask | None = None, filter: cryojax.ndimage.AbstractFilter | None = None) -> Array

Render an image.

Arguments:

  • rng_key: The random number generator key. If not passed, render an image with no stochasticity.
  • outputs_real_space: If True, return the image in real space.
  • mask: Optionally apply a mask to the image.
  • filter: Optionally apply a filter to the image.
raw_simulate ¤
raw_simulate(rng_key: PRNGKeyArray | None = None, *, outputs_real_space: bool = True) -> Float[Array, '{self.image_config.y_dim} {self.image_config.x_dim}'] | Complex[Array, '{self.image_config.y_dim} {self.image_config.x_dim//2+1}'] | Float[Array, '{self.image_config.padded_y_dim} {self.image_config.padded_x_dim}'] | Complex[Array, '{self.image_config.padded_y_dim} {self.image_config.padded_x_dim//2+1}']
postprocess ¤
postprocess(fourier_image: Array, *, outputs_real_space: bool = True, mask: cryojax.ndimage.AbstractMask | None = None, filter: cryojax.ndimage.AbstractFilter | None = None) -> Array

Return an image postprocessed with filters, cropping, masking, and normalization in either real or fourier space.


cryojax.simulator.ContrastImageModel(cryojax.simulator.AbstractImageModel) ¤

An image formation model that returns the image contrast from a linear scattering theory.

__init__ ¤
__init__(volume_parametrization: cryojax.simulator.AbstractVolumeParametrization, pose: cryojax.simulator.AbstractPose, image_config: cryojax.simulator.AbstractImageConfig, scattering_theory: cryojax.simulator.AbstractScatteringTheory, *, transform: cryojax.ndimage.AbstractImageTransform | None = None, normalizes_signal: bool = False, signal_region: Bool[NDArrayLike, '_ _'] | None = None, signal_centering: Literal['bg', 'mean'] = 'mean', translate_mode: Literal['fft', 'atom', 'none'] = 'fft')

Arguments:

  • volume_parametrization: The parametrization of the imaging volume.
  • pose: The pose of the volume.
  • image_config: The configuration of the instrument, such as for the pixel size and the wavelength.
  • scattering_theory: The scattering theory.
  • transform: A cryojax.ndimage.AbstractImageTransform applied to the image after simulation.
  • normalizes_signal: Whether or not to normalize the output of image_model.simulate(). If True, see signal_centering for options.
  • signal_region: A boolean array that is 1 where there is signal, and 0 otherwise used to normalize the image. Must have shape equal to AbstractImageConfig.shape.
  • signal_centering: How to calculate the offset for normalization when normalizes_signal = True. Options are
    • 'mean': Normalize the image to be mean 0 within signal_region.
    • 'bg': Subtract mean value at the image edges. This makes the image fade to a background with values equal to zero. Requires that image_config.padded_shape is large enough so that the signal sufficiently decays. Ignored if normalizes_signal = False.
  • translate_mode: How to apply in-plane translation to the volume. Options are
simulate ¤
simulate(rng_key: PRNGKeyArray | None = None, *, outputs_real_space: bool = True, mask: cryojax.ndimage.AbstractMask | None = None, filter: cryojax.ndimage.AbstractFilter | None = None) -> Array

Render an image.

Arguments:

  • rng_key: The random number generator key. If not passed, render an image with no stochasticity.
  • outputs_real_space: If True, return the image in real space.
  • mask: Optionally apply a mask to the image.
  • filter: Optionally apply a filter to the image.
raw_simulate ¤
raw_simulate(rng_key: PRNGKeyArray | None = None, *, outputs_real_space: bool = True) -> Complex[Array, '{self.image_config.padded_y_dim} {self.image_config.padded_x_dim//2+1}']
postprocess ¤
postprocess(fourier_image: Array, *, outputs_real_space: bool = True, mask: cryojax.ndimage.AbstractMask | None = None, filter: cryojax.ndimage.AbstractFilter | None = None) -> Array

Return an image postprocessed with filters, cropping, masking, and normalization in either real or fourier space.


cryojax.simulator.IntensityImageModel(cryojax.simulator.AbstractImageModel) ¤

An image formation model that returns an intensity distribution---or in other words a squared wavefunction.

__init__ ¤
__init__(volume_parametrization: cryojax.simulator.AbstractVolumeParametrization, pose: cryojax.simulator.AbstractPose, image_config: cryojax.simulator.AbstractImageConfig, scattering_theory: cryojax.simulator.AbstractScatteringTheory, *, transform: cryojax.ndimage.AbstractImageTransform | None = None, normalizes_signal: bool = False, signal_region: Bool[NDArrayLike, '_ _'] | None = None, signal_centering: Literal['bg', 'mean'] = 'mean', translate_mode: Literal['fft', 'atom', 'none'] = 'fft')

Arguments:

  • volume_parametrization: The parametrization of the imaging volume.
  • pose: The pose of the volume.
  • image_config: The configuration of the instrument, such as for the pixel size and the wavelength.
  • scattering_theory: The scattering theory.
  • transform: A cryojax.ndimage.AbstractImageTransform applied to the image after simulation.
  • normalizes_signal: Whether or not to normalize the output of image_model.simulate(). If True, see signal_centering for options.
  • signal_region: A boolean array that is 1 where there is signal, and 0 otherwise used to normalize the image. Must have shape equal to AbstractImageConfig.shape.
  • signal_centering: How to calculate the offset for normalization when normalizes_signal = True. Options are
    • 'mean': Normalize the image to be mean 0 within signal_region.
    • 'bg': Subtract mean value at the image edges. This makes the image fade to a background with values equal to zero. Requires that image_config.padded_shape is large enough so that the signal sufficiently decays. Ignored if normalizes_signal = False.
  • translate_mode: How to apply in-plane translation to the volume. Options are
simulate ¤
simulate(rng_key: PRNGKeyArray | None = None, *, outputs_real_space: bool = True, mask: cryojax.ndimage.AbstractMask | None = None, filter: cryojax.ndimage.AbstractFilter | None = None) -> Array

Render an image.

Arguments:

  • rng_key: The random number generator key. If not passed, render an image with no stochasticity.
  • outputs_real_space: If True, return the image in real space.
  • mask: Optionally apply a mask to the image.
  • filter: Optionally apply a filter to the image.
raw_simulate ¤
raw_simulate(rng_key: PRNGKeyArray | None = None, *, outputs_real_space: bool = True) -> Complex[Array, '{self.image_config.padded_y_dim} {self.image_config.padded_x_dim//2+1}']
postprocess ¤
postprocess(fourier_image: Array, *, outputs_real_space: bool = True, mask: cryojax.ndimage.AbstractMask | None = None, filter: cryojax.ndimage.AbstractFilter | None = None) -> Array

Return an image postprocessed with filters, cropping, masking, and normalization in either real or fourier space.


cryojax.simulator.ElectronCountsImageModel(cryojax.simulator.AbstractImageModel) ¤

An image formation model that returns electron counts, given a model for the detector.

__init__ ¤
__init__(volume_parametrization: cryojax.simulator.AbstractVolumeParametrization, pose: cryojax.simulator.AbstractPose, image_config: cryojax.simulator.DoseImageConfig, scattering_theory: cryojax.simulator.AbstractScatteringTheory, detector: cryojax.simulator.AbstractDetector, *, transform: cryojax.ndimage.AbstractImageTransform | None = None, normalizes_signal: bool = False, signal_region: Bool[NDArrayLike, '_ _'] | None = None, signal_centering: Literal['bg', 'mean'] = 'mean', translate_mode: Literal['fft', 'atom', 'none'] = 'fft')

Arguments:

  • volume_parametrization: The parametrization of the imaging volume.
  • pose: The pose of the volume.
  • image_config: The configuration of the instrument, such as for the pixel size and the wavelength.
  • scattering_theory: The scattering theory.
  • transform: A cryojax.ndimage.AbstractImageTransform applied to the image after simulation.
  • normalizes_signal: Whether or not to normalize the output of image_model.simulate(). If True, see signal_centering for options.
  • signal_region: A boolean array that is 1 where there is signal, and 0 otherwise used to normalize the image. Must have shape equal to AbstractImageConfig.shape.
  • signal_centering: How to calculate the offset for normalization when normalizes_signal = True. Options are
    • 'mean': Normalize the image to be mean 0 within signal_region.
    • 'bg': Subtract mean value at the image edges. This makes the image fade to a background with values equal to zero. Requires that image_config.padded_shape is large enough so that the signal sufficiently decays. Ignored if normalizes_signal = False.
  • translate_mode: How to apply in-plane translation to the volume. Options are
simulate ¤
simulate(rng_key: PRNGKeyArray | None = None, *, outputs_real_space: bool = True, mask: cryojax.ndimage.AbstractMask | None = None, filter: cryojax.ndimage.AbstractFilter | None = None) -> Array

Render an image.

Arguments:

  • rng_key: The random number generator key. If not passed, render an image with no stochasticity.
  • outputs_real_space: If True, return the image in real space.
  • mask: Optionally apply a mask to the image.
  • filter: Optionally apply a filter to the image.
raw_simulate ¤
raw_simulate(rng_key: PRNGKeyArray | None = None, *, outputs_real_space: bool = True) -> Complex[Array, '{self.image_config.padded_y_dim} {self.image_config.padded_x_dim//2+1}']
postprocess ¤
postprocess(fourier_image: Array, *, outputs_real_space: bool = True, mask: cryojax.ndimage.AbstractMask | None = None, filter: cryojax.ndimage.AbstractFilter | None = None) -> Array

Return an image postprocessed with filters, cropping, masking, and normalization in either real or fourier space.