All Projects → the-lay → tiler

the-lay / tiler

Licence: MIT License
N-dimensional NumPy array tiling and merging with overlapping, padding and tapering

Programming Languages

python
139335 projects - #7 most used programming language
shell
77523 projects

Projects that are alternatives of or similar to tiler

Quicktile
Adds window-tiling hotkeys to any X11 desktop. (An analogue to WinSplit Revolution for people who don't want to use Compiz Grid)
Stars: ✭ 719 (+2665.38%)
Mutual labels:  utility, tiling
diskusage
FANTASTIC SPEED utility to find out top largest folders/files on the disk.
Stars: ✭ 64 (+146.15%)
Mutual labels:  utility
gn-api-sdk-node
SDK em NodeJS integrada a API Gerencianet. Esta SDK está preparada para integração à API Pix e API Boletos da Gerencianet, que lhe permite realizar o gerenciamento de cobranças Pix com QR Code e Pix Copia e Cola, boleto/Bolix, carnê, cartão de crédito e muito mais.
Stars: ✭ 33 (+26.92%)
Mutual labels:  split
Pagination-Utils
A collection of methods to make message pagination with JDA easier.
Stars: ✭ 20 (-23.08%)
Mutual labels:  utility
sc2gears
The COMPLETE (!) source code of the Sc2gears universe (Sc2gears app + Sc2gears Database + web-based parsing engine - bundled in an Eclipse project).
Stars: ✭ 30 (+15.38%)
Mutual labels:  utility
jdime
syntactic merge tool for java
Stars: ✭ 14 (-46.15%)
Mutual labels:  merging
smcutil
SMC utility for modifying and examining Apple's SMC payloads.
Stars: ✭ 30 (+15.38%)
Mutual labels:  utility
91porn-utility
91porn comprehensive utility
Stars: ✭ 78 (+200%)
Mutual labels:  utility
pynotify
A Python package to send emails like humans.
Stars: ✭ 21 (-19.23%)
Mutual labels:  utility
YetAnotherKeyDisplayer
The application for displaying pressed keys of the keyboard
Stars: ✭ 88 (+238.46%)
Mutual labels:  utility
fennec
Rewriting functions in compiled binaries using McSema
Stars: ✭ 78 (+200%)
Mutual labels:  patching
pv
Unix Pipe Viewer (pv) utility in Node.js
Stars: ✭ 20 (-23.08%)
Mutual labels:  utility
groupby
Group lines by a regex
Stars: ✭ 14 (-46.15%)
Mutual labels:  utility
Shadbot
A configurable multipurpose bot bringing you music, multiplayer games, moderation commands and more!
Stars: ✭ 48 (+84.62%)
Mutual labels:  utility
split
A string split function and iterator for Lua
Stars: ✭ 15 (-42.31%)
Mutual labels:  split
Isometry
📦 Sketch plugin that allows to create isometric projections from layers
Stars: ✭ 18 (-30.77%)
Mutual labels:  utility
MentalGL
Single header OpenGL utility library in the public domain
Stars: ✭ 20 (-23.08%)
Mutual labels:  utility
xbytes
Parse bytes to human readable sizes (4747) → ('4.75 KB') and vice versa.
Stars: ✭ 17 (-34.62%)
Mutual labels:  utility
spleeter-api
Audio separation API using Spleeter from Deezer
Stars: ✭ 77 (+196.15%)
Mutual labels:  split
bash
A collection of small bash utils.
Stars: ✭ 15 (-42.31%)
Mutual labels:  utility

tiler_baby_logo tiler

Tiler teaser image

CI Code style: black Coverage status PyPI version

Github repository | Github issues | Documentation


⚠️ Please note: work in progress, things will change and/or break! ⚠️


This python package provides consistent and user-friendly functions for tiling/patching and subsequent merging of NumPy arrays.

Such tiling is often required for various heavy image-processing tasks such as semantic segmentation in deep learning, especially in domains where images do not fit into GPU memory (e.g., hyperspectral satellite images, whole slide images, videos, tomography data).

Please see Quick start section.
If you want to use tiler interactively, I highly recommend napari and napari-tiler plugin.

Features

  • N-dimensional
  • Optional in-place tiling
  • Optional channel dimension (dimension that is not tiled)
  • Optional tile batching
  • Tile overlapping
  • Access individual tiles with an iterator or a getter
  • Tile merging, with optional window functions/tapering

Quick start

You can find more examples in examples.
For more Tiler and Merger functionality, please check documentation.

import numpy as np
from tiler import Tiler, Merger

image = np.random.random((3, 1920, 1080))

# Setup tiling parameters
tiler = Tiler(data_shape=image.shape,
              tile_shape=(3, 250, 250),
              channel_dimension=0)

## Access tiles:
# 1. with an iterator
for tile_id, tile in tiler.iterate(image):
   print(f'Tile {tile_id} out of {len(tiler)} tiles.')
# 1b. the iterator can also be accessed through __call__
for tile_id, tile in tiler(image):
   print(f'Tile {tile_id} out of {len(tiler)} tiles.')
# 2. individually
tile_3 = tiler.get_tile(image, 3)
# 3. in batches
tiles_in_batches = [batch for _, batch in tiler(image, batch_size=10)]

# Setup merging parameters
merger = Merger(tiler)

## Merge tiles:
# 1. one by one
for tile_id, tile in tiler(image):
   merger.add(tile_id, some_processing_fn(tile))
# 2. in batches
merger.reset()
for batch_id, batch in tiler(image, batch_size=10):
   merger.add_batch(batch_id, 10, batch)

# Final merging: applies tapering and optional unpadding
final_image = merger.merge(unpad=True)  # (3, 1920, 1080)

Installation

The latest release is available through pip:

pip install tiler

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

git clone [email protected]:the-lay/tiler.git
cd tiler
pip install

If you are planning to contribute, please take a look at the contribution instructions.

Motivation & other packages

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

However, other libraries/examples might fit you better:

Moreover, some related approaches have been described in the literature:

Frequently asked questions

This section is a work in progress.

How do I create tiles with less dimensions than the data array?

Tiler expects tile_shape to have less than or the same number of elements as data_shape. If tile_shape has less elements than data_shape, tile_shape will be prepended with ones to match the size of data_shape.
For example, if you want to get 2d tiles out from 3d array you can initialize Tiler like this: Tiler(data_shape=(128,128,128), tile_shape=(128, 128)) and it will be equivalent to Tiler(data_shape=(128,128,128), tile_shape=(1, 128, 128)).

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].