{"id":13737457,"url":"https://github.com/the-lay/tiler","last_synced_at":"2026-02-26T18:34:30.379Z","repository":{"id":37991074,"uuid":"272881941","full_name":"the-lay/tiler","owner":"the-lay","description":"N-dimensional NumPy array tiling and merging with overlapping, padding and tapering","archived":false,"fork":false,"pushed_at":"2023-08-08T06:41:29.000Z","size":1168,"stargazers_count":71,"open_issues_count":11,"forks_count":11,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-04-24T16:54:24.107Z","etag":null,"topics":["merging","numpy-arrays","padding","patching","split","tiling","utility"],"latest_commit_sha":null,"homepage":"https://the-lay.github.io/tiler/","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/the-lay.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":".github/CONTRIBUTING.md","funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2020-06-17T05:00:36.000Z","updated_at":"2025-04-14T21:12:02.000Z","dependencies_parsed_at":"2022-09-07T13:51:09.702Z","dependency_job_id":"aabc17f9-892c-46d2-8d9a-548d52eb3a7a","html_url":"https://github.com/the-lay/tiler","commit_stats":{"total_commits":80,"total_committers":5,"mean_commits":16.0,"dds":"0.11250000000000004","last_synced_commit":"16633bb3713db2428e872592216212d94626d5f2"},"previous_names":[],"tags_count":16,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/the-lay%2Ftiler","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/the-lay%2Ftiler/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/the-lay%2Ftiler/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/the-lay%2Ftiler/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/the-lay","download_url":"https://codeload.github.com/the-lay/tiler/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253085498,"owners_count":21851636,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["merging","numpy-arrays","padding","patching","split","tiling","utility"],"created_at":"2024-08-03T03:01:48.531Z","updated_at":"2025-10-21T20:14:44.836Z","avatar_url":"https://github.com/the-lay.png","language":"Python","funding_links":[],"categories":["Python"],"sub_categories":[],"readme":"# ![tiler_baby_logo](misc/baby_logo.png) tiler\n\n![Tiler teaser image](misc/teaser/tiler_teaser.png)\n\n[![CI](https://github.com/the-lay/tiler/actions/workflows/ci.yml/badge.svg)](https://github.com/the-lay/tiler/actions/workflows/ci.yml)\n[![Coverage status](https://coveralls.io/repos/github/the-lay/tiler/badge.svg?branch=master)](https://coveralls.io/github/the-lay/tiler?branch=master)\n[![PyPI version](https://badge.fury.io/py/tiler.svg)](https://badge.fury.io/py/tiler)\n\n\n[Github repository](https://github.com/the-lay/tiler) | \n[Github issues](https://github.com/the-lay/tiler/issues) | \n[Documentation](https://the-lay.github.io/tiler)\n_________________\n\nThis python package provides consistent and user-friendly\nfunctions for tiling/patching and subsequent merging of NumPy arrays.\n\nSuch tiling is often required for various heavy image-processing tasks\nsuch as semantic segmentation in deep learning, especially in domains where images do not fit into GPU memory\n(e.g., hyperspectral satellite images, whole slide images, videos, tomography data).\n\nPlease see [Quick start section](https://github.com/the-lay/tiler#quick-start).   \nIf you want to use tiler interactively, I highly recommend [napari](https://github.com/napari/napari) and [napari-tiler plugin](https://github.com/tdmorello/napari-tiler).\n\n\nFeatures\n-------------\n - N-dimensional\n - Optional in-place tiling\n - Optional channel dimension (dimension that is not tiled)\n - Optional tile batching\n - Tile overlapping\n - Access individual tiles with an iterator or a getter\n - Tile merging, with optional window functions/tapering\n\n\nQuick start\n------------ \nYou can find more examples in [examples](https://github.com/the-lay/tiler/tree/master/examples).  \nFor more Tiler and Merger functionality, please check [documentation](https://the-lay.github.io/tiler).\n\n```python\nimport numpy as np\nfrom tiler import Tiler, Merger\n\nimage = np.random.random((3, 1920, 1080))\n\n# Setup tiling parameters\ntiler = Tiler(data_shape=image.shape,\n              tile_shape=(3, 250, 250),\n              channel_dimension=0)\n\n## Access tiles:\n# 1. with an iterator\nfor tile_id, tile in tiler.iterate(image):\n   print(f'Tile {tile_id} out of {len(tiler)} tiles.')\n# 1b. the iterator can also be accessed through __call__\nfor tile_id, tile in tiler(image):\n   print(f'Tile {tile_id} out of {len(tiler)} tiles.')\n# 2. individually\ntile_3 = tiler.get_tile(image, 3)\n# 3. in batches\ntiles_in_batches = [batch for _, batch in tiler(image, batch_size=10)]\n\n# Setup merging parameters\nmerger = Merger(tiler)\n\n## Merge tiles:\n# 1. one by one\nfor tile_id, tile in tiler(image):\n   merger.add(tile_id, some_processing_fn(tile))\n# 2. in batches\nmerger.reset()\nfor batch_id, batch in tiler(image, batch_size=10):\n   merger.add_batch(batch_id, 10, batch)\n\n# Final merging: applies tapering and optional unpadding\nfinal_image = merger.merge(unpad=True)  # (3, 1920, 1080)\n```\n \nInstallation\n-------------\nThe latest release is available through pip:\n\n```bash\npip install tiler\n```\n\nAlternatively, you can clone the repository and install it manually:\n\n```bash\ngit clone git@github.com:the-lay/tiler.git\ncd tiler\npip install\n```\n\nIf you are planning to contribute, please take a look at the [contribution instructions](.github/CONTRIBUTING.md).\n\n \nMotivation \u0026 other packages\n-------------\nI work on semantic segmentation of patched 3D data and\nI often found myself reusing tiling functions that I wrote for the previous projects.\nNo existing libraries listed below fit my use case, so that's why I wrote this library.\n\nHowever, other libraries/examples might fit you better:\n - [vfdev-5/ImageTilingUtils](https://github.com/vfdev-5/ImageTilingUtils)\n    - Minimalistic image reader agnostic 2D tiling tools\n\n - [BloodAxe/pytorch-toolbelt](https://github.com/BloodAxe/pytorch-toolbelt#inference-on-huge-images)\n    - Powerful PyTorch toolset that has 2D image tiling and on-GPU merger\n\n - [Vooban/Smoothly-Blend-Image-Patches](https://github.com/Vooban/Smoothly-Blend-Image-Patches)\n    - Mirroring and D4 rotations data (8-fold) augmentation with squared spline window function for 2D images\n\n - [samdobson/image_slicer](https://github.com/samdobson/image_slicer)\n    - Slicing and merging 2D image into N equally sized tiles\n\n - [dovahcrow/patchify.py](https://github.com/dovahcrow/patchify.py)\n    - Tile and merge 2D, 3D images defined by tile shapes and step between tiles\n   \n - Do you know any other similar packages?\n    - Please let me know by contacting me, [making a PR]((https://github.com/the-lay/tiler/pulls)) or [opening a new issue](https://github.com/the-lay/tiler/issues).\n\nMoreover, some related approaches have been described in the literature:\n - [Introducing Hann windows for reducing edge-effects in patch-based image segmentation](https://doi.org/10.1371/journal.pone.0229839\n), Pielawski and Wählby, March 2020\n\n\nFrequently asked questions\n-------------\nThis section is a work in progress.\n\n**How do I create tiles with less dimensions than the data array?**\n\nTiler expects `tile_shape` to have less than or the same number of elements as `data_shape`.\nIf `tile_shape` has less elements than `data_shape`, `tile_shape` will be prepended with \nones to match the size of `data_shape`.  \nFor 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\n`Tiler(data_shape=(128,128,128), tile_shape=(1, 128, 128))`.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fthe-lay%2Ftiler","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fthe-lay%2Ftiler","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fthe-lay%2Ftiler/lists"}