nettracer3d 0.9.5__py3-none-any.whl → 0.9.6__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.
nettracer3d/proximity.py CHANGED
@@ -966,4 +966,94 @@ def partition_objects_into_cells(object_centroids, cell_size):
966
966
  cell_assignments[int(cell_number)].append(int(label))
967
967
 
968
968
  # Convert defaultdict to regular dict and sort keys
969
- return dict(sorted(cell_assignments.items()))
969
+ return dict(sorted(cell_assignments.items()))
970
+
971
+
972
+
973
+ # To use with the merge node identities manual calculation:
974
+
975
+ def get_reslice_indices_for_id(slice_obj, array_shape):
976
+ """Convert slice object to padded indices accounting for dilation and boundaries"""
977
+ if slice_obj is None:
978
+ return None, None, None
979
+
980
+ z_slice, y_slice, x_slice = slice_obj
981
+
982
+ # Extract min/max from slices
983
+ z_min, z_max = z_slice.start, z_slice.stop - 1
984
+ y_min, y_max = y_slice.start, y_slice.stop - 1
985
+ x_min, x_max = x_slice.start, x_slice.stop - 1
986
+
987
+ # Boundary checks
988
+ y_max = min(y_max, array_shape[1] - 1)
989
+ x_max = min(x_max, array_shape[2] - 1)
990
+ z_max = min(z_max, array_shape[0] - 1)
991
+ y_min = max(y_min, 0)
992
+ x_min = max(x_min, 0)
993
+ z_min = max(z_min, 0)
994
+
995
+ return [z_min, z_max], [y_min, y_max], [x_min, x_max]
996
+
997
+
998
+ def _get_node_edge_dict_id(label_array, edge_array, label):
999
+ """Internal method used for the secondary algorithm to find which nodes interact with which edges."""
1000
+
1001
+ # Create compound condition: label matches AND edge value > 0
1002
+ valid_mask = (label_array == label) & (edge_array > 0)
1003
+ valid_edges = edge_array[valid_mask]
1004
+
1005
+ if len(valid_edges) > 0:
1006
+ edge_val = np.mean(valid_edges)
1007
+ else:
1008
+ edge_val = 0
1009
+
1010
+ return edge_val
1011
+
1012
+ def process_label_id(args):
1013
+ """Modified to use pre-computed bounding boxes instead of argwhere"""
1014
+ nodes, edges, label, array_shape, bounding_boxes = args
1015
+
1016
+ # Get the pre-computed bounding box for this label
1017
+ slice_obj = bounding_boxes[int(label)-1] # -1 because label numbers start at 1
1018
+ if slice_obj is None:
1019
+ return None, None, None
1020
+
1021
+ z_vals, y_vals, x_vals = get_reslice_indices_for_id(slice_obj, array_shape)
1022
+ if z_vals is None:
1023
+ return None, None, None
1024
+
1025
+ sub_nodes = reslice_3d_array((nodes, z_vals, y_vals, x_vals))
1026
+ sub_edges = reslice_3d_array((edges, z_vals, y_vals, x_vals))
1027
+ return label, sub_nodes, sub_edges
1028
+
1029
+
1030
+ def create_node_dictionary_id(nodes, edges, num_nodes):
1031
+ """Modified to pre-compute all bounding boxes using find_objects"""
1032
+ node_dict = {}
1033
+ array_shape = nodes.shape
1034
+
1035
+ # Get all bounding boxes at once
1036
+ bounding_boxes = ndimage.find_objects(nodes)
1037
+
1038
+ # Use ThreadPoolExecutor for parallel execution
1039
+ with ThreadPoolExecutor(max_workers=mp.cpu_count()) as executor:
1040
+ # Create args list with bounding_boxes included
1041
+ args_list = [(nodes, edges, i, array_shape, bounding_boxes)
1042
+ for i in range(1, int(num_nodes) + 1)]
1043
+
1044
+ # Execute parallel tasks to process labels
1045
+ results = executor.map(process_label_id, args_list)
1046
+
1047
+ # Process results in parallel
1048
+ for label, sub_nodes, sub_edges in results:
1049
+ executor.submit(create_dict_entry_id, node_dict, label, sub_nodes, sub_edges)
1050
+
1051
+ return node_dict
1052
+
1053
+ def create_dict_entry_id(node_dict, label, sub_nodes, sub_edges):
1054
+ """Internal method used for the secondary algorithm to pass around args in parallel."""
1055
+
1056
+ if label is None:
1057
+ pass
1058
+ else:
1059
+ node_dict[label] = _get_node_edge_dict_id(sub_nodes, sub_edges, label)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: nettracer3d
3
- Version: 0.9.5
3
+ Version: 0.9.6
4
4
  Summary: Scripts for intializing and analyzing networks from segmentations of three dimensional images.
5
5
  Author-email: Liam McLaughlin <liamm@wustl.edu>
6
6
  Project-URL: Documentation, https://nettracer3d.readthedocs.io/en/latest/
@@ -110,8 +110,10 @@ McLaughlin, L., Zhang, B., Sharma, S. et al. Three dimensional multiscalar neuro
110
110
 
111
111
  NetTracer3D was developed by Liam McLaughlin while working under Dr. Sanjay Jain at Washington University School of Medicine.
112
112
 
113
- -- Version 0.9.5 Updates --
113
+ -- Version 0.9.6 Updates --
114
114
 
115
- * Adjusted how pan mode works a little bit.
115
+ * Moved some file menu options around.
116
+ * The 'merge node id' option now offers interactive support for assisted thresholding for any new identity channels the user is trying to merge with.
116
117
  * Bug Fixes
117
- * Erode can now optionally preserve object labels.
118
+ * The 'merge nodes' option now can provide centroids prior to the merge, since oftentimes objects end up on top of each other.
119
+ * A few other minor adjustments.
@@ -4,22 +4,22 @@ nettracer3d/community_extractor.py,sha256=yFHwygfeK-p0bjUMaIpeq_v6LbsKZiVAvPD6nh
4
4
  nettracer3d/excelotron.py,sha256=aNof6k-DgMxVyFgsl3ltSCxG4vZW49cuvCBzfzhYhUY,75072
5
5
  nettracer3d/modularity.py,sha256=pborVcDBvICB2-g8lNoSVZbIReIBlfeBmjFbPYmtq7Y,22443
6
6
  nettracer3d/morphology.py,sha256=jyDjYzrZ4LvI5jOyw8DLsxmo-i5lpqHsejYpW7Tq7Mo,19786
7
- nettracer3d/neighborhoods.py,sha256=2QzGKkQCSUerxigkcHF4iN7ys8kv-KHTbkD_9_2Krgo,58365
8
- nettracer3d/nettracer.py,sha256=Yse2gTI_WaITRJmJxUttqAgsxUzUq5wcvFdGPOw-7r4,266988
9
- nettracer3d/nettracer_gui.py,sha256=J3vVucTa3HIzfdspHJRQ2cJTD4xTOmxEqbapvMPCy8U,617103
7
+ nettracer3d/neighborhoods.py,sha256=iIaHU1COIdRtzRpAuIQKfLGLNKYFK3dL8Vb_EeJIlEA,46459
8
+ nettracer3d/nettracer.py,sha256=d9Mhz-pHox5OfGGUSTrkTBJzCWCrbQvClTu2ANt-jUE,267943
9
+ nettracer3d/nettracer_gui.py,sha256=ZJzW3-P3m18LPhoIkCqLVTqsRb8nRFzzwYmQ-vfIs5Y,628407
10
10
  nettracer3d/network_analysis.py,sha256=kBzsVaq4dZkMe0k-VGvQIUvM-tK0ZZ8bvb-wtsugZRQ,46150
11
11
  nettracer3d/network_draw.py,sha256=F7fw6Pcf4qWOhdKwLmhwqWdschbDlHzwCVolQC9imeU,14117
12
12
  nettracer3d/node_draw.py,sha256=kZcR1PekLg0riioNeGcALIXQyZ5PtHA_9MT6z7Zovdk,10401
13
13
  nettracer3d/painting.py,sha256=K_dwngivw80r-Yyg4btKMsWGn566ZE9PnrQl986uxJE,23497
14
- nettracer3d/proximity.py,sha256=ZCfthYpQbDBwXBcVioxyzgO9PZACu6mQ8pSXdldP1TM,38592
14
+ nettracer3d/proximity.py,sha256=WaHPwE6ypeInFO_LnMT0zaVE53jX3TJx6h7nmtYtr8U,41824
15
15
  nettracer3d/run.py,sha256=xYeaAc8FCx8MuzTGyL3NR3mK7WZzffAYAH23bNRZYO4,127
16
16
  nettracer3d/segmenter.py,sha256=-Llkhp3TlAIBXZNhcfMFQRdg0vec1xtlOm0c4_bSU9U,75761
17
17
  nettracer3d/segmenter_GPU.py,sha256=optCZ_zLIfe99rgqmyKWUZlWW5TF5jEC_C3keu1m7VQ,77771
18
18
  nettracer3d/simple_network.py,sha256=dkG4jpc4zzdeuoaQobgGfL3PNo6N8dGKQ5hEEubFIvA,9947
19
19
  nettracer3d/smart_dilate.py,sha256=TvRUh6B4q4zIdCO1BWH-xgTdND5OUNmo99eyxG9oIAU,27145
20
- nettracer3d-0.9.5.dist-info/licenses/LICENSE,sha256=jnNT-yBeIAKAHpYthPvLeqCzJ6nSurgnKmloVnfsjCI,764
21
- nettracer3d-0.9.5.dist-info/METADATA,sha256=OD9KdN1NkyKgm97r4jiU-sLRE5EQkg5egzf5xolEzUI,7085
22
- nettracer3d-0.9.5.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
23
- nettracer3d-0.9.5.dist-info/entry_points.txt,sha256=Nx1rr_0QhJXDBHAQg2vcqCzLMKBzSHfwy3xwGkueVyc,53
24
- nettracer3d-0.9.5.dist-info/top_level.txt,sha256=zsYy9rZwirfCEOubolhee4TyzqBAL5gSUeFMzhFTX8c,12
25
- nettracer3d-0.9.5.dist-info/RECORD,,
20
+ nettracer3d-0.9.6.dist-info/licenses/LICENSE,sha256=jnNT-yBeIAKAHpYthPvLeqCzJ6nSurgnKmloVnfsjCI,764
21
+ nettracer3d-0.9.6.dist-info/METADATA,sha256=MHM0yBkUeOtSk_cdnD6-5KEmgS7oiQaLBBDGg4ZMbE8,7343
22
+ nettracer3d-0.9.6.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
23
+ nettracer3d-0.9.6.dist-info/entry_points.txt,sha256=Nx1rr_0QhJXDBHAQg2vcqCzLMKBzSHfwy3xwGkueVyc,53
24
+ nettracer3d-0.9.6.dist-info/top_level.txt,sha256=zsYy9rZwirfCEOubolhee4TyzqBAL5gSUeFMzhFTX8c,12
25
+ nettracer3d-0.9.6.dist-info/RECORD,,