fimage-python 0.1.0__cp311-none-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 +72 -0
- fim/_fim.pyd +0 -0
- fim/_fim.pyi +45 -0
- fimage_python-0.1.0.dist-info/METADATA +11 -0
- fimage_python-0.1.0.dist-info/RECORD +6 -0
- fimage_python-0.1.0.dist-info/WHEEL +4 -0
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"])
|
fim/_fim.pyd
ADDED
|
Binary file
|
fim/_fim.pyi
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
"""Typing stubs for the native `fim._fim` extension module.
|
|
2
|
+
|
|
3
|
+
The runtime implementation is provided by a pybind11 extension.
|
|
4
|
+
"""
|
|
5
|
+
|
|
6
|
+
from __future__ import annotations
|
|
7
|
+
|
|
8
|
+
from typing import Any
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
class Image: ...
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
class Box: ...
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
class DeferredBlackCanvas: ...
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
class FastSlideContext: ...
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
class OpenSlideContext: ...
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
class LibtiffContext: ...
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
KernelType: Any
|
|
30
|
+
PixelType: Any
|
|
31
|
+
DataLayout: Any
|
|
32
|
+
CompressionType: Any
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
def open_fastslide(*args: Any, **kwargs: Any) -> Any: ...
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
def open_openslide(*args: Any, **kwargs: Any) -> Any: ...
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
def open_libtiff(*args: Any, **kwargs: Any) -> Any: ...
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
__version__: str
|
|
45
|
+
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
Metadata-Version: 2.1
|
|
2
|
+
Name: fimage-python
|
|
3
|
+
Author: AI for Oncology Research Group
|
|
4
|
+
Home-page: https://github.com/NKI-AI/aifo-openmidnight
|
|
5
|
+
License: Apache-2.0
|
|
6
|
+
Summary: Fast Image processing library with lazy evaluation
|
|
7
|
+
Requires-Python: >=3.10
|
|
8
|
+
Requires-Dist: numpy
|
|
9
|
+
Version: 0.1.0
|
|
10
|
+
|
|
11
|
+
UNKNOWN
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
fim/__init__.py,sha256=CUJoOPGGxAvErUEHdJLpIgG_rDbzA5kum3d2-K6gAZE,2044
|
|
2
|
+
fim/_fim.pyd,sha256=BF927v-KpyQdQFl9mz4UZBesdr7_AjnL4TYN2SBt-Dg,6362624
|
|
3
|
+
fim/_fim.pyi,sha256=7PwPH95G8YE2HPyO7H0JTdpgZWErW5sm7_ZpNaUraTo,614
|
|
4
|
+
fimage_python-0.1.0.dist-info/WHEEL,sha256=Ud7fuhvyWe_WBJl-kRxocVfIvIHwn3P-wYvE7I0W9so,100
|
|
5
|
+
fimage_python-0.1.0.dist-info/METADATA,sha256=fbJHGrt5xyZYiYe4dZ_oFlLg70L6qgDLHvFZvres41U,285
|
|
6
|
+
fimage_python-0.1.0.dist-info/RECORD,,
|