wsi-toolbox 0.2.0__py3-none-any.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.
- wsi_toolbox/__init__.py +122 -0
- wsi_toolbox/app.py +874 -0
- wsi_toolbox/cli.py +599 -0
- wsi_toolbox/commands/__init__.py +66 -0
- wsi_toolbox/commands/clustering.py +198 -0
- wsi_toolbox/commands/data_loader.py +219 -0
- wsi_toolbox/commands/dzi.py +160 -0
- wsi_toolbox/commands/patch_embedding.py +196 -0
- wsi_toolbox/commands/pca.py +206 -0
- wsi_toolbox/commands/preview.py +394 -0
- wsi_toolbox/commands/show.py +171 -0
- wsi_toolbox/commands/umap_embedding.py +174 -0
- wsi_toolbox/commands/wsi.py +223 -0
- wsi_toolbox/common.py +148 -0
- wsi_toolbox/models.py +30 -0
- wsi_toolbox/utils/__init__.py +109 -0
- wsi_toolbox/utils/analysis.py +174 -0
- wsi_toolbox/utils/hdf5_paths.py +232 -0
- wsi_toolbox/utils/plot.py +227 -0
- wsi_toolbox/utils/progress.py +207 -0
- wsi_toolbox/utils/seed.py +26 -0
- wsi_toolbox/utils/st.py +55 -0
- wsi_toolbox/utils/white.py +121 -0
- wsi_toolbox/watcher.py +256 -0
- wsi_toolbox/wsi_files.py +619 -0
- wsi_toolbox-0.2.0.dist-info/METADATA +253 -0
- wsi_toolbox-0.2.0.dist-info/RECORD +30 -0
- wsi_toolbox-0.2.0.dist-info/WHEEL +4 -0
- wsi_toolbox-0.2.0.dist-info/entry_points.txt +3 -0
- wsi_toolbox-0.2.0.dist-info/licenses/LICENSE +21 -0
wsi_toolbox/__init__.py
ADDED
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
"""
|
|
2
|
+
WSI-toolbox: Whole Slide Image analysis toolkit
|
|
3
|
+
|
|
4
|
+
A comprehensive toolkit for WSI processing, feature extraction, and clustering.
|
|
5
|
+
|
|
6
|
+
Basic Usage:
|
|
7
|
+
>>> import wsi_toolbox as wt
|
|
8
|
+
>>>
|
|
9
|
+
>>> # Convert WSI to HDF5
|
|
10
|
+
>>> cmd = wt.Wsi2HDF5Command(patch_size=256)
|
|
11
|
+
>>> result = cmd('input.ndpi', 'output.h5')
|
|
12
|
+
>>>
|
|
13
|
+
>>> # Extract features with preset model
|
|
14
|
+
>>> wt.set_default_model_preset('uni')
|
|
15
|
+
>>> wt.set_default_device('cuda')
|
|
16
|
+
>>> emb_cmd = wt.PatchEmbeddingCommand(batch_size=256)
|
|
17
|
+
>>> emb_result = emb_cmd('output.h5')
|
|
18
|
+
>>>
|
|
19
|
+
>>> # Clustering
|
|
20
|
+
>>> cluster_cmd = wt.ClusteringCommand(resolution=1.0)
|
|
21
|
+
>>> cluster_result = cluster_cmd(['output.h5'])
|
|
22
|
+
>>>
|
|
23
|
+
>>> # UMAP
|
|
24
|
+
>>> umap_cmd = wt.UmapCommand()
|
|
25
|
+
>>> umap_result = umap_cmd('output.h5')
|
|
26
|
+
"""
|
|
27
|
+
|
|
28
|
+
# Version info
|
|
29
|
+
__version__ = "0.1.0"
|
|
30
|
+
|
|
31
|
+
# Configuration
|
|
32
|
+
# Commands
|
|
33
|
+
from .commands import (
|
|
34
|
+
ClusteringCommand,
|
|
35
|
+
DziCommand,
|
|
36
|
+
PatchEmbeddingCommand,
|
|
37
|
+
PreviewClustersCommand,
|
|
38
|
+
PreviewLatentClusterCommand,
|
|
39
|
+
PreviewLatentPCACommand,
|
|
40
|
+
PreviewScoresCommand,
|
|
41
|
+
ShowCommand,
|
|
42
|
+
Wsi2HDF5Command,
|
|
43
|
+
)
|
|
44
|
+
from .commands.clustering import ClusteringResult
|
|
45
|
+
from .commands.patch_embedding import PatchEmbeddingResult
|
|
46
|
+
from .commands.pca import PCACommand
|
|
47
|
+
from .commands.umap_embedding import UmapCommand
|
|
48
|
+
|
|
49
|
+
# Command result types
|
|
50
|
+
from .commands.wsi import Wsi2HDF5Result
|
|
51
|
+
from .common import (
|
|
52
|
+
create_default_model,
|
|
53
|
+
get_config,
|
|
54
|
+
set_default_device,
|
|
55
|
+
set_default_model,
|
|
56
|
+
set_default_model_preset,
|
|
57
|
+
set_default_progress,
|
|
58
|
+
set_verbose,
|
|
59
|
+
)
|
|
60
|
+
|
|
61
|
+
# Models
|
|
62
|
+
from .models import (
|
|
63
|
+
MODEL_NAMES,
|
|
64
|
+
create_foundation_model,
|
|
65
|
+
)
|
|
66
|
+
|
|
67
|
+
# Utility functions
|
|
68
|
+
from .utils.analysis import leiden_cluster, reorder_clusters_by_pca
|
|
69
|
+
|
|
70
|
+
# WSI file classes
|
|
71
|
+
from .wsi_files import (
|
|
72
|
+
NativeLevel,
|
|
73
|
+
OpenSlideFile,
|
|
74
|
+
PyramidalTiffFile,
|
|
75
|
+
PyramidalWSIFile,
|
|
76
|
+
StandardImage,
|
|
77
|
+
WSIFile,
|
|
78
|
+
create_wsi_file,
|
|
79
|
+
)
|
|
80
|
+
|
|
81
|
+
__all__ = [
|
|
82
|
+
# Version
|
|
83
|
+
"__version__",
|
|
84
|
+
# Configuration functions
|
|
85
|
+
"get_config",
|
|
86
|
+
"set_default_progress",
|
|
87
|
+
"set_default_model",
|
|
88
|
+
"set_default_model_preset",
|
|
89
|
+
"create_default_model",
|
|
90
|
+
"set_default_device",
|
|
91
|
+
"set_verbose",
|
|
92
|
+
# Commands
|
|
93
|
+
"Wsi2HDF5Command",
|
|
94
|
+
"PatchEmbeddingCommand",
|
|
95
|
+
"ClusteringCommand",
|
|
96
|
+
"UmapCommand",
|
|
97
|
+
"PCACommand",
|
|
98
|
+
"PreviewClustersCommand",
|
|
99
|
+
"PreviewScoresCommand",
|
|
100
|
+
"PreviewLatentPCACommand",
|
|
101
|
+
"PreviewLatentClusterCommand",
|
|
102
|
+
"ShowCommand",
|
|
103
|
+
"DziCommand",
|
|
104
|
+
# Result types
|
|
105
|
+
"Wsi2HDF5Result",
|
|
106
|
+
"PatchEmbeddingResult",
|
|
107
|
+
"ClusteringResult",
|
|
108
|
+
# WSI files
|
|
109
|
+
"WSIFile",
|
|
110
|
+
"PyramidalWSIFile",
|
|
111
|
+
"NativeLevel",
|
|
112
|
+
"OpenSlideFile",
|
|
113
|
+
"PyramidalTiffFile",
|
|
114
|
+
"StandardImage",
|
|
115
|
+
"create_wsi_file",
|
|
116
|
+
# Models
|
|
117
|
+
"MODEL_NAMES",
|
|
118
|
+
"create_foundation_model",
|
|
119
|
+
# Utilities
|
|
120
|
+
"leiden_cluster",
|
|
121
|
+
"reorder_clusters_by_pca",
|
|
122
|
+
]
|