A set of tiling utilities
Project description
cztile - Python package to simplify the process of tiling arrays
This project provides simple-to-use tiling functionality for arrays. It is not linked directly to the CZI file format, but can be of use to process such images in an efficient and tile-wise manner, which is especially important when dealing with larger images.
Samples
The basic usage can be inferred from this sample notebook:
System setup
The current version of this toolbox only requires a fresh Python 3.x installation. Being a pure Python wheel, it was tested with Python 3.9 on Windows.
Supported Tiling Strategies
This package features the following tiling strategies:
AlmostEqualBorderFixedTotalAreaStrategy2D
This covers a total area with a minimal number of tiles of constant total area such that:
- the image area is completely covered by tiles and is filled up with as few tiles as possible
- the overlap/border between tiles is as small as possible, but it is ensured that at least a minimum border size is used
- all interior tiles have the same size
- a possible excess border is split among tiles and can lead to slightly different tile and border sizes at the edge
- all interior tiles have at least a minimum border width/height on all sides
- the edge tiles have zero border at the edge and at least the minimum border width on their inner sides.
- The sizes of all non-zero borders differ at most by one pixel.
The core functionality is of course also available for 1D.
The AlmostEqualBorderFixedTotalAreaStrategy2D is based on the following algorithm:
Inputs
Image width:
Minimum interior border width (left or right):
Fixed total tile width:
Calculation of tile positions and borders
Case 1:
There is no solution. Fail!
Case 2:
Use a single tile with no borders.
Case 3:
Maximum inner tile width of edge tiles:
Maximum inner tile width of interior tiles:
Total interior tile width:
Number of tiles:
Excess border:
Total number of non-zero left and right borders:
Fractional excess border:
The first non-zero border has index , the last has index . Tile is surrounded by the borders with index and .
Cumulative excess border for all borders up to border : for
Cumulative border for all borders up to border : for
Tile boundaries:
Tile for :
- Left-most pixel of inner tile:
- Right-most pixel of inner tile:
- Inner tile width:
- Total border width:
- Left border width:
- Right border width:
- Left-most border pixel:
- Right-most-border pixel:
Disclaimer
The libary and the notebook are free to use for everybody. Carl Zeiss Microscopy GmbH undertakes no warranty concerning the use of those tools. Use them at your own risk.
By using any of those examples you agree to this disclaimer.
Version: 2022.04.06
Copyright (c) 2022 Carl Zeiss AG, Germany. All Rights Reserved.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file cztile-0.1.2.tar.gz
.
File metadata
- Download URL: cztile-0.1.2.tar.gz
- Upload date:
- Size: 11.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.4
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3e42c4a93fd7b2df985b42e66dc3c585b3ebd9c1167e9f7e7d5c34c57697b929 |
|
MD5 | 4f052d209f4c5f26e844dce3d787704f |
|
BLAKE2b-256 | 477a068e2f755f116ac109f2943fc707bf13aded9ce3bccd6191c65019af1ea0 |
File details
Details for the file cztile-0.1.2-py3-none-any.whl
.
File metadata
- Download URL: cztile-0.1.2-py3-none-any.whl
- Upload date:
- Size: 12.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.4
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 043c31d42079cd5ee389647754c28520f70b938a464bece234116e257198034b |
|
MD5 | 91374b8c1ff5a7a6e021fb69a9f8bf53 |
|
BLAKE2b-256 | 560e8d6f2a6f67130bf36a49d3bfb230ef0aa5cf07d1ed9bff143f95f03a71ee |