nabu.reconstruction.filtering module¶
- class nabu.reconstruction.filtering.SinoFilter(sino_shape, filter_name=None, padding_mode='zeros', extra_options=None)[source]¶
Bases:
object
- available_filters = ['ramlak', 'shepp-logan', 'cosine', 'hamming', 'hann', 'tukey', 'lanczos', 'hilbert']¶
A class for sinogram filtering. It does the following:
pad input array
Fourier transform each row
multiply with a 1D or 2D filter
inverse Fourier transform
- available_padding_modes = ['constant', 'edge', 'reflect', 'symmetric', 'wrap']¶
- default_extra_options = {'cutoff': 1.0, 'fft_threads': 0}¶
- set_filter(h_filt, normalize=True)[source]¶
Set a filter for sinogram filtering.
- Parameters:
h_filt (numpy.ndarray) – Array containing the filter. Each line of the sinogram will be filtered with this filter. It has to be the Real-to-Complex Fourier Transform of some real filter, padded to 2*sinogram_width.
normalize (bool or float, optional) – Whether to normalize (multiply) the filter with pi/num_angles.
- filter_sino(sino, output=None, no_output=False)[source]¶
Perform the sinogram siltering.
- Parameters:
sino (numpy.ndarray or pycuda.gpuarray.GPUArray) – Input sinogram (2D or 3D)
output (numpy.ndarray or pycuda.gpuarray.GPUArray, optional) – Output array.
no_output (bool, optional) – If set to True, no copy is be done. The resulting data lies in self.d_sino_padded.
- nabu.reconstruction.filtering.filter_sinogram(sinogram, padded_width, filter_name='ramlak', padding_mode='constant', normalize=True, filter_cutoff=1.0, **padding_kwargs)[source]¶
Simple function to filter sinogram.
- Parameters:
sinogram (numpy.ndarray) – Sinogram, two dimensional array with shape (n_angles, sino_width)
padded_width (int) – Width to use for padding. Must be greater than sinogram width (i.e than sinogram.shape[-1])
filter_name (str, optional) – Which filter to use. Default is ramlak (roughly equivalent to abs(nu) in frequency domain)
padding_mode (str, optional) – Which padding mode to use. Default is zero-padding.
normalize (bool, optional) – Whether to multiply the filtered sinogram with pi/n_angles
filter_cutoff (float, optional) – frequency cutoff for filter