nettracer3d 0.6.5__py3-none-any.whl → 0.6.7__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
@@ -64,13 +64,13 @@ def reslice_3d_array(args):
64
64
 
65
65
 
66
66
 
67
- def _get_node_node_dict(label_array, label, dilate_xy, dilate_z):
67
+ def _get_node_node_dict(label_array, label, dilate_xy, dilate_z, fastdil = False, xy_scale = 1, z_scale = 1, search = 0):
68
68
  """Internal method used for the secondary algorithm to find which nodes interact
69
69
  with which other nodes based on proximity."""
70
70
 
71
71
  # Create a boolean mask where elements with the specified label are True
72
72
  binary_array = label_array == label
73
- binary_array = nettracer.dilate_3D_recursive(binary_array, dilate_xy, dilate_xy, dilate_z) #Dilate the label to see where the dilated label overlaps
73
+ binary_array = nettracer.dilate(binary_array, search, xy_scale, z_scale, fast_dil = fastdil, dilate_xy = dilate_xy, dilate_z = dilate_z) #Dilate the label to see where the dilated label overlaps
74
74
  label_array = label_array * binary_array # Filter the labels by the node in question
75
75
  label_array = label_array.flatten() # Convert 3d array to 1d array
76
76
  label_array = nettracer.remove_zeros(label_array) # Remove zeros
@@ -82,7 +82,7 @@ def _get_node_node_dict(label_array, label, dilate_xy, dilate_z):
82
82
  def process_label(args):
83
83
  """Modified to use pre-computed bounding boxes instead of argwhere"""
84
84
  nodes, label, dilate_xy, dilate_z, array_shape, bounding_boxes = args
85
- print(f"Processing node {label}")
85
+ #print(f"Processing node {label}")
86
86
 
87
87
  # Get the pre-computed bounding box for this label
88
88
  slice_obj = bounding_boxes[label-1] # -1 because label numbers start at 1
@@ -97,10 +97,11 @@ def process_label(args):
97
97
  return label, sub_nodes
98
98
 
99
99
 
100
- def create_node_dictionary(nodes, num_nodes, dilate_xy, dilate_z, targets=None):
101
- """Modified to pre-compute all bounding boxes using find_objects"""
100
+ def create_node_dictionary(nodes, num_nodes, dilate_xy, dilate_z, targets=None, fastdil = False, xy_scale = 1, z_scale = 1, search = 0):
101
+ """pre-compute all bounding boxes using find_objects"""
102
102
  node_dict = {}
103
103
  array_shape = nodes.shape
104
+
104
105
 
105
106
  # Get all bounding boxes at once
106
107
  bounding_boxes = ndimage.find_objects(nodes)
@@ -118,17 +119,17 @@ def create_node_dictionary(nodes, num_nodes, dilate_xy, dilate_z, targets=None):
118
119
 
119
120
  # Process results in parallel
120
121
  for label, sub_nodes in results:
121
- executor.submit(create_dict_entry, node_dict, label, sub_nodes, dilate_xy, dilate_z)
122
+ executor.submit(create_dict_entry, node_dict, label, sub_nodes, dilate_xy, dilate_z, fastdil = fastdil, xy_scale = xy_scale, z_scale = z_scale, search = search)
122
123
 
123
124
  return node_dict
124
125
 
125
- def create_dict_entry(node_dict, label, sub_nodes, dilate_xy, dilate_z):
126
+ def create_dict_entry(node_dict, label, sub_nodes, dilate_xy, dilate_z, fastdil = False, xy_scale = 1, z_scale = 1, search = 0):
126
127
  """Internal method used for the secondary algorithm to pass around args in parallel."""
127
128
 
128
129
  if label is None:
129
130
  pass
130
131
  else:
131
- node_dict[label] = _get_node_node_dict(sub_nodes, label, dilate_xy, dilate_z)
132
+ node_dict[label] = _get_node_node_dict(sub_nodes, label, dilate_xy, dilate_z, fastdil = fastdil, xy_scale = xy_scale, z_scale = z_scale, search = search)
132
133
 
133
134
  def find_shared_value_pairs(input_dict):
134
135
  """Internal method used for the secondary algorithm to look through discrete