sgtlib 3.3.9__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.
Files changed (72) hide show
  1. StructuralGT/__init__.py +31 -0
  2. StructuralGT/apps/__init__.py +0 -0
  3. StructuralGT/apps/cli_main.py +258 -0
  4. StructuralGT/apps/gui_main.py +69 -0
  5. StructuralGT/apps/gui_mcw/__init__.py +0 -0
  6. StructuralGT/apps/gui_mcw/checkbox_model.py +91 -0
  7. StructuralGT/apps/gui_mcw/controller.py +1073 -0
  8. StructuralGT/apps/gui_mcw/image_provider.py +74 -0
  9. StructuralGT/apps/gui_mcw/imagegrid_model.py +75 -0
  10. StructuralGT/apps/gui_mcw/qthread_worker.py +102 -0
  11. StructuralGT/apps/gui_mcw/table_model.py +79 -0
  12. StructuralGT/apps/gui_mcw/tree_model.py +154 -0
  13. StructuralGT/apps/sgt_qml/CenterMainContent.qml +19 -0
  14. StructuralGT/apps/sgt_qml/LeftContent.qml +48 -0
  15. StructuralGT/apps/sgt_qml/MainWindow.qml +762 -0
  16. StructuralGT/apps/sgt_qml/RightLoggingPanel.qml +125 -0
  17. StructuralGT/apps/sgt_qml/assets/icons/.DS_Store +0 -0
  18. StructuralGT/apps/sgt_qml/assets/icons/back_icon.png +0 -0
  19. StructuralGT/apps/sgt_qml/assets/icons/brightness_icon.png +0 -0
  20. StructuralGT/apps/sgt_qml/assets/icons/cancel_icon.png +0 -0
  21. StructuralGT/apps/sgt_qml/assets/icons/crop_icon.png +0 -0
  22. StructuralGT/apps/sgt_qml/assets/icons/edit_icon.png +0 -0
  23. StructuralGT/apps/sgt_qml/assets/icons/graph_icon.png +0 -0
  24. StructuralGT/apps/sgt_qml/assets/icons/hide_panel.png +0 -0
  25. StructuralGT/apps/sgt_qml/assets/icons/next_icon.png +0 -0
  26. StructuralGT/apps/sgt_qml/assets/icons/notify_icon.png +0 -0
  27. StructuralGT/apps/sgt_qml/assets/icons/rescale_icon.png +0 -0
  28. StructuralGT/apps/sgt_qml/assets/icons/show_panel.png +0 -0
  29. StructuralGT/apps/sgt_qml/assets/icons/square_icon.png +0 -0
  30. StructuralGT/apps/sgt_qml/assets/icons/undo_icon.png +0 -0
  31. StructuralGT/apps/sgt_qml/components/ImageFilters.qml +82 -0
  32. StructuralGT/apps/sgt_qml/components/ImageProperties.qml +112 -0
  33. StructuralGT/apps/sgt_qml/components/ProjectNav.qml +127 -0
  34. StructuralGT/apps/sgt_qml/widgets/BinaryFilterWidget.qml +151 -0
  35. StructuralGT/apps/sgt_qml/widgets/BrightnessControlWidget.qml +103 -0
  36. StructuralGT/apps/sgt_qml/widgets/CreateProjectWidget.qml +112 -0
  37. StructuralGT/apps/sgt_qml/widgets/GTWidget.qml +94 -0
  38. StructuralGT/apps/sgt_qml/widgets/GraphComputeWidget.qml +77 -0
  39. StructuralGT/apps/sgt_qml/widgets/GraphExtractWidget.qml +175 -0
  40. StructuralGT/apps/sgt_qml/widgets/GraphPropertyWidget.qml +77 -0
  41. StructuralGT/apps/sgt_qml/widgets/ImageFilterWidget.qml +137 -0
  42. StructuralGT/apps/sgt_qml/widgets/ImagePropertyWidget.qml +78 -0
  43. StructuralGT/apps/sgt_qml/widgets/ImageViewWidget.qml +585 -0
  44. StructuralGT/apps/sgt_qml/widgets/MenuBarWidget.qml +137 -0
  45. StructuralGT/apps/sgt_qml/widgets/MicroscopyPropertyWidget.qml +80 -0
  46. StructuralGT/apps/sgt_qml/widgets/ProjectWidget.qml +141 -0
  47. StructuralGT/apps/sgt_qml/widgets/RescaleControlWidget.qml +83 -0
  48. StructuralGT/apps/sgt_qml/widgets/RibbonWidget.qml +406 -0
  49. StructuralGT/apps/sgt_qml/widgets/StatusBarWidget.qml +173 -0
  50. StructuralGT/compute/__init__.py +0 -0
  51. StructuralGT/compute/c_lang/include/sgt_base.h +21 -0
  52. StructuralGT/compute/graph_analyzer.py +1499 -0
  53. StructuralGT/entrypoints.py +49 -0
  54. StructuralGT/imaging/__init__.py +0 -0
  55. StructuralGT/imaging/base_image.py +403 -0
  56. StructuralGT/imaging/image_processor.py +780 -0
  57. StructuralGT/modules.py +29 -0
  58. StructuralGT/networks/__init__.py +0 -0
  59. StructuralGT/networks/fiber_network.py +490 -0
  60. StructuralGT/networks/graph_skeleton.py +425 -0
  61. StructuralGT/networks/sknw_mod.py +199 -0
  62. StructuralGT/utils/__init__.py +0 -0
  63. StructuralGT/utils/config_loader.py +244 -0
  64. StructuralGT/utils/configs.ini +97 -0
  65. StructuralGT/utils/progress_update.py +67 -0
  66. StructuralGT/utils/sgt_utils.py +291 -0
  67. sgtlib-3.3.9.dist-info/METADATA +789 -0
  68. sgtlib-3.3.9.dist-info/RECORD +72 -0
  69. sgtlib-3.3.9.dist-info/WHEEL +5 -0
  70. sgtlib-3.3.9.dist-info/entry_points.txt +3 -0
  71. sgtlib-3.3.9.dist-info/licenses/LICENSE +674 -0
  72. sgtlib-3.3.9.dist-info/top_level.txt +1 -0
@@ -0,0 +1,244 @@
1
+ # SPDX-License-Identifier: GNU GPL v3
2
+
3
+ """
4
+ Loads default configurations from 'configs.ini' file
5
+ """
6
+
7
+ import os
8
+ import configparser
9
+ from typing import Union
10
+
11
+ from .sgt_utils import verify_path
12
+
13
+
14
+ def strict_read_config_file(config_path, update_func=None):
15
+ """
16
+ Strictly read the contents of the 'configs.ini' file, otherwise stop execution.
17
+
18
+ Args:
19
+ config_path (str): path to config file
20
+ update_func (function): function that will be called to give message updates
21
+
22
+ Returns:
23
+ ConfigParser object or None if an error occurs.
24
+ """
25
+ success, result = verify_path(config_path)
26
+ if not success:
27
+ if update_func is not None:
28
+ update_func(-1, f"File Error: unable to find config file {config_path}.")
29
+ return False
30
+
31
+ config = configparser.ConfigParser()
32
+ config_file = result
33
+ try:
34
+ config.read(config_file)
35
+ return True
36
+ except configparser.Error:
37
+ if update_func is not None:
38
+ update_func(-1, f"Unable to read the configs from {config_file}.")
39
+ return False
40
+
41
+
42
+ def read_config_file(config_path):
43
+ """Read the contents of the 'configs.ini' file"""
44
+ config = configparser.ConfigParser()
45
+ success, result = verify_path(config_path)
46
+ if success:
47
+ config_file = result
48
+ else:
49
+ # print(f"File Error: unable to find config file {config_path}. Using the default config file")
50
+ # Get the directory of the current script
51
+ script_dir = os.path.dirname(os.path.abspath(__file__))
52
+ config_path = 'configs.ini'
53
+ config_file = os.path.join(script_dir, config_path)
54
+ # Load the default configuration from the file
55
+ try:
56
+ config.read(config_file)
57
+ return config
58
+ except configparser.Error:
59
+ # print(f"Unable to read the configs from {config_file}.")
60
+ return None
61
+
62
+
63
+ def load_img_configs(cfg_path: str = ""):
64
+ """Image Detection settings"""
65
+
66
+ options_img: dict[str, dict[str, Union[int, float]]] = {
67
+ "threshold_type": {"id": "threshold_type", "type": "binary-filter", "text": "", "visible": 1, "value": 0 },
68
+ "global_threshold_value": {"id": "global_threshold_value", "type": "binary-filter", "text": "", "visible": 1, "value": 128 },
69
+ "adaptive_local_threshold_value": {"id": "adaptive_local_threshold_value", "type": "binary-filter", "text": "", "visible": 1, "value": 11 },
70
+ "otsu": {"id": "otsu", "type": "binary-filter", "text": "", "visible": 0, "value": 0},
71
+ "apply_dark_foreground": {"id": "apply_dark_foreground", "type": "binary-filter", "text": "", "visible": 1, "value": 0},
72
+
73
+ "apply_autolevel": {"id": "apply_autolevel", "type": "image-filter", "text": "Autolevel", "value": 0,
74
+ "dataId": "autolevel_blurring_size", "dataValue": 3, "minValue": 1, "maxValue": 7, "stepSize": 2},
75
+ "apply_gaussian_blur": {"id": "apply_gaussian_blur", "type": "image-filter", "text": "Gaussian", "value": 0,
76
+ "dataId": "gaussian_blurring_size", "dataValue": 3, "minValue": 1, "maxValue": 7, "stepSize": 2 },
77
+ "apply_laplacian_gradient": {"id": "apply_laplacian_gradient", "type": "image-filter", "text": "Laplacian",
78
+ "value": 0, "dataId": "laplacian_kernel_size", "dataValue": 3, "minValue": 1, "maxValue": 7, "stepSize": 2 },
79
+ "apply_lowpass_filter": {"id": "apply_lowpass_filter", "type": "image-filter", "text": "Lowpass", "value": 0,
80
+ "dataId": "lowpass_window_size", "dataValue": 10, "minValue": 0, "maxValue": 1000, "stepSize": 1 },
81
+ "apply_gamma": {"id": "apply_gamma", "type": "image-filter", "text": "LUT Gamma", "value": 1, "dataId": "adjust_gamma",
82
+ "dataValue": 1.0, "minValue": 0.01, "maxValue": 5.0, "stepSize": 0.01 },
83
+ "apply_sobel_gradient": {"id": "apply_sobel_gradient", "type": "image-filter", "text": "Sobel", "value": 0,
84
+ "dataId": "sobel_kernel_size", "dataValue": 3, "minValue": 1, "maxValue": 7, "stepSize": 2 },
85
+ "apply_median_filter": {"id": "apply_median_filter", "type": "image-filter", "text": "Median", "value": 0 },
86
+ "apply_scharr_gradient": {"id": "apply_scharr_gradient", "type": "image-filter", "text": "Scharr", "value": 0},
87
+
88
+ "brightness_level": {"id": "brightness_level", "type": "image-control", "text": "Brightness", "value": 0 },
89
+ "contrast_level": {"id": "contrast_level", "type": "image-control", "text": "Contrast", "value": 0 },
90
+
91
+ "scale_value_nanometers": {"id": "scale_value_nanometers", "type": "image-property", "text": "Scalebar (nm)", "visible": 1, "value": 0.0 },
92
+ "scalebar_pixel_count": {"id": "scalebar_pixel_count", "type": "image-property", "text": "Scalebar Pixel Count", "visible": 1, "value": 1 },
93
+ "resistivity": {"id": "resistivity", "type": "image-property", "text": "Resistivity (<html>&Omega;</html>m)", "visible": 1, "value": 1.0 },
94
+ "pixel_width": {"id": "pixel_width", "type": "image-property", "text": "", "visible": 0, "value": 1.0}, # * (10**-9) # 1 nanometer
95
+
96
+ "save_images": {"id": "save_images", "type": "file-options", "text": "Save All Images", "visible": 1, "value": 0},
97
+ }
98
+
99
+ # Load configuration from the file
100
+ config = read_config_file(cfg_path)
101
+ if config is None:
102
+ return options_img
103
+
104
+ try:
105
+ options_img["threshold_type"]["value"] = int(config.get('filter-settings', 'threshold_type'))
106
+ options_img["global_threshold_value"]["value"] = int(config.get('filter-settings', 'global_threshold_value'))
107
+ options_img["adaptive_local_threshold_value"]["value"] = int(config.get('filter-settings', 'adaptive_local_threshold_value'))
108
+ options_img["apply_dark_foreground"]["value"] = int(config.get('filter-settings', 'apply_dark_foreground'))
109
+
110
+ options_img["apply_gamma"]["value"] = int(config.get('filter-settings', 'apply_gamma'))
111
+ options_img["apply_gamma"]["dataValue"] = float(config.get('filter-settings', 'adjust_gamma'))
112
+ options_img["apply_autolevel"]["value"] = int(config.get('filter-settings', 'apply_autolevel'))
113
+ options_img["apply_autolevel"]["dataValue"] = int(config.get('filter-settings', 'blurring_window_size'))
114
+ options_img["apply_laplacian_gradient"]["value"] = int(config.get('filter-settings', 'apply_laplacian_gradient'))
115
+ options_img["apply_laplacian_gradient"]["dataValue"] = 3
116
+ options_img["apply_sobel_gradient"]["value"] = int(config.get('filter-settings', 'apply_sobel_gradient'))
117
+ options_img["apply_sobel_gradient"]["dataValue"] = 3
118
+ options_img["apply_gaussian_blur"]["value"] = int(config.get('filter-settings', 'apply_gaussian_blur'))
119
+ options_img["apply_gaussian_blur"]["dataValue"] = int(config.get('filter-settings', 'blurring_window_size'))
120
+ options_img["apply_lowpass_filter"]["value"] = int(config.get('filter-settings', 'apply_lowpass_filter'))
121
+ options_img["apply_lowpass_filter"]["dataValue"] = int(config.get('filter-settings', 'filter_window_size'))
122
+
123
+ options_img["apply_scharr_gradient"]["value"] = int(config.get('filter-settings', 'apply_scharr_gradient'))
124
+ options_img["apply_median_filter"]["value"] = int(config.get('filter-settings', 'apply_median_filter'))
125
+
126
+ options_img["brightness_level"]["value"] = int(config.get('filter-settings', 'brightness_level'))
127
+ options_img["contrast_level"]["value"] = int(config.get('filter-settings', 'contrast_level'))
128
+ options_img["scale_value_nanometers"]["value"] = float(config.get('filter-settings', 'scale_value_nanometers'))
129
+ options_img["scalebar_pixel_count"]["value"] = int(config.get('filter-settings', 'scalebar_pixel_count'))
130
+ options_img["resistivity"]["value"] = float(config.get('filter-settings', 'resistivity'))
131
+
132
+ options_img["save_images"]["value"] = int(config.get('file-options', 'save_images'))
133
+
134
+ return options_img
135
+ except configparser.NoSectionError:
136
+ return options_img
137
+
138
+
139
+ def load_gte_configs(cfg_path: str = ""):
140
+ """Graph Extraction Settings"""
141
+
142
+ options_gte = {
143
+ "has_weights": {"id": "has_weights", "type": "graph-extraction", "text": "Add Weights", "value": 0,
144
+ "items": [
145
+ {"id": "DIA", "text": "by diameter", "value": 1},
146
+ {"id": "AREA", "text": "by area", "value": 0},
147
+ {"id": "LEN", "text": "by length", "value": 0},
148
+ {"id": "ANGLE", "text": "by angle", "value": 0},
149
+ {"id": "INV-LEN", "text": "by inverse-length", "value": 0},
150
+ {"id": "FIX-CON", "text": "by conductance", "value": 0},
151
+ {"id": "RES", "text": "by resistance", "value": 0},
152
+ ]},
153
+ "merge_nearby_nodes": {"id": "merge_nearby_nodes", "type": "graph-extraction", "text": "Merge Nearby Nodes", "value": 1, "items": [{"id": "merge_node_radius_size", "text": "", "value": 2}]},
154
+ "prune_dangling_edges": {"id": "prune_dangling_edges", "type": "graph-extraction", "text": "Prune Dangling Edges", "value": 1, "items": [{"id": "prune_max_iteration_count", "text": "", "value": 500}]},
155
+ "remove_disconnected_segments": {"id": "remove_disconnected_segments", "type": "graph-extraction", "text": "Remove Disconn. Segments", "value": 1, "items": [{"id": "remove_object_size", "text": "", "value": 500}]},
156
+ "remove_self_loops": {"id": "remove_self_loops", "type": "graph-extraction", "text": "Remove Self Loops", "value": 1},
157
+ "display_node_id": {"id": "display_node_id", "type": "graph-extraction", "text": "Display Node ID", "value": 0},
158
+
159
+ "export_edge_list": {"id": "export_edge_list", "type": "file-options", "text": "Export Edge List", "value": 0},
160
+ "export_as_gexf": {"id": "export_as_gexf", "type": "file-options", "text": "Export as gexf", "value": 0},
161
+ "export_adj_mat": {"id": "export_adj_mat", "type": "file-options", "text": "Export Adjacency Matrix", "value": 0},
162
+ "export_as_gsd": {"id": "export_as_gsd", "type": "file-options", "text": "Export as GSD/HOOMD", "value": 0},
163
+ }
164
+
165
+ # Load configuration from the file
166
+ config = read_config_file(cfg_path)
167
+ if config is None:
168
+ return options_gte
169
+
170
+ try:
171
+
172
+ options_gte["merge_nearby_nodes"]["value"] = int(config.get('extraction-settings', 'merge_nearby_nodes'))
173
+ options_gte["merge_nearby_nodes"]["items"][0]["value"] = int(
174
+ config.get('extraction-settings', 'merge_node_radius_size'))
175
+ options_gte["prune_dangling_edges"]["value"] = int(config.get('extraction-settings', 'prune_dangling_edges'))
176
+ options_gte["prune_dangling_edges"]["items"][0]["value"] = int(
177
+ config.get('extraction-settings', 'prune_max_iteration_count'))
178
+ options_gte["remove_disconnected_segments"]["value"] = int(
179
+ config.get('extraction-settings', 'remove_disconnected_segments'))
180
+ options_gte["remove_disconnected_segments"]["items"][0]["value"] = int(config.get('extraction-settings', 'remove_object_size'))
181
+ options_gte["remove_self_loops"]["value"] = int(config.get('extraction-settings', 'remove_self_loops'))
182
+ options_gte["has_weights"]["value"] = int(config.get('extraction-settings', 'add_weights'))
183
+ weight_type = str(config.get('extraction-settings', 'weight_type'))
184
+ for i in range(len(options_gte["has_weights"]["items"])):
185
+ options_gte["has_weights"]["items"][i]["value"] = 1 if options_gte["has_weights"]["items"][i]["id"] == weight_type else 0
186
+ options_gte["display_node_id"]["value"] = int(config.get('extraction-settings', 'display_node_id'))
187
+ options_gte["export_edge_list"]["value"] = int(config.get('extraction-settings', 'export_edge_list'))
188
+ options_gte["export_as_gexf"]["value"] = int(config.get('extraction-settings', 'export_as_gexf'))
189
+ options_gte["export_adj_mat"]["value"] = int(config.get('extraction-settings', 'export_adj_mat'))
190
+ options_gte["export_as_gsd"]["value"] = int(config.get('extraction-settings', 'export_as_gsd'))
191
+
192
+ return options_gte
193
+ except configparser.NoSectionError:
194
+ return options_gte
195
+
196
+
197
+ def load_gtc_configs(cfg_path: str = ""):
198
+ """Networkx Calculation Settings"""
199
+
200
+ options_gtc = {
201
+ "display_heatmaps": {"id": "display_heatmaps", "text": "Plot Heatmaps", "value": 1},
202
+ "display_degree_histogram": {"id": "display_degree_histogram", "text": "Average Degree", "value": 1},
203
+ "compute_network_diameter": {"id": "compute_network_diameter", "text": "Network Diameter", "value": 1},
204
+ "compute_graph_density": {"id": "compute_graph_density", "text": "Graph Density", "value": 1},
205
+ "compute_wiener_index": {"id": "compute_wiener_index", "text": "Wiener Index", "value": 1},
206
+ "compute_avg_node_connectivity": {"id": "compute_avg_node_connectivity", "text": "Average Node Connectivity", "value": 0},
207
+ "compute_global_efficiency": {"id": "compute_global_efficiency", "text": "Global Coefficient", "value": 1},
208
+ "compute_avg_clustering_coef": {"id": "compute_avg_clustering_coef", "text": "Average Clustering Coefficient", "value": 1},
209
+ "compute_assortativity_coef": {"id": "compute_assortativity_coef", "text": "Assortativity Coefficient", "value": 1},
210
+ "display_betweenness_centrality_histogram": {"id": "display_betweenness_centrality_histogram", "text": "Betweenness Centrality", "value": 1},
211
+ "display_closeness_centrality_histogram": {"id": "display_closeness_centrality_histogram", "text": "Closeness Centrality", "value": 1},
212
+ "display_eigenvector_centrality_histogram": {"id": "display_eigenvector_centrality_histogram", "text": "Eigenvector Centrality", "value": 1},
213
+ "display_edge_angle_centrality_histogram": {"id": "display_edge_angle_centrality_histogram", "text": "Edge Angle Centrality", "value": 0},
214
+ "display_ohms_histogram": {"id": "display_ohms_histogram", "text": "Ohms Centrality", "value": 0},
215
+ "compute_scaling_behavior": {"id": "compute_scaling_behavior", "text": "Scaling Behavior", "value": 0},
216
+ #"compute_lang": {"id": "compute_lang", "text": "Programming Language", "value": 'Py'}
217
+ }
218
+
219
+ # Load configuration from the file
220
+ config = read_config_file(cfg_path)
221
+ if config is None:
222
+ return options_gtc
223
+
224
+ try:
225
+ options_gtc["display_heatmaps"]["value"] = int(config.get('sgt-settings', 'display_heatmaps'))
226
+ options_gtc["display_degree_histogram"]["value"] = int(config.get('sgt-settings', 'display_degree_histogram'))
227
+ options_gtc["display_betweenness_centrality_histogram"]["value"] = int(config.get('sgt-settings', 'display_betweenness_centrality_histogram'))
228
+ options_gtc["display_closeness_centrality_histogram"]["value"] = int(config.get('sgt-settings', 'display_closeness_centrality_histogram'))
229
+ options_gtc["display_eigenvector_centrality_histogram"]["value"] = int(config.get('sgt-settings', 'display_eigenvector_centrality_histogram'))
230
+ options_gtc["compute_avg_node_connectivity"]["value"] = int(config.get('sgt-settings', 'compute_avg_node_connectivity'))
231
+ options_gtc["compute_graph_density"]["value"] = int(config.get('sgt-settings', 'compute_graph_density'))
232
+ options_gtc["compute_global_efficiency"]["value"] = int(config.get('sgt-settings', 'compute_global_efficiency'))
233
+ options_gtc["compute_avg_clustering_coef"]["value"] = int(config.get('sgt-settings', 'compute_avg_clustering_coef'))
234
+ options_gtc["compute_assortativity_coef"]["value"] = int(config.get('sgt-settings', 'compute_assortativity_coef'))
235
+ options_gtc["compute_network_diameter"]["value"] = int(config.get('sgt-settings', 'compute_network_diameter'))
236
+ options_gtc["compute_wiener_index"]["value"] = int(config.get('sgt-settings', 'compute_wiener_index'))
237
+ options_gtc["display_edge_angle_centrality_histogram"]["value"] = int(config.get('sgt-settings', 'display_edge_angle_centrality_histogram'))
238
+ options_gtc["display_ohms_histogram"]["value"] = int(config.get('sgt-settings', 'display_ohms_histogram'))
239
+ options_gtc["compute_scaling_behavior"]["value"] = int(config.get('sgt-settings', 'compute_scaling_behavior'))
240
+ # options_gtc["compute_lang"]["value"] = str(config.get('sgt-settings', 'compute_lang'))
241
+
242
+ return options_gtc
243
+ except configparser.NoSectionError:
244
+ return options_gtc
@@ -0,0 +1,97 @@
1
+ [computation]
2
+ cpu_cores = 0
3
+
4
+
5
+ [image-dir]
6
+ is_multi_image = 0
7
+ image_path = ../datasets/np_images/mycelium_hyphae.png
8
+ # Choose '../datasets/np_images/' for main_launcher or 'datasets/np_images/' for Terminal
9
+ # Choose any of the image paths
10
+ # image_path = ../datasets/np_images/InVitroBioFilm.png
11
+ # image_path = ../datasets/np_images/tests/monkey.png
12
+ # image_path = ../datasets/np_images/
13
+ gt_output_path = ../results
14
+
15
+
16
+ [filter-settings]
17
+ # 0: global OR 1: adaptive OR 2: OTSU
18
+ threshold_type = 0
19
+ # range between 1-255
20
+ global_threshold_value = 128
21
+ # must be odd integer
22
+ adaptive_local_threshold_value = 11
23
+ # range between 0.01-5.0
24
+ adjust_gamma = 1
25
+ # must be odd integer
26
+ blurring_window_size = 11
27
+ filter_window_size = 1
28
+ apply_gamma = 1
29
+ apply_autolevel = 0
30
+ apply_laplacian_gradient = 0
31
+ apply_scharr_gradient = 0
32
+ apply_sobel_gradient = 0
33
+ apply_median_filter = 0
34
+ apply_gaussian_blur = 0
35
+ apply_lowpass_filter = 0
36
+ apply_dark_foreground = 0
37
+ # -100 to 100
38
+ brightness_level = 0
39
+ # -100 to 100
40
+ contrast_level = 0
41
+ scale_value_nanometers = 0
42
+ scalebar_pixel_count = 1
43
+ resistivity = 1
44
+ save_images = 0
45
+
46
+
47
+
48
+ [extraction-settings]
49
+ merge_nearby_nodes = 1
50
+ merge_node_radius_size = 3
51
+ prune_dangling_edges = 1
52
+ prune_max_iteration_count = 500
53
+ remove_disconnected_segments = 1
54
+ remove_self_loops = 1
55
+ remove_object_size = 500
56
+ display_node_id = 0
57
+ add_weights = 0
58
+ # DIA, AREA, LEN, ANGLE, INV_LEN, VAR_CON, FIX_CON, RES
59
+ weight_type = DIA
60
+ export_edge_list = 0
61
+ export_as_gexf = 0
62
+ export_adj_mat = 0
63
+ export_as_gsd = 0
64
+
65
+
66
+ [sgt-settings]
67
+ display_heatmaps = 1
68
+ display_degree_histogram = 1
69
+ display_betweenness_centrality_histogram = 1
70
+ display_closeness_centrality_histogram = 0
71
+ display_eigenvector_centrality_histogram = 0
72
+ display_edge_angle_centrality_histogram = 0
73
+ display_ohms_histogram = 0
74
+ compute_scaling_behavior = 0
75
+ compute_avg_node_connectivity = 0
76
+ compute_graph_density = 1
77
+ compute_global_efficiency = 0
78
+ compute_avg_clustering_coef = 1
79
+ compute_assortativity_coef = 1
80
+ compute_network_diameter = 1
81
+ compute_wiener_index = 0
82
+ compute_lang = Py
83
+
84
+
85
+ [gnct-settings]
86
+ ml_model = MLP
87
+
88
+
89
+ [fic-settings]
90
+ # reduce resolution (OPTIONAL)
91
+ down_sampling_factor = 4
92
+ domain_block_size = 8
93
+ range_block_size = 4
94
+ # should be 1 to get all candidates (overlapping)
95
+ # having as 8 means no overlapping candidates (if domain_block_size=8)
96
+ block_step_size = 8
97
+ decompress_iteration_count = 25
@@ -0,0 +1,67 @@
1
+ # SPDX-License-Identifier: GNU GPL v3
2
+
3
+ """
4
+ Uses listener functions to send updates to outside functions.
5
+ """
6
+
7
+
8
+ class ProgressUpdate:
9
+ """
10
+ A class for sending updates to outside functions.
11
+
12
+ """
13
+ def __init__(self):
14
+ """
15
+ A class for sending updates to outside functions.
16
+
17
+ >>> def print_progress(code, msg):
18
+ >>> print(str(code) + ': ' + str(msg))
19
+ >>>
20
+ >>> upd = ProgressUpdate()
21
+ >>> upd.add_listener(print_progress) # to get updates
22
+ >>> upd.update_status([1,"Sending update ..."])
23
+ >>> upd.remove_listener(print_progress) # to opt out of updates
24
+ >>>
25
+ """
26
+ self.__listeners = []
27
+ self.abort = False
28
+
29
+ def abort_tasks(self):
30
+ """
31
+ Set abort flag.
32
+ :return:
33
+ """
34
+ self.abort = True
35
+
36
+ def add_listener(self, func):
37
+ """
38
+ Add functions from the list of listeners.
39
+ :param func:
40
+ :return:
41
+ """
42
+ if func in self.__listeners:
43
+ return
44
+ self.__listeners.append(func)
45
+
46
+ def remove_listener(self, func):
47
+ """
48
+ Remove functions from the list of listeners.
49
+ :param func:
50
+ :return:
51
+ """
52
+ if func not in self.__listeners:
53
+ return
54
+ self.__listeners.remove(func)
55
+
56
+ def update_status(self, args=None):
57
+ """
58
+ Run all the functions that are saved as listeners.
59
+
60
+ :param args:
61
+ :return:
62
+ """
63
+ # Trigger events.
64
+ if args is None:
65
+ args = []
66
+ for func in self.__listeners:
67
+ func(*args)