-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add docs and deploy as torch-fourier-shift
- Loading branch information
1 parent
55856cc
commit 450a3aa
Showing
19 changed files
with
235 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,7 +5,7 @@ author_email: [email protected] | |
author_name: Alister Burt | ||
github_username: alisterburt | ||
mode: tooling | ||
module_name: torch_phase_shift | ||
module_name: torch_fourier_shift | ||
project_name: torch-phase-shift | ||
project_short_description: Translate images by phase shifting Fourier transforms in | ||
PyTorch | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
name: docs | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
|
||
# This job installs dependencies, builds the book, and pushes it to | ||
# the `gh-pages` branch of the same repository. | ||
jobs: | ||
deploy-book: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v4 | ||
|
||
- name: Set up Python | ||
uses: actions/setup-python@v5 | ||
with: | ||
python-version: "3.10" | ||
|
||
- name: Install dependencies | ||
run: | | ||
pip install -e .[docs] | ||
# Build the book | ||
- name: Build the book | ||
run: | | ||
mkdocs build | ||
# Push the site to github-pages | ||
- name: GitHub Pages action | ||
uses: peaceiris/actions-gh-pages@v4 | ||
with: | ||
publish_dir: ./site | ||
github_token: ${{ secrets.GITHUB_TOKEN }} |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
::: torch_fourier_shift.fourier_shift_dft_2d |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
::: torch_fourier_shift.fourier_shift_dft_3d |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
```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])) | ||
``` | ||
|
||
## Notes | ||
- shifts can be applied to arrays of 2D images `(..., h, w)` | ||
- arrays of 2D shifts are supported `(..., 2)` | ||
|
||
::: torch_fourier_shift.fourier_shift_image_2d | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
```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])) | ||
``` | ||
|
||
## Notes | ||
- shifts can be applied to arrays of 3D images `(..., d, h, w)` | ||
- arrays of 3D shifts are supported `(..., 3)` | ||
|
||
::: torch_fourier_shift.fourier_shift_image_3d |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
# Overview | ||
|
||
*torch-fourier-shift* is a package for shifting 2D and 3D images with subpixel precision | ||
by applying phase shifts to Fourier transforms in PyTorch. | ||
|
||
<figure markdown> | ||
![A very simple example](./assets/shift_2d_image.png){ width="500" } | ||
<figcaption>Shifting a 2D image with torch-fourier-shift</figcaption> | ||
</figure> | ||
|
||
|
||
```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 examples linked in the sidebar | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
site_name: teamtomo/torch-fourier-shift | ||
site_url: https://teamtomo.org/torch-fourier-shift | ||
site_author: teamtomo | ||
site_description: >- | ||
Documentation for torch-fourier-shift | ||
repo_name: teamtomo/torch-fourier-shift | ||
repo_url: https://github.com/teamtomo/torch-fourier-shift | ||
edit_uri: edit/main/docs/ | ||
copyright: Copyright © 2024 - 2024 teamtomo | ||
|
||
|
||
# Custom navigation can be specified | ||
nav: | ||
- Overview: index.md | ||
- I want to: | ||
- Shift 2D Image(s): examples/shift_image_2d.md | ||
- Shift 3D Image(s): examples/shift_image_3d.md | ||
- Shift 2D Fourier Transform(s): examples/shift_dft_2d.md | ||
- Shift 3D Fourier Transform(s): examples/shift_dft_3d.md | ||
|
||
|
||
theme: | ||
icon: | ||
logo: material/cube-outline | ||
name: material | ||
palette: | ||
# Palette toggle for light mode | ||
- media: "(prefers-color-scheme: light)" | ||
scheme: default | ||
primary: blue | ||
accent: blue | ||
|
||
features: | ||
- navigation.instant | ||
- navigation.expand | ||
- search.highlight | ||
- search.suggest | ||
- content.tabs.link | ||
|
||
markdown_extensions: | ||
- admonition | ||
- tables | ||
- pymdownx.details | ||
- pymdownx.superfences | ||
- pymdownx.tabbed: | ||
alternate_style: true | ||
- attr_list | ||
- pymdownx.superfences | ||
- pymdownx.highlight | ||
- pymdownx.emoji: | ||
emoji_index: !!python/name:material.extensions.emoji.twemoji | ||
emoji_generator: !!python/name:materialx.emoji.to_svg | ||
- md_in_html | ||
- pymdownx.arithmatex: | ||
generic: true | ||
|
||
plugins: | ||
- search | ||
- mkdocstrings: | ||
handlers: | ||
python: | ||
import: | ||
- https://docs.python.org/3/objects.inv | ||
- https://numpy.org/doc/stable/objects.inv | ||
options: | ||
show_root_heading: true # default is false | ||
docstring_style: "numpy" | ||
line_length: 50 # default is 60 | ||
# show_if_no_docstring: true # default is false | ||
# show_signature: false # default is true | ||
show_signature_annotations: true # default is false | ||
annotations_path: "source" # default is 'brief' | ||
show_bases: false # default is true | ||
show_source: true # default is true | ||
docstring_section_style: table | ||
merge_init_into_class: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
from .fourier_shift_dft import fourier_shift_dft_2d, fourier_shift_dft_3d | ||
from .fourier_shift_image import fourier_shift_image_2d, fourier_shift_image_3d |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.