sinofilter: Sinogram filtering.

Module for sinogram filtering on CPU/GPU.

compute_ramlak_filter(dwidth_padded, dtype=<class 'numpy.float32'>)[source]

Compute the Ramachandran-Lakshminarayanan (Ram-Lak) filter, used in filtered backprojection.

Parameters:
  • dwidth_padded – width of the 2D sinogram after padding
  • dtype – data type
tukey(N, alpha=0.5)[source]

Compute the Tukey apodization window.

Parameters:
  • N (int) – Number of points.
  • alpha (float) –
lanczos(N)[source]

Compute the Lanczos window (truncated sinc) of width N.

Parameters:N (int) – window width
compute_fourier_filter(dwidth_padded, filter_name, cutoff=1.0)[source]

Compute the filter used for FBP.

Parameters:
  • dwidth_padded – padded detector width. As the filtering is done by the Fourier convolution theorem, dwidth_padded should be at least 2*dwidth.
  • filter_name – Name of the filter. Available filters are: Ram-Lak, Shepp-Logan, Cosine, Hamming, Hann, Tukey, Lanczos.
  • cutoff – Cut-off frequency, if relevant.
class SinoFilter(sino_shape, filter_name=None, ctx=None, devicetype='all', platformid=None, deviceid=None, profile=False, extra_options=None)[source]

Bases: silx.opencl.processing.OpenclProcessing

A class for performing sinogram filtering on GPU using OpenCL. This is a convolution in the Fourier space, along one dimension:

  • In 2D: (n_a, d_x): n_a filterings (1D FFT of size d_x)
  • In 3D: (n_z, n_a, d_x): n_z*n_a filterings (1D FFT of size d_x)
set_filter(h_filt, normalize=True)[source]

Set a filter for sinogram filtering.

Parameters:
  • h_filt – 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 – Whether to normalize the filter with pi/num_angles.
copy2d(dst, src, transfer_shape, dst_offset=(0, 0), src_offset=(0, 0))[source]
Parameters:
  • dst
  • src
  • transfer_shape
  • dst_offset
  • src_offset
copy2d_host(dst, src, transfer_shape, dst_offset=(0, 0), src_offset=(0, 0))[source]
Parameters:
  • dst
  • src
  • transfer_shape
  • dst_offset
  • src_offset
filter_sino(sino, output=None)[source]
Parameters:
  • sino – sinogram
  • output
Returns:

filtered sinogram

fourier_filter(sino, filter_=None, fft_size=None)[source]

Simple np based implementation of fourier space filter. This function is deprecated, please use silx.opencl.sinofilter.SinoFilter.

Parameters:
  • sino – of shape shape = (num_projs, num_bins)
  • filter – filter function to apply in fourier space
Fft_size:

size on which perform the fft. May be larger than the sino array

Returns:

filtered sinogram