fusion-tools 2.3.0__tar.gz → 2.3.2__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.
- {fusion_tools-2.3.0 → fusion_tools-2.3.2}/PKG-INFO +1 -1
- {fusion_tools-2.3.0 → fusion_tools-2.3.2}/setup.py +1 -1
- {fusion_tools-2.3.0 → fusion_tools-2.3.2}/src/fusion_tools/feature_extraction.py +47 -5
- {fusion_tools-2.3.0 → fusion_tools-2.3.2}/src/fusion_tools.egg-info/PKG-INFO +1 -1
- {fusion_tools-2.3.0 → fusion_tools-2.3.2}/LICENSE +0 -0
- {fusion_tools-2.3.0 → fusion_tools-2.3.2}/README.md +0 -0
- {fusion_tools-2.3.0 → fusion_tools-2.3.2}/pyproject.toml +0 -0
- {fusion_tools-2.3.0 → fusion_tools-2.3.2}/setup.cfg +0 -0
- {fusion_tools-2.3.0 → fusion_tools-2.3.2}/src/fusion_tools/__init__.py +0 -0
- {fusion_tools-2.3.0 → fusion_tools-2.3.2}/src/fusion_tools/components/__init__.py +0 -0
- {fusion_tools-2.3.0 → fusion_tools-2.3.2}/src/fusion_tools/components/maps.py +0 -0
- {fusion_tools-2.3.0 → fusion_tools-2.3.2}/src/fusion_tools/components/segmentation.py +0 -0
- {fusion_tools-2.3.0 → fusion_tools-2.3.2}/src/fusion_tools/components/tools.py +0 -0
- {fusion_tools-2.3.0 → fusion_tools-2.3.2}/src/fusion_tools/dataset.py +0 -0
- {fusion_tools-2.3.0 → fusion_tools-2.3.2}/src/fusion_tools/handler.py +0 -0
- {fusion_tools-2.3.0 → fusion_tools-2.3.2}/src/fusion_tools/tileserver.py +0 -0
- {fusion_tools-2.3.0 → fusion_tools-2.3.2}/src/fusion_tools/utils/__init__.py +0 -0
- {fusion_tools-2.3.0 → fusion_tools-2.3.2}/src/fusion_tools/utils/omics.py +0 -0
- {fusion_tools-2.3.0 → fusion_tools-2.3.2}/src/fusion_tools/utils/shapes.py +0 -0
- {fusion_tools-2.3.0 → fusion_tools-2.3.2}/src/fusion_tools/utils/stats.py +0 -0
- {fusion_tools-2.3.0 → fusion_tools-2.3.2}/src/fusion_tools/visualization/__init__.py +0 -0
- {fusion_tools-2.3.0 → fusion_tools-2.3.2}/src/fusion_tools/visualization/components.py +0 -0
- {fusion_tools-2.3.0 → fusion_tools-2.3.2}/src/fusion_tools/visualization/vis_utils.py +0 -0
- {fusion_tools-2.3.0 → fusion_tools-2.3.2}/src/fusion_tools.egg-info/SOURCES.txt +0 -0
- {fusion_tools-2.3.0 → fusion_tools-2.3.2}/src/fusion_tools.egg-info/dependency_links.txt +0 -0
- {fusion_tools-2.3.0 → fusion_tools-2.3.2}/src/fusion_tools.egg-info/requires.txt +0 -0
- {fusion_tools-2.3.0 → fusion_tools-2.3.2}/src/fusion_tools.egg-info/top_level.txt +0 -0
- {fusion_tools-2.3.0 → fusion_tools-2.3.2}/tests/test_classification_model.py +0 -0
- {fusion_tools-2.3.0 → fusion_tools-2.3.2}/tests/test_custom_component.py +0 -0
- {fusion_tools-2.3.0 → fusion_tools-2.3.2}/tests/test_dataset_classes.py +0 -0
- {fusion_tools-2.3.0 → fusion_tools-2.3.2}/tests/test_extract_nested_prop.py +0 -0
- {fusion_tools-2.3.0 → fusion_tools-2.3.2}/tests/test_feature_annotation.py +0 -0
- {fusion_tools-2.3.0 → fusion_tools-2.3.2}/tests/test_feature_extraction.py +0 -0
- {fusion_tools-2.3.0 → fusion_tools-2.3.2}/tests/test_generate_property_dict.py +0 -0
- {fusion_tools-2.3.0 → fusion_tools-2.3.2}/tests/test_get_gene_info.py +0 -0
- {fusion_tools-2.3.0 → fusion_tools-2.3.2}/tests/test_hra_viewer.py +0 -0
- {fusion_tools-2.3.0 → fusion_tools-2.3.2}/tests/test_image_overlay.py +0 -0
- {fusion_tools-2.3.0 → fusion_tools-2.3.2}/tests/test_model_train.py +0 -0
- {fusion_tools-2.3.0 → fusion_tools-2.3.2}/tests/test_multiframe_rgb.py +0 -0
- {fusion_tools-2.3.0 → fusion_tools-2.3.2}/tests/test_multiframeslidemap.py +0 -0
- {fusion_tools-2.3.0 → fusion_tools-2.3.2}/tests/test_property_plotter.py +0 -0
- {fusion_tools-2.3.0 → fusion_tools-2.3.2}/tests/test_read_anndata.py +0 -0
- {fusion_tools-2.3.0 → fusion_tools-2.3.2}/tests/test_remote_slide_annotations.py +0 -0
- {fusion_tools-2.3.0 → fusion_tools-2.3.2}/tests/test_remote_tileserver.py +0 -0
- {fusion_tools-2.3.0 → fusion_tools-2.3.2}/tests/test_segmentation.py +0 -0
- {fusion_tools-2.3.0 → fusion_tools-2.3.2}/tests/test_slide_annotations.py +0 -0
- {fusion_tools-2.3.0 → fusion_tools-2.3.2}/tests/test_spatial_aggregation.py +0 -0
- {fusion_tools-2.3.0 → fusion_tools-2.3.2}/tests/test_tile_server.py +0 -0
- {fusion_tools-2.3.0 → fusion_tools-2.3.2}/tests/test_visualization_component.py +0 -0
|
@@ -5,7 +5,7 @@ with open("README.md", "r") as fh:
|
|
|
5
5
|
|
|
6
6
|
setuptools.setup(
|
|
7
7
|
name="fusion-tools",
|
|
8
|
-
version="2.3.
|
|
8
|
+
version="2.3.2",
|
|
9
9
|
author="Sam Border",
|
|
10
10
|
author_email="sam.border2256@gmail.com",
|
|
11
11
|
description="Modular visualization and analysis dashboard creation for high-resolution microscopy images",
|
|
@@ -43,6 +43,8 @@ class ParallelFeatureExtractor:
|
|
|
43
43
|
feature_list: list = [],
|
|
44
44
|
preprocess: Union[Callable,None] = None,
|
|
45
45
|
sub_mask: Union[Callable,None] = None,
|
|
46
|
+
mask_names: Union[list,None] = None,
|
|
47
|
+
channel_names: Union[list,None] = None,
|
|
46
48
|
n_jobs: None = None,
|
|
47
49
|
verbose: bool = False):
|
|
48
50
|
"""Constructor method
|
|
@@ -71,6 +73,8 @@ class ParallelFeatureExtractor:
|
|
|
71
73
|
self.feature_list = feature_list
|
|
72
74
|
self.preprocess = preprocess
|
|
73
75
|
self.sub_mask = sub_mask
|
|
76
|
+
self.mask_names = mask_names
|
|
77
|
+
self.channel_names = channel_names
|
|
74
78
|
self.n_jobs = n_jobs
|
|
75
79
|
self.verbose = verbose
|
|
76
80
|
|
|
@@ -87,6 +91,38 @@ class ParallelFeatureExtractor:
|
|
|
87
91
|
a[key] = b[key]
|
|
88
92
|
return a
|
|
89
93
|
|
|
94
|
+
def update_dict_keys(self,input_dict:dict):
|
|
95
|
+
|
|
96
|
+
convert_key = {}
|
|
97
|
+
if not self.mask_names is None:
|
|
98
|
+
convert_key = {f'Mask {float(idx+1)}': i for idx,i in enumerate(self.mask_names)}
|
|
99
|
+
if not self.channel_names is None:
|
|
100
|
+
convert_key = convert_key | {f'Channel {float(idx+1)}': i for idx,i in enumerate(self.channel_names)}
|
|
101
|
+
|
|
102
|
+
def convert_dict_key(pre_convert):
|
|
103
|
+
if pre_convert in convert_key:
|
|
104
|
+
return convert_key[pre_convert]
|
|
105
|
+
else:
|
|
106
|
+
return pre_convert
|
|
107
|
+
|
|
108
|
+
def change_keys(obj, convert):
|
|
109
|
+
"""
|
|
110
|
+
Recursively goes through the dictionary obj and replaces keys with the convert function.
|
|
111
|
+
"""
|
|
112
|
+
if isinstance(obj, (str, int, float)):
|
|
113
|
+
return obj
|
|
114
|
+
if isinstance(obj, dict):
|
|
115
|
+
new = obj.__class__()
|
|
116
|
+
for k, v in obj.items():
|
|
117
|
+
new[convert(k)] = change_keys(v, convert)
|
|
118
|
+
elif isinstance(obj, (list, set, tuple)):
|
|
119
|
+
new = obj.__class__(change_keys(v, convert) for v in obj)
|
|
120
|
+
else:
|
|
121
|
+
return obj
|
|
122
|
+
return new
|
|
123
|
+
|
|
124
|
+
return change_keys(input_dict,convert_dict_key)
|
|
125
|
+
|
|
90
126
|
def get_bbox(self, coords:list)->list:
|
|
91
127
|
|
|
92
128
|
coords_array = np.squeeze(np.array(coords))
|
|
@@ -192,14 +228,20 @@ class ParallelFeatureExtractor:
|
|
|
192
228
|
bbox = self.get_bbox(coords)
|
|
193
229
|
|
|
194
230
|
return_dict = {
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
231
|
+
"bbox": {
|
|
232
|
+
'min_x': bbox[0],
|
|
233
|
+
'min_y': bbox[1],
|
|
234
|
+
'max_x': bbox[2],
|
|
235
|
+
'max_y': bbox[3]
|
|
236
|
+
}
|
|
199
237
|
}
|
|
200
238
|
for f in self.feature_list:
|
|
201
239
|
# Each feature extraction function should accept three inputs, whether they are used or not
|
|
202
|
-
|
|
240
|
+
new_features = f(image_region, mask, coords)
|
|
241
|
+
if not self.mask_names is None or not self.channel_names is None:
|
|
242
|
+
new_features = self.update_dict_keys(new_features)
|
|
243
|
+
|
|
244
|
+
return_dict = self.merge_dict(return_dict,new_features)
|
|
203
245
|
|
|
204
246
|
return return_dict
|
|
205
247
|
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|