wsi-toolbox 0.1.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 +119 -0
- wsi_toolbox/app.py +753 -0
- wsi_toolbox/cli.py +485 -0
- wsi_toolbox/commands/__init__.py +92 -0
- wsi_toolbox/commands/clustering.py +214 -0
- wsi_toolbox/commands/dzi_export.py +202 -0
- wsi_toolbox/commands/patch_embedding.py +199 -0
- wsi_toolbox/commands/preview.py +335 -0
- wsi_toolbox/commands/wsi.py +196 -0
- wsi_toolbox/exp.py +466 -0
- wsi_toolbox/models.py +38 -0
- wsi_toolbox/utils/__init__.py +153 -0
- wsi_toolbox/utils/analysis.py +127 -0
- wsi_toolbox/utils/cli.py +25 -0
- wsi_toolbox/utils/helpers.py +57 -0
- wsi_toolbox/utils/progress.py +206 -0
- wsi_toolbox/utils/seed.py +21 -0
- wsi_toolbox/utils/st.py +53 -0
- wsi_toolbox/watcher.py +261 -0
- wsi_toolbox/wsi_files.py +187 -0
- wsi_toolbox-0.1.0.dist-info/METADATA +269 -0
- wsi_toolbox-0.1.0.dist-info/RECORD +25 -0
- wsi_toolbox-0.1.0.dist-info/WHEEL +4 -0
- wsi_toolbox-0.1.0.dist-info/entry_points.txt +2 -0
- wsi_toolbox-0.1.0.dist-info/licenses/LICENSE +21 -0
wsi_toolbox/__init__.py
ADDED
|
@@ -0,0 +1,119 @@
|
|
|
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
|
+
>>> wt.set_default_progress('tqdm')
|
|
11
|
+
>>> cmd = wt.Wsi2HDF5Command(patch_size=256)
|
|
12
|
+
>>> result = cmd('input.ndpi', 'output.h5')
|
|
13
|
+
>>>
|
|
14
|
+
>>> # Extract features
|
|
15
|
+
>>> wt.set_default_model('gigapath')
|
|
16
|
+
>>> wt.set_default_device('cuda')
|
|
17
|
+
>>> emb_cmd = wt.PatchEmbeddingCommand(batch_size=256)
|
|
18
|
+
>>> emb_result = emb_cmd('output.h5')
|
|
19
|
+
>>>
|
|
20
|
+
>>> # Clustering
|
|
21
|
+
>>> cluster_cmd = wt.ClusteringCommand(resolution=1.0, use_umap=True)
|
|
22
|
+
>>> cluster_result = cluster_cmd(['output.h5'])
|
|
23
|
+
>>>
|
|
24
|
+
>>> # Plot UMAP
|
|
25
|
+
>>> umap_embs = cluster_cmd.get_umap_embeddings()
|
|
26
|
+
>>> fig = wt.plot_umap(umap_embs, cluster_cmd.total_clusters)
|
|
27
|
+
>>> fig.savefig('umap.png')
|
|
28
|
+
"""
|
|
29
|
+
|
|
30
|
+
# Version info
|
|
31
|
+
__version__ = '0.1.0'
|
|
32
|
+
|
|
33
|
+
# Commands
|
|
34
|
+
from .commands import (
|
|
35
|
+
# Configuration
|
|
36
|
+
set_default_progress,
|
|
37
|
+
set_default_model,
|
|
38
|
+
set_default_device,
|
|
39
|
+
set_verbose,
|
|
40
|
+
|
|
41
|
+
# Main commands
|
|
42
|
+
Wsi2HDF5Command,
|
|
43
|
+
PatchEmbeddingCommand,
|
|
44
|
+
ClusteringCommand,
|
|
45
|
+
|
|
46
|
+
# Preview commands
|
|
47
|
+
PreviewClustersCommand,
|
|
48
|
+
PreviewScoresCommand,
|
|
49
|
+
PreviewLatentPCACommand,
|
|
50
|
+
PreviewLatentClusterCommand,
|
|
51
|
+
|
|
52
|
+
# Export commands
|
|
53
|
+
DziExportCommand,
|
|
54
|
+
)
|
|
55
|
+
|
|
56
|
+
# Command result types
|
|
57
|
+
from .commands.wsi import Wsi2HDF5Result
|
|
58
|
+
from .commands.patch_embedding import PatchEmbeddingResult
|
|
59
|
+
from .commands.clustering import ClusteringResult
|
|
60
|
+
|
|
61
|
+
# WSI file classes
|
|
62
|
+
from .wsi_files import (
|
|
63
|
+
WSIFile,
|
|
64
|
+
OpenSlideFile,
|
|
65
|
+
TiffFile,
|
|
66
|
+
StandardImage,
|
|
67
|
+
create_wsi_file,
|
|
68
|
+
)
|
|
69
|
+
|
|
70
|
+
# Models
|
|
71
|
+
from .models import (
|
|
72
|
+
MODEL_LABELS,
|
|
73
|
+
create_model,
|
|
74
|
+
)
|
|
75
|
+
|
|
76
|
+
# Utility functions
|
|
77
|
+
from .utils import plot_umap
|
|
78
|
+
from .utils.analysis import leiden_cluster
|
|
79
|
+
|
|
80
|
+
__all__ = [
|
|
81
|
+
# Version
|
|
82
|
+
'__version__',
|
|
83
|
+
|
|
84
|
+
# Configuration functions
|
|
85
|
+
'set_default_progress',
|
|
86
|
+
'set_default_model',
|
|
87
|
+
'set_default_device',
|
|
88
|
+
'set_verbose',
|
|
89
|
+
|
|
90
|
+
# Commands
|
|
91
|
+
'Wsi2HDF5Command',
|
|
92
|
+
'PatchEmbeddingCommand',
|
|
93
|
+
'ClusteringCommand',
|
|
94
|
+
'PreviewClustersCommand',
|
|
95
|
+
'PreviewScoresCommand',
|
|
96
|
+
'PreviewLatentPCACommand',
|
|
97
|
+
'PreviewLatentClusterCommand',
|
|
98
|
+
'DziExportCommand',
|
|
99
|
+
|
|
100
|
+
# Result types
|
|
101
|
+
'Wsi2HDF5Result',
|
|
102
|
+
'PatchEmbeddingResult',
|
|
103
|
+
'ClusteringResult',
|
|
104
|
+
|
|
105
|
+
# WSI files
|
|
106
|
+
'WSIFile',
|
|
107
|
+
'OpenSlideFile',
|
|
108
|
+
'TiffFile',
|
|
109
|
+
'StandardImage',
|
|
110
|
+
'create_wsi_file',
|
|
111
|
+
|
|
112
|
+
# Models
|
|
113
|
+
'MODEL_LABELS',
|
|
114
|
+
'create_model',
|
|
115
|
+
|
|
116
|
+
# Utilities
|
|
117
|
+
'plot_umap',
|
|
118
|
+
'leiden_cluster',
|
|
119
|
+
]
|