Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions torch_radon/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,14 +93,14 @@ def filter_sinogram(self, sinogram, filter_name="ramp"):

padded_sinogram = F.pad(sinogram.float(), (0, pad, 0, 0))
# TODO should be possible to use onesided=True saving memory and time
sino_fft = torch.rfft(padded_sinogram, 1, normalized=True, onesided=False)
sino_fft = torch.fft.fft(padded_sinogram)

# get filter and apply
f = self.fourier_filters.get(padded_size, filter_name, sinogram.device)
filtered_sino_fft = sino_fft * f
filtered_sino_fft = sino_fft * f.squeeze(2).unsqueeze(1)

# Inverse fft
filtered_sinogram = torch.irfft(filtered_sino_fft, 1, normalized=True, onesided=False)
filtered_sinogram = torch.real(torch.fft.ifft(filtered_sino_fft))

# pad removal and rescaling
filtered_sinogram = filtered_sinogram[:, :, :-pad] * (np.pi / (2 * n_angles))
Expand Down