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.
Files changed (49) hide show
  1. {fusion_tools-2.3.0 → fusion_tools-2.3.2}/PKG-INFO +1 -1
  2. {fusion_tools-2.3.0 → fusion_tools-2.3.2}/setup.py +1 -1
  3. {fusion_tools-2.3.0 → fusion_tools-2.3.2}/src/fusion_tools/feature_extraction.py +47 -5
  4. {fusion_tools-2.3.0 → fusion_tools-2.3.2}/src/fusion_tools.egg-info/PKG-INFO +1 -1
  5. {fusion_tools-2.3.0 → fusion_tools-2.3.2}/LICENSE +0 -0
  6. {fusion_tools-2.3.0 → fusion_tools-2.3.2}/README.md +0 -0
  7. {fusion_tools-2.3.0 → fusion_tools-2.3.2}/pyproject.toml +0 -0
  8. {fusion_tools-2.3.0 → fusion_tools-2.3.2}/setup.cfg +0 -0
  9. {fusion_tools-2.3.0 → fusion_tools-2.3.2}/src/fusion_tools/__init__.py +0 -0
  10. {fusion_tools-2.3.0 → fusion_tools-2.3.2}/src/fusion_tools/components/__init__.py +0 -0
  11. {fusion_tools-2.3.0 → fusion_tools-2.3.2}/src/fusion_tools/components/maps.py +0 -0
  12. {fusion_tools-2.3.0 → fusion_tools-2.3.2}/src/fusion_tools/components/segmentation.py +0 -0
  13. {fusion_tools-2.3.0 → fusion_tools-2.3.2}/src/fusion_tools/components/tools.py +0 -0
  14. {fusion_tools-2.3.0 → fusion_tools-2.3.2}/src/fusion_tools/dataset.py +0 -0
  15. {fusion_tools-2.3.0 → fusion_tools-2.3.2}/src/fusion_tools/handler.py +0 -0
  16. {fusion_tools-2.3.0 → fusion_tools-2.3.2}/src/fusion_tools/tileserver.py +0 -0
  17. {fusion_tools-2.3.0 → fusion_tools-2.3.2}/src/fusion_tools/utils/__init__.py +0 -0
  18. {fusion_tools-2.3.0 → fusion_tools-2.3.2}/src/fusion_tools/utils/omics.py +0 -0
  19. {fusion_tools-2.3.0 → fusion_tools-2.3.2}/src/fusion_tools/utils/shapes.py +0 -0
  20. {fusion_tools-2.3.0 → fusion_tools-2.3.2}/src/fusion_tools/utils/stats.py +0 -0
  21. {fusion_tools-2.3.0 → fusion_tools-2.3.2}/src/fusion_tools/visualization/__init__.py +0 -0
  22. {fusion_tools-2.3.0 → fusion_tools-2.3.2}/src/fusion_tools/visualization/components.py +0 -0
  23. {fusion_tools-2.3.0 → fusion_tools-2.3.2}/src/fusion_tools/visualization/vis_utils.py +0 -0
  24. {fusion_tools-2.3.0 → fusion_tools-2.3.2}/src/fusion_tools.egg-info/SOURCES.txt +0 -0
  25. {fusion_tools-2.3.0 → fusion_tools-2.3.2}/src/fusion_tools.egg-info/dependency_links.txt +0 -0
  26. {fusion_tools-2.3.0 → fusion_tools-2.3.2}/src/fusion_tools.egg-info/requires.txt +0 -0
  27. {fusion_tools-2.3.0 → fusion_tools-2.3.2}/src/fusion_tools.egg-info/top_level.txt +0 -0
  28. {fusion_tools-2.3.0 → fusion_tools-2.3.2}/tests/test_classification_model.py +0 -0
  29. {fusion_tools-2.3.0 → fusion_tools-2.3.2}/tests/test_custom_component.py +0 -0
  30. {fusion_tools-2.3.0 → fusion_tools-2.3.2}/tests/test_dataset_classes.py +0 -0
  31. {fusion_tools-2.3.0 → fusion_tools-2.3.2}/tests/test_extract_nested_prop.py +0 -0
  32. {fusion_tools-2.3.0 → fusion_tools-2.3.2}/tests/test_feature_annotation.py +0 -0
  33. {fusion_tools-2.3.0 → fusion_tools-2.3.2}/tests/test_feature_extraction.py +0 -0
  34. {fusion_tools-2.3.0 → fusion_tools-2.3.2}/tests/test_generate_property_dict.py +0 -0
  35. {fusion_tools-2.3.0 → fusion_tools-2.3.2}/tests/test_get_gene_info.py +0 -0
  36. {fusion_tools-2.3.0 → fusion_tools-2.3.2}/tests/test_hra_viewer.py +0 -0
  37. {fusion_tools-2.3.0 → fusion_tools-2.3.2}/tests/test_image_overlay.py +0 -0
  38. {fusion_tools-2.3.0 → fusion_tools-2.3.2}/tests/test_model_train.py +0 -0
  39. {fusion_tools-2.3.0 → fusion_tools-2.3.2}/tests/test_multiframe_rgb.py +0 -0
  40. {fusion_tools-2.3.0 → fusion_tools-2.3.2}/tests/test_multiframeslidemap.py +0 -0
  41. {fusion_tools-2.3.0 → fusion_tools-2.3.2}/tests/test_property_plotter.py +0 -0
  42. {fusion_tools-2.3.0 → fusion_tools-2.3.2}/tests/test_read_anndata.py +0 -0
  43. {fusion_tools-2.3.0 → fusion_tools-2.3.2}/tests/test_remote_slide_annotations.py +0 -0
  44. {fusion_tools-2.3.0 → fusion_tools-2.3.2}/tests/test_remote_tileserver.py +0 -0
  45. {fusion_tools-2.3.0 → fusion_tools-2.3.2}/tests/test_segmentation.py +0 -0
  46. {fusion_tools-2.3.0 → fusion_tools-2.3.2}/tests/test_slide_annotations.py +0 -0
  47. {fusion_tools-2.3.0 → fusion_tools-2.3.2}/tests/test_spatial_aggregation.py +0 -0
  48. {fusion_tools-2.3.0 → fusion_tools-2.3.2}/tests/test_tile_server.py +0 -0
  49. {fusion_tools-2.3.0 → fusion_tools-2.3.2}/tests/test_visualization_component.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: fusion-tools
3
- Version: 2.3.0
3
+ Version: 2.3.2
4
4
  Summary: Modular visualization and analysis dashboard creation for high-resolution microscopy images
5
5
  Home-page: https://github.com/spborder/fusion-tools
6
6
  Author: Sam Border
@@ -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.0",
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
- 'min_x': bbox[0],
196
- 'min_y': bbox[1],
197
- 'max_x': bbox[2],
198
- 'max_y': bbox[3]
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
- return_dict = self.merge_dict(return_dict,f(image_region, mask, coords))
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
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: fusion-tools
3
- Version: 2.3.0
3
+ Version: 2.3.2
4
4
  Summary: Modular visualization and analysis dashboard creation for high-resolution microscopy images
5
5
  Home-page: https://github.com/spborder/fusion-tools
6
6
  Author: Sam Border
File without changes
File without changes
File without changes