Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/master' into renerichter-rl
Browse files Browse the repository at this point in the history
  • Loading branch information
the-lay committed Nov 8, 2021
2 parents fdc38c8 + c494cde commit 6db742e
Show file tree
Hide file tree
Showing 21 changed files with 1,446 additions and 777 deletions.
3 changes: 0 additions & 3 deletions .coveragerc

This file was deleted.

32 changes: 32 additions & 0 deletions .github/CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
## Bug reports
Please be as specific as you can, ideally with code to recreate the issue.


# Code contribution workflow
First off, thanks for taking the time!
Please feel free to contact me with questions.

1. Fork the repo, then clone it and install in the editable mode:
```bash
git clone git@github.com:YOURNAME/tiler.git && cd tiler
pip install -e .[all]
```

2. Add your changes!

3. After you've finished with your changes, please run linter, tests and check that coverage didn't go down too much:
```bash
black tiler tests
coverage run -m pytest
coverage report
```

4. If you have made any API and/or documentation changes, please regenerate docs by running the script:
```bash
cd misc
./docs.sh
```

5. Once you want to share what you've changed, please commit, push make a pull request to the main repo.

6. Github will run lint and tests, but please don't rely on that and test before pull request :)
38 changes: 25 additions & 13 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,27 +3,39 @@ name: CI
on: [push, pull_request]

jobs:
build:

lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
- uses: psf/black@stable
with:
python-version: '3.x'
options: "--check --diff"
src: "tiler tests"

- name: Install dependencies
test:
runs-on: ubuntu-latest
strategy:
max-parallel: 4
matrix:
# 3.6 will reach EoL in December 2021
# https://devguide.python.org/#status-of-python-branches
python-version: [ "3.7", "3.8", "3.9", "3.10" ]
steps:
- uses: actions/checkout@v2
- name: Setup python
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
architecture: x64
- name: Install test dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
pip install coveralls pytest coverage
- name: Install tiler
run: python setup.py install

pip install .[test]
pip install coveralls
- name: Run tests
run: python -m coverage run --source=tiler -m pytest -vvs tests/

- name: Run coveralls
run: coverage run -m pytest -v
- name: Submit coveralls
if: github.repository == 'the-lay/tiler'
run: coveralls
env:
Expand Down
29 changes: 17 additions & 12 deletions .github/workflows/pypi-publish.yml
Original file line number Diff line number Diff line change
@@ -1,29 +1,34 @@
name: Upload Python Package
name: Publish package

on:
release:
types: [created]

jobs:
deploy:

pypi-publish:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0

- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: '3.x'
- name: Install dependencies

- name: Install build package
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
pip install setuptools wheel twine
- name: Build and publish
env:
TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }}
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
python -m pip install build --user
- name: Build distribution
run: |
python setup.py sdist bdist_wheel
twine upload dist/*
python -m build --sdist --wheel --outdir dist/ .
- name: Publish to PyPI
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags')
uses: pypa/gh-action-pypi-publish@master
with:
password: ${{ secrets.PYPI_API_TOKEN }}
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
# PyCharm stuff
.idea

# setuptools_scm version
tiler/version.py

# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
Expand Down
6 changes: 0 additions & 6 deletions DEVELOPMENT.md

This file was deleted.

44 changes: 3 additions & 41 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,10 @@

![Tiler teaser image](misc/teaser/tiler_teaser.png)

[![CI](https://github.com/the-lay/tiler/workflows/CI/badge.svg)](https://github.com/the-lay/tiler/actions/workflows/ci.yml)
[![CI](https://github.com/the-lay/tiler/actions/workflows/ci.yml/badge.svg)](https://github.com/the-lay/tiler/actions/workflows/ci.yml)
[![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)
[![Coverage status](https://coveralls.io/repos/github/the-lay/tiler/badge.svg?branch=master)](https://coveralls.io/github/the-lay/tiler?branch=master)
[![PyPI version](https://badge.fury.io/py/tiler.svg)](https://badge.fury.io/py/tiler)
[![PyPI Downloads](https://img.shields.io/pypi/dm/tiler)](https://pypistats.org/packages/tiler)
[![Documentation](https://img.shields.io/badge/documentation-✔-green.svg)](https://the-lay.github.io/tiler)


[Github repository](https://github.com/the-lay/tiler) |
Expand All @@ -28,7 +27,7 @@ Features
- N-dimensional *(note: currently tile shape must have the same number of dimensions as the array)*
- Optional in-place tiling
- Optional channel dimension, dimension that is not tiled
- Optional tile batching
- Optional batching
- Tile overlapping
- Access individual tiles with iterator or a getter
- Tile merging, with optional window functions/tapering
Expand Down Expand Up @@ -139,40 +138,3 @@ However, other libraries might fit you better:
Moreover, some related approaches have been described in the literature:
- [Introducing Hann windows for reducing edge-effects in patch-based image segmentation](https://doi.org/10.1371/journal.pone.0229839
), Pielawski and Wählby, March 2020







<!-- for later
For more examples, please see examples/ folder
```python
```
Benchmarks
-------------
Benchmarks?
Examples
-------------
https://github.com/BloodAxe/pytorch-toolbelt#inference-on-huge-images
https://github.com/BloodAxe/pytorch-toolbelt/blob/master/pytorch_toolbelt/inference/tiles.py
https://github.com/vfdev-5/ImageTilingUtils
https://github.com/Vooban/Smoothly-Blend-Image-Patches/blob/master/smooth_tiled_predictions.py
for windows:
https://stackoverflow.com/questions/1988804/what-is-memoization-and-how-can-i-use-it-in-python
https://en.wikipedia.org/wiki/Window_function#A_list_of_window_functions
https://github.com/scipy/scipy/blob/v1.4.1/scipy/signal/windows/windows.py
https://gist.github.com/npielawski/7e77d23209a5c415f55b95d4aba914f6
https://journals.plos.org/plosone/article?id=10.1371/journal.pone.0229839#pone.0229839.ref005
https://arxiv.org/pdf/1803.02786.pdf
-->
709 changes: 461 additions & 248 deletions docs/index.html

Large diffs are not rendered by default.

Binary file modified docs/tiler_teaser.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 1 addition & 3 deletions misc/docs.sh
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
cd $(dirname "$file_name")/..
pwd

# build docs
pip install pdoc==7.1.1
pdoc -o docs -d google tiler

# add downsized teaser image to the docs directory
Expand All @@ -13,4 +11,4 @@ rm docs/index.html
mv docs/tiler.html docs/index.html

# remove unused search index
rm docs/search.json
rm docs/search.js
25 changes: 25 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
[build-system]
requires = [
"setuptools >= 40.6.0",
"setuptools_scm[toml] >= 4, <6",
"setuptools_scm_git_archive",
"wheel"
]
build-backend = "setuptools.build_meta"

[tool.setuptools_scm]
write_to = "tiler/version.py"

[tool.coverage.run]
branch = true
relative_files = true
source = ['tiler']
omit = ['tiler/version.py']

[tool.coverage.report]
show_missing = true
fail_under = 95

[tool.black]
line-length = 88
target-version = ['py38']
2 changes: 0 additions & 2 deletions requirements.txt

This file was deleted.

41 changes: 41 additions & 0 deletions setup.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
[metadata]
name = tiler
version = attr: tiler.__version__
description = N-dimensional NumPy array tiling and merging with easy overlapping, padding and tapering support
long_description = file: README.md
long_description_content_type = text/markdown
url = https://github.com/the-lay/tiler
author = the-lay
author_email = ilja.gubin@gmail.com
license = MIT
license_file = LICENSE.md
classifiers =
Development Status :: 4 - Beta
Intended Audience :: Developers
Intended Audience :: Science/Research
Topic :: Software Development :: Libraries :: Python Modules
License :: OSI Approved :: MIT License
Programming Language :: Python :: 3 :: Only
project_urls =
Documentation = https://the-lay.github.io/tiler/
Source = https://github.com/the-lay/tiler
Issues = https://github.com/the-lay/tiler/issues

[options]
packages = find:
platforms = any
python_requires = >= 3.6
install_requires =
numpy
tqdm

[options.extras_require]
test =
pytest
coverage[toml]
black
docs =
pdoc==8.0.1
all =
%(docs)s
%(test)s
36 changes: 3 additions & 33 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,36 +1,6 @@
#!/usr/bin/env python
import setuptools

from setuptools import setup, find_packages

# version fetch
from tiler import __version__

# readme fetch
with open('README.md', 'r') as f:
long_description = f.read()

setup(name='tiler',
version=__version__,
description='N-dimensional NumPy array tiling and merging with easy overlapping, padding and tapering support',
long_description=long_description,
long_description_content_type='text/markdown',
license='MIT',
author='the-lay',
author_email='ilja.gubin@gmail.com',
url='https://github.com/the-lay/tiler',
platforms=['any'],
install_requires=[
'numpy',
'tqdm'
],
packages=find_packages(),
classifiers=[
'Development Status :: 3 - Alpha',
'Intended Audience :: Developers',
'Intended Audience :: Science/Research',
'Topic :: Software Development :: Libraries :: Python Modules',
'License :: OSI Approved :: MIT License',
'Programming Language :: Python :: 3 :: Only',
]
)

if __name__ == "__main__":
setuptools.setup()
Loading

0 comments on commit 6db742e

Please sign in to comment.