Composable Filters#
Composable filters in pytme are inspired by the similarly named Compose operation used in deep learning frameworks. Composable filters are an explicit solution to defining complex filtering procedures and can be lazily evaluated.
To demonstrate the use of composable filters, let’s walk through a basic example showcasing how to combine BandPassReconstructed and WedgeReconstructed
import numpy as np
from tme.filters import Compose, BandPassReconstructed, WedgeReconstructed
sampling_rate = (5,5,5) # Sampling rate, typically Å/voxel
# Setup bandpass filter
bandpass = BandPassReconstructed(
lowpass=30, # Resolution to lowpass filter to
highpass=5, # Resolution to highpass filter to
sampling_rate=sampling_rate # Required to translate cutoffs
)
# Setup wege mask
wedge = WedgeReconstructed(
angles=[60, 60], # Start, stop tilt angle
opening_axis=2, # Wedge is open in z-axis
tilt_axis=0, # Sample is tilted over x-axis
create_continuous_wedge=True, # Include all angles from -60 to 60
)
# Combine bandpass and wedge mask into a single filter
composed_filter = Compose([bandpass, wedge])
data_shape = (50,50,50)
filter_mask = composed_filter(
shape=data_shape, return_real_fourier=False
)["data"]
# Apply the filter mask
data = np.random.rand(*data_shape)
data_filtered = np.fft.ifftn(np.fft.fftn(data * filter_mask)).real
Specification#
ComposableFilter serves as specification for new composable filters.
Base class for composable filters. |
Aggregator#
Compose allows for combining the operations described by multiple objects of type ComposableFilter.
Compose a series of filters. |
Frequency Filters#
Generate per-tilt Bandpass filter. |
|
Generate Bandpass filter for reconstructions. |
|
Interpolate a 1D radial profile onto an nD Fourier grid. |
Cryo-EM Filters#
Generate per-tilt contrast transfer function filter masks. |
|
Generate CTF filter for reconstructions. |
|
Create per-tilt wedge mask for tomographic data. |
|
Create wedge mask for tomographic reconstructions. |
Reconstruction#
Tomographic reconstruction of 3D Fourier volume from 2D Fourier slices. |