Skip to content

Volume integration methods¤

cryojax provides different methods for integrating volumes onto a plane to generate an image.

cryojax.simulator.AbstractDirectIntegrator

cryojax.simulator.AbstractDirectIntegrator ¤

Base class for a method of integrating a volume onto the exit plane.

cryojax.simulator.AbstractDirectIntegrator.integrate(volume_representation: VolRepT, image_config: AbstractImageConfig, outputs_real_space: bool = False) -> Complex[Array, '{image_config.padded_y_dim} {image_config.padded_x_dim//2+1}'] | Complex[Array, '{image_config.padded_y_dim} {image_config.padded_x_dim}'] | Float[Array, '{image_config.padded_y_dim} {image_config.padded_x_dim}'] abstractmethod ¤

Integration methods for voxel-based structures¤

cryojax.simulator.AbstractDirectVoxelIntegrator

cryojax.simulator.AbstractDirectIntegrator ¤

Base class for a method of integrating a volume onto the exit plane.

cryojax.simulator.FourierSliceExtraction ¤

Integrate points to the exit plane using the Fourier projection-slice theorem.

This extracts slices using interpolation methods housed in cryojax.image.map_coordinates and cryojax.image.map_coordinates_spline.

cryojax.simulator.FourierSliceExtraction.__init__(*, outputs_integral: bool = True, correction_mask: Optional[InverseSincMask] = None, out_of_bounds_mode: str = 'fill', fill_value: complex = 0.0 + 0j) ¤

Arguments:

  • outputs_integral: If False, returns a projection. If True, return the projection multiplied by the voxel size. This is necessary for simulating in physical units.
  • correction_mask: A cryojax.image.operators.SincCorrectionMask for performing sinc-correction on the linear-interpolated projections. This should be computed on a coordinate grid with shape matching the FourierVoxelGridVolume.shape.
  • out_of_bounds_mode: Specify how to handle out of bounds indexing. See cryojax.image.map_coordinates for documentation.
  • fill_value: Value for filling out-of-bounds indices. Used only when out_of_bounds_mode = "fill".
cryojax.simulator.FourierSliceExtraction.integrate(volume_representation: FourierVoxelGridVolume | FourierVoxelSplineVolume, image_config: AbstractImageConfig, outputs_real_space: bool = False) -> Complex[Array, '{image_config.padded_y_dim} {image_config.padded_x_dim//2+1}'] | Float[Array, '{image_config.padded_y_dim} {image_config.padded_x_dim}'] ¤

Integrate the volume at the AbstractImageConfig settings of a voxel-based representation in fourier-space, using fourier slice extraction.

Arguments:

  • volume_representation: The volume representation.
  • image_config: The configuration of the resulting image.

Returns:

The extracted fourier voxels of the volume_representation, at the image_config.padded_shape and the image_config.pixel_size.

cryojax.simulator.FourierSliceExtraction.extract_fourier_slice_from_spline(spline_coefficients: Complex[Array, 'coeff_dim coeff_dim coeff_dim'], frequency_slice_in_pixels: Float[Array, '1 dim dim 3']) -> Complex[Array, 'dim dim//2+1'] ¤

Extract a fourier slice using the interpolation defined by spline_coefficients at coordinates frequency_slice_in_pixels.

Arguments:

  • spline_coefficients: Spline coefficients of the density grid in fourier space. The coefficients should be computed from a fourier_voxel_grid with the zero frequency component in the center. These are typically computed with the function cryojax.image.compute_spline_coefficients.
  • frequency_slice_in_pixels: Frequency central slice coordinate system. The zero frequency component should be in the center.
  • voxel_size: The voxel size of the fourier_voxel_grid. This argument is not used in the FourierSliceExtraction class.
  • wavelength_in_angstroms: The wavelength of the incident electron beam. This argument is not used in the FourierSliceExtraction class.

Returns:

The interpolated fourier slice at coordinates frequency_slice_in_pixels.

cryojax.simulator.FourierSliceExtraction.extract_fourier_slice_from_grid(fourier_voxel_grid: Complex[Array, 'dim dim dim'], frequency_slice_in_pixels: Float[Array, '1 dim dim 3']) -> Complex[Array, 'dim dim//2+1'] ¤

Extract a fourier slice of the fourier_voxel_grid at coordinates frequency_slice_in_pixels.

Arguments:

  • fourier_voxel_grid: Density grid in fourier space. The zero frequency component should be in the center.
  • frequency_slice_in_pixels: Frequency central slice coordinate system. The zero frequency component should be in the center.
  • voxel_size: The voxel size of the fourier_voxel_grid. This argument is not used in the FourierSliceExtraction class.
  • wavelength_in_angstroms: The wavelength of the incident electron beam. This argument is not used in the FourierSliceExtraction class.

Returns:

The interpolated fourier slice at coordinates frequency_slice_in_pixels.


cryojax.simulator.NufftProjection ¤

Integrate points onto the exit plane using non-uniform FFTs.

cryojax.simulator.NufftProjection.__init__(*, outputs_integral: bool = True, eps: float = 1e-06) ¤

Arguments:

  • outputs_integral: If False, returns a projection. If True, return the projection multiplied by the voxel size. This is necessary for simulating in physical units.
  • eps: See jax-finufft for documentation.
cryojax.simulator.NufftProjection.integrate(volume_representation: RealVoxelGridVolume, image_config: AbstractImageConfig, outputs_real_space: bool = False) -> Complex[Array, '{image_config.padded_y_dim} {image_config.padded_x_dim//2+1}'] | Float[Array, '{image_config.padded_y_dim} {image_config.padded_x_dim}'] ¤

Integrate the volume at the AbstractImageConfig settings of a voxel-based representation in real-space, using non-uniform FFTs.

Arguments:

  • volume_representation: The volume representation.
  • image_config: The configuration of the resulting image.

Returns:

The projection integral of the volume_representation in fourier space, at the image_config.padded_shape and the image_config.pixel_size.

cryojax.simulator.NufftProjection.project_voxel_cloud_with_nufft(weights: Float[Array, ' size'], coordinate_list_in_angstroms: Float[Array, 'size 2'] | Float[Array, 'size 3'], shape: tuple[int, int]) -> Complex[Array, '{shape[0]} {shape[1]//2+1}'] ¤

Project and interpolate 3D volume point cloud onto imaging plane using a non-uniform FFT.

Arguments:

  • weights: Density point cloud.
  • coordinate_list_in_angstroms: Coordinate system of point cloud.
  • shape: Shape of the real-space imaging plane in pixels.

Returns:

The fourier-space projection of the density point cloud defined by weights and coordinate_list_in_angstroms.

Integration methods for point-cloud based structures¤

cryojax.simulator.GaussianMixtureProjection ¤

cryojax.simulator.GaussianMixtureProjection.__init__(*, upsampling_factor: Optional[int] = None, shape: Optional[tuple[int, int]] = None, use_error_functions: bool = True, n_batches: int = 1) ¤

Arguments:

  • upsampling_factor: The factor by which to upsample the computation of the images. If upsampling_factor is greater than 1, the images will be computed at a higher resolution and then downsampled to the original resolution. This can be useful for reducing aliasing artifacts in the images.
  • shape: The shape of the plane on which projections are computed before padding or cropping to the AbstractImageConfig.padded_shape. This argument is particularly useful if the AbstractImageConfig.padded_shape is much larger than the protein.
  • use_error_functions: If True, use error functions to evaluate the projected volume at a pixel to be the average value within the pixel using gaussian integrals. If False, the volume at a pixel will simply be evaluated as a gaussian.
  • n_batches: The number of batches over groups of positions used to evaluate the projection. This is useful if GPU memory is exhausted. By default, 1, which computes a projection for all positions at once.
cryojax.simulator.GaussianMixtureProjection.integrate(volume_representation: GaussianMixtureVolume | PengIndependentAtomPotential, image_config: AbstractImageConfig, outputs_real_space: bool = False) -> Complex[Array, '{image_config.padded_y_dim} {image_config.padded_x_dim//2+1}'] | Float[Array, '{image_config.padded_y_dim} {image_config.padded_x_dim}'] ¤

Compute a projection from gaussians.

Arguments:

  • volume_representation: The volume representation to project.
  • image_config: The configuration of the imaging instrument.

Returns:

The integrated volume in real or fourier space at the AbstractImageConfig.padded_shape.