fimage-python 0.1.2__cp312-cp312-win_amd64.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
fim/__init__.py ADDED
@@ -0,0 +1,72 @@
1
+ """
2
+ FIM: Fast Image processing library with lazy evaluation.
3
+
4
+ This module provides a PyVips-style lazy image processing pipeline built on
5
+ top of a high-performance C++ backend using CRTP for zero-overhead abstraction.
6
+
7
+ Example:
8
+ >>> import fim
9
+ >>>
10
+ >>> # Load and process an image lazily
11
+ >>> img = fim.Image.from_libtiff("input.tiff")
12
+ >>> result = img.crop((100, 100), (512, 512)).downsample(2)
13
+ >>>
14
+ >>> # Nothing has been computed yet - evaluation happens on write
15
+ >>> result.write_png("output.png")
16
+ >>>
17
+ >>> # Or convert to numpy
18
+ >>> array = result.to_numpy() # shape: (height, width, channels)
19
+ >>>
20
+ >>> # High-quality resize with different kernels
21
+ >>> resized = img.resize(512, 512, kernel=fim.KernelType.LANCZOS3)
22
+ >>>
23
+ >>> # Resize with subpixel-accurate box parameter
24
+ >>> box = fim.Box(10.5, 20.5, 510.5, 520.5)
25
+ >>> cropped_resized = img.resize(256, 256, box=box)
26
+ >>>
27
+ >>> # Stack multiple images
28
+ >>> red = fim.Image.from_png("red.png")
29
+ >>> green = fim.Image.from_png("green.png")
30
+ >>> blue = fim.Image.from_png("blue.png")
31
+ >>> rgb = fim.Image.stack([red, green, blue], axis="bands")
32
+ >>> rgb.write_tiff("rgb.tiff")
33
+ """
34
+
35
+ from ._fim import (
36
+ Image,
37
+ KernelType,
38
+ PixelType,
39
+ DataLayout,
40
+ CompressionType,
41
+ Box,
42
+ DeferredBlackCanvas,
43
+ FastSlideContext,
44
+ open_fastslide,
45
+ LibtiffContext,
46
+ open_libtiff,
47
+ __version__,
48
+ )
49
+
50
+ try:
51
+ from ._fim import OpenSlideContext, open_openslide # type: ignore[attr-defined]
52
+ except ImportError:
53
+ OpenSlideContext = None # type: ignore[assignment]
54
+ open_openslide = None # type: ignore[assignment]
55
+
56
+ __all__ = [
57
+ "Image",
58
+ "KernelType",
59
+ "PixelType",
60
+ "DataLayout",
61
+ "CompressionType",
62
+ "Box",
63
+ "DeferredBlackCanvas",
64
+ "FastSlideContext",
65
+ "open_fastslide",
66
+ "LibtiffContext",
67
+ "open_libtiff",
68
+ "__version__",
69
+ ]
70
+
71
+ if OpenSlideContext is not None and open_openslide is not None:
72
+ __all__.extend(["OpenSlideContext", "open_openslide"])
Binary file
Binary file
fim/_fim.pyi ADDED
@@ -0,0 +1,26 @@
1
+ """Typing stubs for the native `fim._fim` extension module.
2
+
3
+ The runtime implementation is provided by a nanobind extension.
4
+ """
5
+
6
+ from __future__ import annotations
7
+
8
+ from typing import Any
9
+
10
+ class Image: ...
11
+ class Box: ...
12
+ class DeferredBlackCanvas: ...
13
+ class FastSlideContext: ...
14
+ class OpenSlideContext: ...
15
+ class LibtiffContext: ...
16
+
17
+ KernelType: Any
18
+ PixelType: Any
19
+ DataLayout: Any
20
+ CompressionType: Any
21
+
22
+ def open_fastslide(*args: Any, **kwargs: Any) -> Any: ...
23
+ def open_openslide(*args: Any, **kwargs: Any) -> Any: ...
24
+ def open_libtiff(*args: Any, **kwargs: Any) -> Any: ...
25
+
26
+ __version__: str
@@ -0,0 +1,89 @@
1
+ Metadata-Version: 2.1
2
+ Name: fimage-python
3
+ Version: 0.1.2
4
+ Summary: Fast Image processing library with lazy evaluation
5
+ Author-Email: AI for Oncology Research Group <j.teuwen@nki.nl>
6
+ License: Apache-2.0
7
+ Classifier: Development Status :: 4 - Beta
8
+ Classifier: Intended Audience :: Science/Research
9
+ Classifier: Intended Audience :: Healthcare Industry
10
+ Classifier: License :: OSI Approved :: Apache Software License
11
+ Classifier: Programming Language :: C++
12
+ Classifier: Programming Language :: Python :: 3
13
+ Classifier: Programming Language :: Python :: 3.10
14
+ Classifier: Programming Language :: Python :: 3.11
15
+ Classifier: Programming Language :: Python :: 3.12
16
+ Classifier: Programming Language :: Python :: 3.13
17
+ Classifier: Programming Language :: Python :: 3.14
18
+ Classifier: Topic :: Scientific/Engineering :: Image Processing
19
+ Project-URL: Homepage, https://github.com/NKI-AI/fimage
20
+ Project-URL: Repository, https://github.com/NKI-AI/fimage
21
+ Project-URL: Issues, https://github.com/NKI-AI/fimage/issues
22
+ Requires-Python: >=3.10
23
+ Requires-Dist: numpy>=1.20
24
+ Provides-Extra: dev
25
+ Requires-Dist: pytest>=7.0; extra == "dev"
26
+ Requires-Dist: pytest-mock; extra == "dev"
27
+ Description-Content-Type: text/markdown
28
+
29
+ # fim (FastImage)
30
+
31
+ A high-performance C++20 library for tile-based image processing using CRTP
32
+ (Curiously Recurring Template Pattern), with Python bindings that provide a
33
+ PyVips-style lazy-evaluation pipeline.
34
+
35
+ This repository is automatically synced from the AI for Oncology monorepo. It
36
+ builds both with [Bazel](https://bazel.build/) (via bzlmod) and with
37
+ [Meson](https://mesonbuild.com/) (used to produce the Python wheels).
38
+
39
+ ## Features
40
+
41
+ - **Tile-based processing**: efficient processing of large images through tiling
42
+ - **CRTP pipeline**: zero-overhead composition using compile-time polymorphism
43
+ - **Lazy evaluation**: operations are deferred until a sink materializes the result
44
+ - **Multiple sources**: TIFF (libtiff), PNG (lodepng/libspng), and FastSlide (whole slide images)
45
+ - **Operators**: crop, paste, downsample, resize (Lanczos / Magic2021 kernels), and stack
46
+ - **Flexible sinks**: tiled TIFF/PNG output or zero-copy NumPy arrays
47
+ - **Python bindings**: full Python API via nanobind
48
+
49
+ ## Installation (Python)
50
+
51
+ ```bash
52
+ pip install fimage-python
53
+ ```
54
+
55
+ ```python
56
+ import fim
57
+
58
+ img = fim.Image.from_libtiff("input.tiff")
59
+ img.crop(100, 100, 512, 512).resize(256, 256).write_png("output.png")
60
+ ```
61
+
62
+ ## Building from source
63
+
64
+ ### Bazel
65
+
66
+ ```bash
67
+ # Build the C++ library
68
+ bazelisk build //:fimage
69
+
70
+ # Build the Python extension
71
+ bazelisk build //python:fim
72
+
73
+ # Run the test suite
74
+ bazelisk test //...
75
+ ```
76
+
77
+ ### Meson (wheels)
78
+
79
+ ```bash
80
+ # Build a wheel + sdist for the current interpreter
81
+ uv build
82
+ ```
83
+
84
+ The Meson build fetches every dependency through `subprojects/*.wrap` and links
85
+ them statically, producing a self-contained `_fim` extension.
86
+
87
+ ## License
88
+
89
+ Apache 2.0 - see [LICENSE](LICENSE) for details.
@@ -0,0 +1,7 @@
1
+ fimage_python-0.1.2.dist-info/METADATA,sha256=XbJ4fHrBbxYeCLpsweql-6ODcahtMyfEIo7X0HvCc_0,2887
2
+ fimage_python-0.1.2.dist-info/WHEEL,sha256=50PeAbplA6PkI0hYOYoeacB9US1R6EguyfOnsccH0WU,85
3
+ fim/_fim.cp312-win_amd64.pyd,sha256=5L0mai2FehnS44nyIvJ_fnKL4gCxjDYnI2vSShFteRc,5140480
4
+ fim/_fim.cp312-win_amd64.lib,sha256=wHFTlD4f2yGJtjYjAXXb9gNgdM5RLq3_28Sl908vLPs,9128
5
+ fim/__init__.py,sha256=kGnk5sAc8S54Squ932Zetg0HeLSqrB-aaDwp55QVdMA,2116
6
+ fim/_fim.pyi,sha256=utwHgZ-n8jKAet66JZCJhpljfTFoOc1I2LtCRelGyn4,621
7
+ fimage_python-0.1.2.dist-info/RECORD,,
@@ -0,0 +1,4 @@
1
+ Wheel-Version: 1.0
2
+ Generator: meson
3
+ Root-Is-Purelib: false
4
+ Tag: cp312-cp312-win_amd64