torch-cryoeraser 0.0.2__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- torch_cryoeraser-0.0.2/.github/ISSUE_TEMPLATE.md +15 -0
- torch_cryoeraser-0.0.2/.github/TEST_FAIL_TEMPLATE.md +12 -0
- torch_cryoeraser-0.0.2/.github/dependabot.yml +10 -0
- torch_cryoeraser-0.0.2/.github/workflows/build-and-deploy-docs.yml +36 -0
- torch_cryoeraser-0.0.2/.github/workflows/ci.yml +83 -0
- torch_cryoeraser-0.0.2/.gitignore +111 -0
- torch_cryoeraser-0.0.2/LICENSE +28 -0
- torch_cryoeraser-0.0.2/PKG-INFO +85 -0
- torch_cryoeraser-0.0.2/README.md +43 -0
- torch_cryoeraser-0.0.2/assets/erased.jpg +0 -0
- torch_cryoeraser-0.0.2/docs/examples/erase_fiducials.ipynb +131 -0
- torch_cryoeraser-0.0.2/docs/index.md +41 -0
- torch_cryoeraser-0.0.2/mkdocs.yml +51 -0
- torch_cryoeraser-0.0.2/pyproject.toml +114 -0
- torch_cryoeraser-0.0.2/src/torch_cryoeraser/__init__.py +17 -0
- torch_cryoeraser-0.0.2/src/torch_cryoeraser/erase.py +118 -0
- torch_cryoeraser-0.0.2/src/torch_cryoeraser/sparse_local_mean.py +65 -0
- torch_cryoeraser-0.0.2/src/torch_cryoeraser/utils.py +90 -0
- torch_cryoeraser-0.0.2/tests/test_torch_cryoeraser.py +30 -0
- torch_cryoeraser-0.0.2/uv.lock +3068 -0
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
* torch-cryoeraser version:
|
|
2
|
+
* Python version:
|
|
3
|
+
* Operating System:
|
|
4
|
+
|
|
5
|
+
### Description
|
|
6
|
+
|
|
7
|
+
Describe what you were trying to get done.
|
|
8
|
+
Tell us what happened, what went wrong, and what you expected to happen.
|
|
9
|
+
|
|
10
|
+
### What I Did
|
|
11
|
+
|
|
12
|
+
```
|
|
13
|
+
Paste the command(s) you ran and the output.
|
|
14
|
+
If there was a crash, please include the traceback here.
|
|
15
|
+
```
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: "{{ env.TITLE }}"
|
|
3
|
+
labels: [bug]
|
|
4
|
+
---
|
|
5
|
+
The {{ workflow }} workflow failed on {{ date | date("YYYY-MM-DD HH:mm") }} UTC
|
|
6
|
+
|
|
7
|
+
The most recent failing test was on {{ env.PLATFORM }} py{{ env.PYTHON }}
|
|
8
|
+
with commit: {{ sha }}
|
|
9
|
+
|
|
10
|
+
Full run: https://github.com/{{ repo }}/actions/runs/{{ env.RUN_ID }}
|
|
11
|
+
|
|
12
|
+
(This post will be updated if another test fails, as long as this issue remains open.)
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
# https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates
|
|
2
|
+
|
|
3
|
+
version: 2
|
|
4
|
+
updates:
|
|
5
|
+
- package-ecosystem: "github-actions"
|
|
6
|
+
directory: "/"
|
|
7
|
+
schedule:
|
|
8
|
+
interval: "weekly"
|
|
9
|
+
commit-message:
|
|
10
|
+
prefix: "ci(dependabot):"
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
name: docs
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches:
|
|
6
|
+
- main
|
|
7
|
+
|
|
8
|
+
# This job installs dependencies, builds the book, and pushes it to
|
|
9
|
+
# the `gh-pages` branch of the same repository.
|
|
10
|
+
jobs:
|
|
11
|
+
deploy-book:
|
|
12
|
+
runs-on: ubuntu-latest
|
|
13
|
+
steps:
|
|
14
|
+
- name: Checkout repository
|
|
15
|
+
uses: actions/checkout@v4
|
|
16
|
+
|
|
17
|
+
- name: Set up Python
|
|
18
|
+
uses: actions/setup-python@v5
|
|
19
|
+
with:
|
|
20
|
+
python-version: "3.10"
|
|
21
|
+
|
|
22
|
+
- name: Install dependencies
|
|
23
|
+
run: |
|
|
24
|
+
# pip install -e .
|
|
25
|
+
pip install mkdocs mkdocs-material mkdocs-jupyter mkdocstrings[python]
|
|
26
|
+
|
|
27
|
+
- name: Build the docs
|
|
28
|
+
run: |
|
|
29
|
+
mkdocs build
|
|
30
|
+
|
|
31
|
+
# Push the site to github-pages
|
|
32
|
+
- name: GitHub Pages action
|
|
33
|
+
uses: peaceiris/actions-gh-pages@v4
|
|
34
|
+
with:
|
|
35
|
+
publish_dir: ./site
|
|
36
|
+
github_token: ${{ secrets.GITHUB_TOKEN }}
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
name: CI
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches:
|
|
6
|
+
- main
|
|
7
|
+
tags:
|
|
8
|
+
- "v*"
|
|
9
|
+
pull_request:
|
|
10
|
+
workflow_dispatch:
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
# cancel in-progress runs that use the same workflow and branch
|
|
14
|
+
concurrency:
|
|
15
|
+
group: ${{ github.workflow }}-${{ github.ref }}
|
|
16
|
+
cancel-in-progress: true
|
|
17
|
+
|
|
18
|
+
jobs:
|
|
19
|
+
test:
|
|
20
|
+
name: ${{ matrix.platform }} (${{ matrix.python-version }})
|
|
21
|
+
runs-on: ${{ matrix.platform }}
|
|
22
|
+
strategy:
|
|
23
|
+
fail-fast: false
|
|
24
|
+
matrix:
|
|
25
|
+
python-version: ["3.9", "3.10", "3.11", "3.12", "3.13"]
|
|
26
|
+
platform: [ubuntu-latest, macos-latest, ] # windows-latest]
|
|
27
|
+
|
|
28
|
+
steps:
|
|
29
|
+
- uses: actions/checkout@v4
|
|
30
|
+
|
|
31
|
+
- name: 🐍 Set up Python ${{ matrix.python-version }}
|
|
32
|
+
uses: actions/setup-python@v5
|
|
33
|
+
with:
|
|
34
|
+
python-version: ${{ matrix.python-version }}
|
|
35
|
+
cache-dependency-path: "pyproject.toml"
|
|
36
|
+
cache: "pip"
|
|
37
|
+
|
|
38
|
+
- name: Install Dependencies
|
|
39
|
+
run: |
|
|
40
|
+
python -m pip install -U pip
|
|
41
|
+
python -m pip install .[test]
|
|
42
|
+
|
|
43
|
+
- name: 🧪 Run Tests
|
|
44
|
+
run: pytest --color=yes --cov --cov-report=xml --cov-report=term-missing
|
|
45
|
+
|
|
46
|
+
- name: Coverage
|
|
47
|
+
uses: codecov/codecov-action@v5
|
|
48
|
+
|
|
49
|
+
deploy:
|
|
50
|
+
name: Deploy
|
|
51
|
+
needs: test
|
|
52
|
+
if: success() && startsWith(github.ref, 'refs/tags/')
|
|
53
|
+
runs-on: ubuntu-latest
|
|
54
|
+
|
|
55
|
+
permissions:
|
|
56
|
+
# IMPORTANT: this permission is mandatory for trusted publishing on PyPi
|
|
57
|
+
# see https://docs.pypi.org/trusted-publishers/
|
|
58
|
+
id-token: write
|
|
59
|
+
# This permission allows writing releases
|
|
60
|
+
contents: write
|
|
61
|
+
|
|
62
|
+
steps:
|
|
63
|
+
- uses: actions/checkout@v4
|
|
64
|
+
with:
|
|
65
|
+
fetch-depth: 0
|
|
66
|
+
|
|
67
|
+
- name: 🐍 Set up Python
|
|
68
|
+
uses: actions/setup-python@v5
|
|
69
|
+
with:
|
|
70
|
+
python-version: "3.x"
|
|
71
|
+
|
|
72
|
+
- name: 👷 Build
|
|
73
|
+
run: |
|
|
74
|
+
python -m pip install build
|
|
75
|
+
python -m build
|
|
76
|
+
|
|
77
|
+
- name: 🚢 Publish to PyPI
|
|
78
|
+
uses: pypa/gh-action-pypi-publish@release/v1
|
|
79
|
+
|
|
80
|
+
- uses: softprops/action-gh-release@v2
|
|
81
|
+
with:
|
|
82
|
+
generate_release_notes: true
|
|
83
|
+
files: './dist/*'
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
# Byte-compiled / optimized / DLL files
|
|
2
|
+
__pycache__/
|
|
3
|
+
*.py[cod]
|
|
4
|
+
*$py.class
|
|
5
|
+
|
|
6
|
+
# C extensions
|
|
7
|
+
*.so
|
|
8
|
+
|
|
9
|
+
# Distribution / packaging
|
|
10
|
+
.Python
|
|
11
|
+
env/
|
|
12
|
+
build/
|
|
13
|
+
develop-eggs/
|
|
14
|
+
dist/
|
|
15
|
+
downloads/
|
|
16
|
+
eggs/
|
|
17
|
+
.eggs/
|
|
18
|
+
lib/
|
|
19
|
+
lib64/
|
|
20
|
+
parts/
|
|
21
|
+
sdist/
|
|
22
|
+
var/
|
|
23
|
+
wheels/
|
|
24
|
+
*.egg-info/
|
|
25
|
+
.installed.cfg
|
|
26
|
+
*.egg
|
|
27
|
+
|
|
28
|
+
.DS_Store
|
|
29
|
+
|
|
30
|
+
# PyInstaller
|
|
31
|
+
# Usually these files are written by a python script from a template
|
|
32
|
+
# before PyInstaller builds the exe, so as to inject date/other infos into it.
|
|
33
|
+
*.manifest
|
|
34
|
+
*.spec
|
|
35
|
+
|
|
36
|
+
# Installer logs
|
|
37
|
+
pip-log.txt
|
|
38
|
+
pip-delete-this-directory.txt
|
|
39
|
+
|
|
40
|
+
# Unit test / coverage reports
|
|
41
|
+
htmlcov/
|
|
42
|
+
.tox/
|
|
43
|
+
.coverage
|
|
44
|
+
.coverage.*
|
|
45
|
+
.cache
|
|
46
|
+
nosetests.xml
|
|
47
|
+
coverage.xml
|
|
48
|
+
*.cover
|
|
49
|
+
.hypothesis/
|
|
50
|
+
.pytest_cache/
|
|
51
|
+
|
|
52
|
+
# Translations
|
|
53
|
+
*.mo
|
|
54
|
+
*.pot
|
|
55
|
+
|
|
56
|
+
# Django stuff:
|
|
57
|
+
*.log
|
|
58
|
+
local_settings.py
|
|
59
|
+
|
|
60
|
+
# Flask stuff:
|
|
61
|
+
instance/
|
|
62
|
+
.webassets-cache
|
|
63
|
+
|
|
64
|
+
# Scrapy stuff:
|
|
65
|
+
.scrapy
|
|
66
|
+
|
|
67
|
+
# Sphinx documentation
|
|
68
|
+
docs/_build/
|
|
69
|
+
|
|
70
|
+
# PyBuilder
|
|
71
|
+
target/
|
|
72
|
+
|
|
73
|
+
# Jupyter Notebook
|
|
74
|
+
.ipynb_checkpoints
|
|
75
|
+
|
|
76
|
+
# pyenv
|
|
77
|
+
.python-version
|
|
78
|
+
|
|
79
|
+
# celery beat schedule file
|
|
80
|
+
celerybeat-schedule
|
|
81
|
+
|
|
82
|
+
# SageMath parsed files
|
|
83
|
+
*.sage.py
|
|
84
|
+
|
|
85
|
+
# dotenv
|
|
86
|
+
.env
|
|
87
|
+
|
|
88
|
+
# virtualenv
|
|
89
|
+
.venv
|
|
90
|
+
venv/
|
|
91
|
+
ENV/
|
|
92
|
+
|
|
93
|
+
# Spyder project settings
|
|
94
|
+
.spyderproject
|
|
95
|
+
.spyproject
|
|
96
|
+
|
|
97
|
+
# Rope project settings
|
|
98
|
+
.ropeproject
|
|
99
|
+
|
|
100
|
+
# mkdocs documentation
|
|
101
|
+
/site
|
|
102
|
+
|
|
103
|
+
# mypy
|
|
104
|
+
.mypy_cache/
|
|
105
|
+
|
|
106
|
+
# ruff
|
|
107
|
+
.ruff_cache/
|
|
108
|
+
|
|
109
|
+
# IDE settings
|
|
110
|
+
.vscode/
|
|
111
|
+
.idea/
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
BSD 3-Clause License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2023, Alister Burt
|
|
4
|
+
|
|
5
|
+
Redistribution and use in source and binary forms, with or without
|
|
6
|
+
modification, are permitted provided that the following conditions are met:
|
|
7
|
+
|
|
8
|
+
1. Redistributions of source code must retain the above copyright notice, this
|
|
9
|
+
list of conditions and the following disclaimer.
|
|
10
|
+
|
|
11
|
+
2. Redistributions in binary form must reproduce the above copyright notice,
|
|
12
|
+
this list of conditions and the following disclaimer in the documentation
|
|
13
|
+
and/or other materials provided with the distribution.
|
|
14
|
+
|
|
15
|
+
3. Neither the name of the copyright holder nor the names of its
|
|
16
|
+
contributors may be used to endorse or promote products derived from
|
|
17
|
+
this software without specific prior written permission.
|
|
18
|
+
|
|
19
|
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
|
20
|
+
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
21
|
+
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
22
|
+
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
|
23
|
+
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
24
|
+
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
|
25
|
+
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
|
26
|
+
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
|
27
|
+
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
28
|
+
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: torch-cryoeraser
|
|
3
|
+
Version: 0.0.2
|
|
4
|
+
Summary: Erase masked regions from cryo-EM images
|
|
5
|
+
Project-URL: homepage, https://github.com/teamtomo/torch-cryoeraser
|
|
6
|
+
Project-URL: repository, https://github.com/teamtomo/torch-cryoeraser
|
|
7
|
+
Author-email: Alister Burt <alisterburt@gmail.com>
|
|
8
|
+
License: BSD-3-Clause
|
|
9
|
+
License-File: LICENSE
|
|
10
|
+
Classifier: Development Status :: 3 - Alpha
|
|
11
|
+
Classifier: License :: OSI Approved :: BSD License
|
|
12
|
+
Classifier: Programming Language :: Python :: 3
|
|
13
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
14
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
18
|
+
Classifier: Typing :: Typed
|
|
19
|
+
Requires-Python: >=3.9
|
|
20
|
+
Requires-Dist: einops
|
|
21
|
+
Requires-Dist: numpy
|
|
22
|
+
Requires-Dist: scipy
|
|
23
|
+
Requires-Dist: torch
|
|
24
|
+
Provides-Extra: dev
|
|
25
|
+
Requires-Dist: ipython; extra == 'dev'
|
|
26
|
+
Requires-Dist: matplotlib; extra == 'dev'
|
|
27
|
+
Requires-Dist: mkdocs-jupyter; extra == 'dev'
|
|
28
|
+
Requires-Dist: mkdocs-material; extra == 'dev'
|
|
29
|
+
Requires-Dist: mkdocstrings[python]; extra == 'dev'
|
|
30
|
+
Requires-Dist: pdbpp; extra == 'dev'
|
|
31
|
+
Requires-Dist: pooch; extra == 'dev'
|
|
32
|
+
Requires-Dist: rich; extra == 'dev'
|
|
33
|
+
Requires-Dist: tifffile; extra == 'dev'
|
|
34
|
+
Provides-Extra: examples
|
|
35
|
+
Requires-Dist: matplotlib; extra == 'examples'
|
|
36
|
+
Requires-Dist: pooch; extra == 'examples'
|
|
37
|
+
Requires-Dist: tifffile; extra == 'examples'
|
|
38
|
+
Provides-Extra: test
|
|
39
|
+
Requires-Dist: pytest; extra == 'test'
|
|
40
|
+
Requires-Dist: pytest-cov; extra == 'test'
|
|
41
|
+
Description-Content-Type: text/markdown
|
|
42
|
+
|
|
43
|
+
# torch-cryoeraser
|
|
44
|
+
|
|
45
|
+
[](https://github.com/teamtomo/torch-cryoeraser/raw/main/LICENSE)
|
|
46
|
+
[](https://pypi.org/project/torch-cryoeraser)
|
|
47
|
+
[](https://python.org)
|
|
48
|
+
[](https://github.com/teamtomo/torch-cryoeraser/actions/workflows/ci.yml)
|
|
49
|
+
[](https://codecov.io/gh/teamtomo/torch-cryoeraser)
|
|
50
|
+
|
|
51
|
+
*torch-cryoeraser* is a Python package for erasing local regions of cryo-EM images.
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
<p align="center">
|
|
55
|
+
<img src="assets/erased.jpg" width="600" alt="result of usig torch-cryoeraser">
|
|
56
|
+
</p>
|
|
57
|
+
|
|
58
|
+
Image data in masked regions are replaced with noise matching local image statistics.
|
|
59
|
+
|
|
60
|
+
## Installation
|
|
61
|
+
|
|
62
|
+
```python
|
|
63
|
+
pip install torch-cryoeraser
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
## Usage
|
|
67
|
+
|
|
68
|
+
```python
|
|
69
|
+
import torch
|
|
70
|
+
import tifffile
|
|
71
|
+
from torch_cryoeraser import erase_region_2d
|
|
72
|
+
|
|
73
|
+
# load image and mask
|
|
74
|
+
image = tifffile.imread("image.tif")
|
|
75
|
+
mask = tifffile.imread("mask.tif")
|
|
76
|
+
|
|
77
|
+
# to torch tensor
|
|
78
|
+
image = torch.tensor(image)
|
|
79
|
+
mask = torch.tensor(mask)
|
|
80
|
+
|
|
81
|
+
# erase masked regions
|
|
82
|
+
erased_image = erase_region_2d(image=image, mask=mask)
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
for more info, please check the [documentation](https://teamtomo.org/torch-cryoeraser).
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
# torch-cryoeraser
|
|
2
|
+
|
|
3
|
+
[](https://github.com/teamtomo/torch-cryoeraser/raw/main/LICENSE)
|
|
4
|
+
[](https://pypi.org/project/torch-cryoeraser)
|
|
5
|
+
[](https://python.org)
|
|
6
|
+
[](https://github.com/teamtomo/torch-cryoeraser/actions/workflows/ci.yml)
|
|
7
|
+
[](https://codecov.io/gh/teamtomo/torch-cryoeraser)
|
|
8
|
+
|
|
9
|
+
*torch-cryoeraser* is a Python package for erasing local regions of cryo-EM images.
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
<p align="center">
|
|
13
|
+
<img src="assets/erased.jpg" width="600" alt="result of usig torch-cryoeraser">
|
|
14
|
+
</p>
|
|
15
|
+
|
|
16
|
+
Image data in masked regions are replaced with noise matching local image statistics.
|
|
17
|
+
|
|
18
|
+
## Installation
|
|
19
|
+
|
|
20
|
+
```python
|
|
21
|
+
pip install torch-cryoeraser
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
## Usage
|
|
25
|
+
|
|
26
|
+
```python
|
|
27
|
+
import torch
|
|
28
|
+
import tifffile
|
|
29
|
+
from torch_cryoeraser import erase_region_2d
|
|
30
|
+
|
|
31
|
+
# load image and mask
|
|
32
|
+
image = tifffile.imread("image.tif")
|
|
33
|
+
mask = tifffile.imread("mask.tif")
|
|
34
|
+
|
|
35
|
+
# to torch tensor
|
|
36
|
+
image = torch.tensor(image)
|
|
37
|
+
mask = torch.tensor(mask)
|
|
38
|
+
|
|
39
|
+
# erase masked regions
|
|
40
|
+
erased_image = erase_region_2d(image=image, mask=mask)
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
for more info, please check the [documentation](https://teamtomo.org/torch-cryoeraser).
|
|
Binary file
|