From 9ca2d8c7f219d3a7cad96b803601f54879154451 Mon Sep 17 00:00:00 2001 From: Alister Burt Date: Sat, 25 May 2024 11:09:11 -0700 Subject: [PATCH] add README.md --- README.md | 39 ++++++++++++++++++++++++++++++++++++++- 1 file changed, 38 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index b60cef6..39da459 100644 --- a/README.md +++ b/README.md @@ -6,7 +6,44 @@ [![CI](https://github.com/alisterburt/torch-phase-shift/actions/workflows/ci.yml/badge.svg)](https://github.com/alisterburt/torch-phase-shift/actions/workflows/ci.yml) [![codecov](https://codecov.io/gh/alisterburt/torch-phase-shift/branch/main/graph/badge.svg)](https://codecov.io/gh/alisterburt/torch-phase-shift) -Translate 2D/3D images by phase shifting Fourier transforms in PyTorch. +*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 very simple example](./assets/shift_2d_image.png){ width="500" } +
Shifting a 2D image with torch-fourier-shift
+
+ + +```python +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. + +```shell +pip install torch-fourier-shift +``` + +## Usage + +Please check the the docs at [teamtomo.org/torch-fourier-shift](https://teamtomo.org/torch-fourier-shift/)