Skip to main content

N-dimensional tiling and merging library

Project description

tiler

Work in progress!

This packages provides tools for N-dimensional tiling (patch extraction) and subsequent merging with tapering (window) functions.

This is especially helpful for semantic segmentation tasks in deep learning, where we often have to work with images that do not fit into GPU memory (2D hyperspectral satellite images, 3D tomographic data, whole slide images etc.).

Implemented features

  • Data reader agnostic: works with numpy arrays
  • Optimized to avoid unnecessary memory copies: numpy views for all tiles, except border tiles that require padding
  • N-dimensional array tiling (but for now tiles must have the same number of dimensions as the array)
  • Supports channel dimension: dimension that will not be tiled
  • Overlapping support: you can specify tile percentage overlap or the overlap size
  • Access individual tiles with consistent indexing or with convenience iterator
  • Merging tiles back into full array: optional un-padding to original shape
  • Merging supports scipy window functions

Roadmap

  • Tests
  • Add border windows generation (like in Pielawski et. al - see references))
  • More examples
  • Implement windows functions and remove scipy dependency (we need only a couple of functions that generate windows)
  • PyTorch Dataset class convenience wrapper?
  • Arbitrary sized tiles (m-dim window over n-dim array, m <= n)?
  • Optional augmentation modes for smoother segmentations?
    • D4 rotation group
    • Mirroring
  • Benchmark with plain for loops, determine overhead

Installation

The latest release is available through pip:

pip install tiler 

Alternatively, you can clone the repository and install it manually:

git clone git@github.com:the-lay/tiler.git
cd tiler
pip install .

Examples

For now, only the one examples/tiler_example.py

Motivation & other tiling/patching libraries

I work on semantic segmentation of patched 3D data and I often found myself reusing tiling functions that I wrote for previous projects. No existing libraries listed below fit my use case, so that's why I wrote tiler.

However, there are other libraries that might fit you better:

References

Introducing Hann windows for reducing edge-effects in patch-based image segmentation, Pielawski and Wählby, March 2020

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

tiler-0.0.1.tar.gz (14.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

tiler-0.0.1-py3-none-any.whl (14.3 kB view details)

Uploaded Python 3

File details

Details for the file tiler-0.0.1.tar.gz.

File metadata

  • Download URL: tiler-0.0.1.tar.gz
  • Upload date:
  • Size: 14.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.23.0 setuptools/46.1.3.post20200330 requests-toolbelt/0.9.1 tqdm/4.45.0 CPython/3.7.7

File hashes

Hashes for tiler-0.0.1.tar.gz
Algorithm Hash digest
SHA256 4e88cf1f27d04b7df88f1474d96deb181be3cd5b0301de960cd057a398e2191d
MD5 7b9eb33125ddcac7f559f4f4efffe657
BLAKE2b-256 9976d6d0dea577d9afdcc9d7beaae0e521c7e79d277dd9bea716081328ebfb84

See more details on using hashes here.

File details

Details for the file tiler-0.0.1-py3-none-any.whl.

File metadata

  • Download URL: tiler-0.0.1-py3-none-any.whl
  • Upload date:
  • Size: 14.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.23.0 setuptools/46.1.3.post20200330 requests-toolbelt/0.9.1 tqdm/4.45.0 CPython/3.7.7

File hashes

Hashes for tiler-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 cdf017fdb9398182fc074bb393ce8fe1f71701963d89fbf089df9ecd5bd21d3b
MD5 a2cf3a545f9b053e8e179d1187c5f790
BLAKE2b-256 c1a042f6cc1ab07394db120afb7aefe08572ca7d6c211f6639c27a32e4d92c27

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page