histotuner 0.1.0__tar.gz
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.
- histotuner-0.1.0/PKG-INFO +30 -0
- histotuner-0.1.0/README.md +0 -0
- histotuner-0.1.0/pyproject.toml +36 -0
- histotuner-0.1.0/src/histotuner/__init__.py +179 -0
- histotuner-0.1.0/src/histotuner/cell_phenotype_mapper.py +544 -0
- histotuner-0.1.0/src/histotuner/crop_image.py +554 -0
- histotuner-0.1.0/src/histotuner/embedImage.py +703 -0
- histotuner-0.1.0/src/histotuner/extractEmbedding.py +414 -0
- histotuner-0.1.0/src/histotuner/histotune.py +910 -0
- histotuner-0.1.0/src/histotuner/image_patcher.py +323 -0
- histotuner-0.1.0/src/histotuner/py.typed +0 -0
- histotuner-0.1.0/src/histotuner/segment.py +633 -0
- histotuner-0.1.0/src/histotuner/spatial_writer.py +1034 -0
- histotuner-0.1.0/src/histotuner/spatialfeaturetable.py +826 -0
- histotuner-0.1.0/src/histotuner/test_assets/e2e_camel.yaml +15 -0
- histotuner-0.1.0/src/histotuner/test_assets/tiny_rgb.png +0 -0
- histotuner-0.1.0/src/histotuner/tissue.py +711 -0
- histotuner-0.1.0/src/histotuner/token_cell_mapper.py +499 -0
- histotuner-0.1.0/src/histotuner/utils.py +284 -0
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
Metadata-Version: 2.3
|
|
2
|
+
Name: histotuner
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Add your description here
|
|
5
|
+
Author: Ajit Johnson Nirmal
|
|
6
|
+
Author-email: Ajit Johnson Nirmal <ajitjohnson.n@gmail.com>
|
|
7
|
+
Requires-Dist: anndata>=0.12.2
|
|
8
|
+
Requires-Dist: cellpose>=4.0.6
|
|
9
|
+
Requires-Dist: dask>=2024.11.2
|
|
10
|
+
Requires-Dist: geopandas>=1.1.1
|
|
11
|
+
Requires-Dist: matplotlib>=3.10.6
|
|
12
|
+
Requires-Dist: numpy>=2.3.3
|
|
13
|
+
Requires-Dist: opencv-python>=4.11.0.86
|
|
14
|
+
Requires-Dist: openslide-bin>=4.0.0.8
|
|
15
|
+
Requires-Dist: openslide-python>=1.4.2
|
|
16
|
+
Requires-Dist: pillow>=11.3.0
|
|
17
|
+
Requires-Dist: pip>=25.2
|
|
18
|
+
Requires-Dist: psutil>=7.1.0
|
|
19
|
+
Requires-Dist: pyyaml>=6.0.3
|
|
20
|
+
Requires-Dist: scikit-learn>=1.7.2
|
|
21
|
+
Requires-Dist: shapely>=2.1.2
|
|
22
|
+
Requires-Dist: spatialdata>=0.5.0
|
|
23
|
+
Requires-Dist: tifffile>=2025.9.30
|
|
24
|
+
Requires-Dist: timm>=1.0.20
|
|
25
|
+
Requires-Dist: transformers>=4.57.1
|
|
26
|
+
Requires-Dist: wandb>=0.22.2
|
|
27
|
+
Requires-Dist: zarr>=2.18.7
|
|
28
|
+
Requires-Python: >=3.12
|
|
29
|
+
Description-Content-Type: text/markdown
|
|
30
|
+
|
|
File without changes
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
[project]
|
|
2
|
+
name = "histotuner"
|
|
3
|
+
version = "0.1.0"
|
|
4
|
+
description = "Add your description here"
|
|
5
|
+
readme = "README.md"
|
|
6
|
+
authors = [
|
|
7
|
+
{ name = "Ajit Johnson Nirmal", email = "ajitjohnson.n@gmail.com" }
|
|
8
|
+
]
|
|
9
|
+
requires-python = ">=3.12"
|
|
10
|
+
dependencies = [
|
|
11
|
+
"anndata>=0.12.2",
|
|
12
|
+
"cellpose>=4.0.6",
|
|
13
|
+
"dask>=2024.11.2",
|
|
14
|
+
"geopandas>=1.1.1",
|
|
15
|
+
"matplotlib>=3.10.6",
|
|
16
|
+
"numpy>=2.3.3",
|
|
17
|
+
"opencv-python>=4.11.0.86",
|
|
18
|
+
"openslide-bin>=4.0.0.8",
|
|
19
|
+
"openslide-python>=1.4.2",
|
|
20
|
+
"pillow>=11.3.0",
|
|
21
|
+
"pip>=25.2",
|
|
22
|
+
"psutil>=7.1.0",
|
|
23
|
+
"pyyaml>=6.0.3",
|
|
24
|
+
"scikit-learn>=1.7.2",
|
|
25
|
+
"shapely>=2.1.2",
|
|
26
|
+
"spatialdata>=0.5.0",
|
|
27
|
+
"tifffile>=2025.9.30",
|
|
28
|
+
"timm>=1.0.20",
|
|
29
|
+
"transformers>=4.57.1",
|
|
30
|
+
"wandb>=0.22.2",
|
|
31
|
+
"zarr>=2.18.7",
|
|
32
|
+
]
|
|
33
|
+
|
|
34
|
+
[build-system]
|
|
35
|
+
requires = ["uv_build>=0.8.14,<0.9.0"]
|
|
36
|
+
build-backend = "uv_build"
|
|
@@ -0,0 +1,179 @@
|
|
|
1
|
+
import sys
|
|
2
|
+
|
|
3
|
+
# Version
|
|
4
|
+
try:
|
|
5
|
+
from importlib.metadata import version as _pkg_version
|
|
6
|
+
__version__ = _pkg_version("histotuner")
|
|
7
|
+
except Exception:
|
|
8
|
+
__version__ = "unknown"
|
|
9
|
+
|
|
10
|
+
# Print only histotuner version on import
|
|
11
|
+
print(f"histotuner {__version__}")
|
|
12
|
+
|
|
13
|
+
# Provide a friendly greeting
|
|
14
|
+
|
|
15
|
+
def hello() -> str:
|
|
16
|
+
return "Hello from histotuner!"
|
|
17
|
+
|
|
18
|
+
# Lightweight import (safe)
|
|
19
|
+
try:
|
|
20
|
+
from .crop_image import cropImage # lightweight
|
|
21
|
+
except Exception:
|
|
22
|
+
# Lazy fallback to avoid noisy import-time errors
|
|
23
|
+
def cropImage(*args, **kwargs):
|
|
24
|
+
from .crop_image import cropImage as _fn
|
|
25
|
+
return _fn(*args, **kwargs)
|
|
26
|
+
|
|
27
|
+
# Heavy deps: define lazy wrappers to avoid import-time initialization/prints (e.g., cellpose)
|
|
28
|
+
|
|
29
|
+
def segmentImage(*args, **kwargs):
|
|
30
|
+
from .segment import segmentImage as _fn
|
|
31
|
+
return _fn(*args, **kwargs)
|
|
32
|
+
|
|
33
|
+
# Tissue helpers (cv2/geopandas/shapely may be heavy): lazy wrappers
|
|
34
|
+
|
|
35
|
+
def tissueMask(*args, **kwargs):
|
|
36
|
+
from .tissue import tissueMask as _fn
|
|
37
|
+
return _fn(*args, **kwargs)
|
|
38
|
+
|
|
39
|
+
def generateTissueMask(*args, **kwargs):
|
|
40
|
+
from .tissue import generateTissueMask as _fn
|
|
41
|
+
return _fn(*args, **kwargs)
|
|
42
|
+
|
|
43
|
+
def BinaryMask(*args, **kwargs):
|
|
44
|
+
from .tissue import BinaryMask as _fn
|
|
45
|
+
return _fn(*args, **kwargs)
|
|
46
|
+
|
|
47
|
+
def binaryMaskToPolygons(*args, **kwargs):
|
|
48
|
+
from .tissue import binaryMaskToPolygons as _fn
|
|
49
|
+
return _fn(*args, **kwargs)
|
|
50
|
+
|
|
51
|
+
def binaryMaskToPolygonsWithProb(*args, **kwargs):
|
|
52
|
+
from .tissue import binaryMaskToPolygonsWithProb as _fn
|
|
53
|
+
return _fn(*args, **kwargs)
|
|
54
|
+
|
|
55
|
+
def overlayTissueThumbnail(*args, **kwargs):
|
|
56
|
+
from .tissue import overlayTissueThumbnail as _fn
|
|
57
|
+
return _fn(*args, **kwargs)
|
|
58
|
+
|
|
59
|
+
# Embedding pipeline: lazy wrappers
|
|
60
|
+
|
|
61
|
+
def load_config(*args, **kwargs):
|
|
62
|
+
from .embedImage import load_config as _fn
|
|
63
|
+
return _fn(*args, **kwargs)
|
|
64
|
+
|
|
65
|
+
def loadHistoEmbedConfig(*args, **kwargs):
|
|
66
|
+
"""Alias for embedding config loader to avoid confusion with training config."""
|
|
67
|
+
from .embedImage import load_config as _fn
|
|
68
|
+
return _fn(*args, **kwargs)
|
|
69
|
+
|
|
70
|
+
def runEmbeddingPipeline(*args, **kwargs):
|
|
71
|
+
from .embedImage import runEmbeddingPipeline as _fn
|
|
72
|
+
return _fn(*args, **kwargs)
|
|
73
|
+
|
|
74
|
+
def embedImageFromDict(*args, **kwargs):
|
|
75
|
+
from .embedImage import embedImageFromDict as _fn
|
|
76
|
+
return _fn(*args, **kwargs)
|
|
77
|
+
|
|
78
|
+
def embedImageFromYaml(*args, **kwargs):
|
|
79
|
+
from .embedImage import embedImageFromYaml as _fn
|
|
80
|
+
return _fn(*args, **kwargs)
|
|
81
|
+
|
|
82
|
+
# Training helpers (histotune): lazy wrappers
|
|
83
|
+
|
|
84
|
+
def loadHistotuneConfig(*args, **kwargs):
|
|
85
|
+
from .histotune import load_config as _fn
|
|
86
|
+
return _fn(*args, **kwargs)
|
|
87
|
+
|
|
88
|
+
def runHistotunePipeline(*args, **kwargs):
|
|
89
|
+
from .histotune import runTrainingPipeline as _fn
|
|
90
|
+
return _fn(*args, **kwargs)
|
|
91
|
+
|
|
92
|
+
def runHistotuneFromYaml(*args, **kwargs):
|
|
93
|
+
from .histotune import runTrainingFromYaml as _fn
|
|
94
|
+
return _fn(*args, **kwargs)
|
|
95
|
+
|
|
96
|
+
def runHistotuneTraining(*args, **kwargs):
|
|
97
|
+
from .histotune import run_training as _fn
|
|
98
|
+
return _fn(*args, **kwargs)
|
|
99
|
+
|
|
100
|
+
# Spatial feature table helpers: lazy wrappers
|
|
101
|
+
|
|
102
|
+
def spatialFeatureTable(*args, **kwargs):
|
|
103
|
+
from .spatialfeaturetable import spatialFeatureTable as _fn
|
|
104
|
+
return _fn(*args, **kwargs)
|
|
105
|
+
|
|
106
|
+
def spatialFeatureTableFromDict(*args, **kwargs):
|
|
107
|
+
from .spatialfeaturetable import spatialFeatureTableFromDict as _fn
|
|
108
|
+
return _fn(*args, **kwargs)
|
|
109
|
+
|
|
110
|
+
# Token→cell mapper utilities: lazy wrappers
|
|
111
|
+
|
|
112
|
+
def token_to_cell_mapper(*args, **kwargs):
|
|
113
|
+
from .token_cell_mapper import token_to_cell_mapper as _fn
|
|
114
|
+
return _fn(*args, **kwargs)
|
|
115
|
+
|
|
116
|
+
def attach_token_cell_alignment(*args, **kwargs):
|
|
117
|
+
from .token_cell_mapper import attach_token_cell_alignment as _fn
|
|
118
|
+
return _fn(*args, **kwargs)
|
|
119
|
+
|
|
120
|
+
def save_spatialdata_to_zarr(*args, **kwargs):
|
|
121
|
+
from .token_cell_mapper import save_spatialdata_to_zarr as _fn
|
|
122
|
+
return _fn(*args, **kwargs)
|
|
123
|
+
|
|
124
|
+
def tokenCellMapper(*args, **kwargs):
|
|
125
|
+
from .token_cell_mapper import tokenCellMapper as _fn
|
|
126
|
+
return _fn(*args, **kwargs)
|
|
127
|
+
|
|
128
|
+
# Cell phenotype mapper utilities: lazy wrappers
|
|
129
|
+
|
|
130
|
+
def attach_cell_phenotype(*args, **kwargs):
|
|
131
|
+
from .cell_phenotype_mapper import attach_cell_phenotype as _fn
|
|
132
|
+
return _fn(*args, **kwargs)
|
|
133
|
+
|
|
134
|
+
def attach_cell_phenotype_to_zarr(*args, **kwargs):
|
|
135
|
+
from .cell_phenotype_mapper import attach_cell_phenotype_to_zarr as _fn
|
|
136
|
+
return _fn(*args, **kwargs)
|
|
137
|
+
|
|
138
|
+
def cellPhenotypeMapper(*args, **kwargs):
|
|
139
|
+
from .cell_phenotype_mapper import cellPhenotypeMapper as _fn
|
|
140
|
+
return _fn(*args, **kwargs)
|
|
141
|
+
|
|
142
|
+
def phenotypeCellMapper(*args, **kwargs):
|
|
143
|
+
from .cell_phenotype_mapper import phenotypeCellMapper as _fn
|
|
144
|
+
return _fn(*args, **kwargs)
|
|
145
|
+
|
|
146
|
+
__all__ = [
|
|
147
|
+
"__version__",
|
|
148
|
+
"hello",
|
|
149
|
+
"cropImage",
|
|
150
|
+
"segmentImage",
|
|
151
|
+
"tissueMask",
|
|
152
|
+
"generateTissueMask",
|
|
153
|
+
"BinaryMask",
|
|
154
|
+
"binaryMaskToPolygons",
|
|
155
|
+
"binaryMaskToPolygonsWithProb",
|
|
156
|
+
"overlayTissueThumbnail",
|
|
157
|
+
# Embedding pipeline (image)
|
|
158
|
+
"load_config",
|
|
159
|
+
"loadHistoEmbedConfig",
|
|
160
|
+
"runEmbeddingPipeline",
|
|
161
|
+
"embedImageFromDict",
|
|
162
|
+
"embedImageFromYaml",
|
|
163
|
+
# Training pipeline (histotune)
|
|
164
|
+
"loadHistotuneConfig",
|
|
165
|
+
"runHistotunePipeline",
|
|
166
|
+
"runHistotuneFromYaml",
|
|
167
|
+
"runHistotuneTraining",
|
|
168
|
+
# Spatial feature table and mappers
|
|
169
|
+
"spatialFeatureTable",
|
|
170
|
+
"spatialFeatureTableFromDict",
|
|
171
|
+
"token_to_cell_mapper",
|
|
172
|
+
"attach_token_cell_alignment",
|
|
173
|
+
"save_spatialdata_to_zarr",
|
|
174
|
+
"tokenCellMapper",
|
|
175
|
+
"attach_cell_phenotype",
|
|
176
|
+
"attach_cell_phenotype_to_zarr",
|
|
177
|
+
"cellPhenotypeMapper",
|
|
178
|
+
"phenotypeCellMapper",
|
|
179
|
+
]
|