Skip to content

Translate 2D/3D images by phase shifting Fourier transforms in PyTorch

License

Notifications You must be signed in to change notification settings

teamtomo/torch-fourier-shift

Repository files navigation

torch-phase-shift

License PyPI Python Version CI codecov

torch-fourier-shift is a package for shifting 2D and 3D images with subpixel precision by applying phase shifts to Fourier transforms in PyTorch.

A 2D image and the shifted result

import torch
from torch_fourier_shift import fourier_shift_image_2d

# create a dummy image
my_image = torch.tensor(
    [[0, 0, 0, 0, 0, 0],
     [0, 1, 0, 0, 0, 0],
     [0, 0, 0, 0, 0, 0],
     [0, 0, 0, 0, 0, 0],
     [0, 0, 0, 0, 0, 0],
     [0, 0, 0, 0, 0, 0]]
)

# shift the image by 1 pixel in dim 0, 2 pixels in dim 1
shifted_image = fourier_shift_image_2d(image=my_image, shifts=torch.tensor([1, 2]))

Installation

torch-fourier-shift is available on PyPI.

pip install torch-fourier-shift

Usage

Please check the the docs at teamtomo.org/torch-fourier-shift

About

Translate 2D/3D images by phase shifting Fourier transforms in PyTorch

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages