nettracer3d 0.8.3__py3-none-any.whl → 0.8.5__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.
@@ -223,6 +223,7 @@ def dilate_3D_dt(array, search_distance, xy_scaling=1.0, z_scaling=1.0, GPU = Fa
223
223
  inv, indices = compute_distance_transform_GPU(inv, return_dists = True, sampling = [z_scaling, xy_scaling, xy_scaling])
224
224
  except:
225
225
  print("Failed, attempting on CPU...")
226
+ cleanup()
226
227
  #Who would have seen this coming?:
227
228
  inv, indices = compute_distance_transform(inv, return_dists = True, sampling = [z_scaling, xy_scaling, xy_scaling])
228
229
  else:
@@ -251,15 +252,37 @@ def process_chunk(start_idx, end_idx, nodes, ring_mask, nearest_label_indices):
251
252
  nodes_chunk = nodes[:, start_idx:end_idx, :]
252
253
  ring_mask_chunk = ring_mask[:, start_idx:end_idx, :]
253
254
  dilated_nodes_with_labels_chunk = np.copy(nodes_chunk)
255
+
256
+ # Get all ring indices at once
254
257
  ring_indices = np.argwhere(ring_mask_chunk)
255
-
256
- for index in ring_indices:
257
- z, y, x = index
258
- nearest_z, nearest_y, nearest_x = nearest_label_indices[:, z, y + start_idx, x]
259
- try: #There was an index error here once on the highest val of the second axis. I could not understand why because it usually doesnt hence the try block.
260
- dilated_nodes_with_labels_chunk[z, y, x] = nodes[nearest_z, nearest_y, nearest_x]
261
- except:
262
- pass
258
+
259
+ if len(ring_indices) > 0:
260
+ # Extract coordinates
261
+ z_coords = ring_indices[:, 0]
262
+ y_coords = ring_indices[:, 1]
263
+ x_coords = ring_indices[:, 2]
264
+
265
+ # Get nearest label coordinates (adjust y for chunk offset)
266
+ nearest_coords = nearest_label_indices[:, z_coords, y_coords + start_idx, x_coords]
267
+ nearest_z = nearest_coords[0, :]
268
+ nearest_y = nearest_coords[1, :]
269
+ nearest_x = nearest_coords[2, :]
270
+
271
+ # Vectorized assignment
272
+ try:
273
+ dilated_nodes_with_labels_chunk[z_coords, y_coords, x_coords] = \
274
+ nodes[nearest_z, nearest_y, nearest_x]
275
+ except IndexError:
276
+ # Fallback for any problematic indices
277
+ valid_mask = (nearest_z < nodes.shape[0]) & \
278
+ (nearest_y < nodes.shape[1]) & \
279
+ (nearest_x < nodes.shape[2]) & \
280
+ (nearest_z >= 0) & (nearest_y >= 0) & (nearest_x >= 0)
281
+
282
+ valid_indices = valid_mask.nonzero()[0]
283
+ if len(valid_indices) > 0:
284
+ dilated_nodes_with_labels_chunk[z_coords[valid_indices], y_coords[valid_indices], x_coords[valid_indices]] = \
285
+ nodes[nearest_z[valid_indices], nearest_y[valid_indices], nearest_x[valid_indices]]
263
286
 
264
287
  return dilated_nodes_with_labels_chunk
265
288
 
@@ -506,6 +529,7 @@ def compute_distance_transform_GPU(nodes, return_dists = False, sampling = [1, 1
506
529
 
507
530
 
508
531
  def compute_distance_transform(nodes, return_dists = False, sampling = [1, 1, 1]):
532
+ #print("(Now doing distance transform...)")
509
533
  is_pseudo_3d = nodes.shape[0] == 1
510
534
  if is_pseudo_3d:
511
535
  nodes = np.squeeze(nodes) # Convert to 2D for processing
@@ -548,13 +572,15 @@ def compute_distance_transform_distance_GPU(nodes, sampling = [1, 1, 1]):
548
572
  distance = cp.asnumpy(distance)
549
573
 
550
574
  if is_pseudo_3d:
551
- np.expand_dims(distance, axis = 0)
575
+ distance = np.expand_dims(distance, axis = 0)
552
576
 
553
577
  return distance
554
578
 
555
579
 
556
580
  def compute_distance_transform_distance(nodes, sampling = [1, 1, 1]):
557
581
 
582
+ #print("(Now doing distance transform...)")
583
+
558
584
  is_pseudo_3d = nodes.shape[0] == 1
559
585
  if is_pseudo_3d:
560
586
  nodes = np.squeeze(nodes) # Convert to 2D for processing
@@ -563,7 +589,7 @@ def compute_distance_transform_distance(nodes, sampling = [1, 1, 1]):
563
589
  # Fallback to CPU if there's an issue with GPU computation
564
590
  distance = distance_transform_edt(nodes, sampling = sampling)
565
591
  if is_pseudo_3d:
566
- np.expand_dims(distance, axis = 0)
592
+ distance = np.expand_dims(distance, axis = 0)
567
593
  return distance
568
594
 
569
595
 
@@ -621,6 +647,14 @@ def catch_memory(e):
621
647
  downsample_needed = (memory_required/total_memory)
622
648
  return (downsample_needed)
623
649
 
650
+ def cleanup():
651
+
652
+ try:
653
+ cp.get_default_memory_pool().free_all_blocks()
654
+ except:
655
+ pass
656
+
657
+
624
658
 
625
659
  if __name__ == "__main__":
626
660
  nodes = input("Labelled Nodes tiff?: ")
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: nettracer3d
3
- Version: 0.8.3
3
+ Version: 0.8.5
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/
@@ -104,9 +104,12 @@ This gui is built from the PyQt6 package and therefore may not function on docke
104
104
  For a (slightly outdated) video tutorial on using the GUI: https://www.youtube.com/watch?v=cRatn5VTWDY
105
105
 
106
106
  NetTracer3D is free to use/fork for academic/nonprofit use so long as citation is provided, and is available for commercial use at a fee (see license file for information).
107
+ The current citation is here:
108
+
109
+ McLaughlin, L., Zhang, B., Sharma, S. et al. Three dimensional multiscalar neurovascular nephron connectivity map of the human kidney across the lifespan. Nat Commun 16, 5161 (2025). https://doi.org/10.1038/s41467-025-60435-8
107
110
 
108
111
  NetTracer3D was developed by Liam McLaughlin while working under Dr. Sanjay Jain at Washington University School of Medicine.
109
112
 
110
- -- Version 0.8.3 Updates --
113
+ -- Version 0.8.5 Updates --
111
114
 
112
- * Added better color legend display
115
+ * See Documentation Once Updated
@@ -0,0 +1,25 @@
1
+ nettracer3d/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
2
+ nettracer3d/cellpose_manager.py,sha256=qZpTxSkmPb38Pru8TmjJ88xxcD_wM02EfJB5Mw9Xx4Y,6021
3
+ nettracer3d/community_extractor.py,sha256=QG2v2y9lKb07LRU0zXCAlA_z-96BNqLHh5xP17KLmYA,28147
4
+ nettracer3d/excelotron.py,sha256=X9v_mte8gJBPNGdj6NJNUYja0Z6eorVoKAFx4nHiMnU,72058
5
+ nettracer3d/modularity.py,sha256=O9OeKbjD3v6gSFz9K2GzP6LsxlpQaPfeJbM1pyIEigw,21788
6
+ nettracer3d/morphology.py,sha256=jyDjYzrZ4LvI5jOyw8DLsxmo-i5lpqHsejYpW7Tq7Mo,19786
7
+ nettracer3d/neighborhoods.py,sha256=VWubD5CBu9aNPhUea7FbAk9aTOq0FLKR9y-1VT7YkAc,39677
8
+ nettracer3d/nettracer.py,sha256=TEV-nDmkcGP3UjWEor1LtEwm5mFBQu2nB0VRyz9Lt08,253649
9
+ nettracer3d/nettracer_gui.py,sha256=Uf8a9DkK475sAwOq45S1okuiQtVwU7_Ovv8NuWDQ99M,538823
10
+ nettracer3d/network_analysis.py,sha256=kBzsVaq4dZkMe0k-VGvQIUvM-tK0ZZ8bvb-wtsugZRQ,46150
11
+ nettracer3d/network_draw.py,sha256=F7fw6Pcf4qWOhdKwLmhwqWdschbDlHzwCVolQC9imeU,14117
12
+ nettracer3d/node_draw.py,sha256=kZcR1PekLg0riioNeGcALIXQyZ5PtHA_9MT6z7Zovdk,10401
13
+ nettracer3d/painting.py,sha256=_8QyiDhU0T4B6virPxfm1HGo-XGgDTavuQx_pbs5_Tc,15916
14
+ nettracer3d/proximity.py,sha256=bTaucn_InQ-v1GIk8ug-dXvDhIO59rnBMl5nIwAmNyw,35335
15
+ nettracer3d/run.py,sha256=xYeaAc8FCx8MuzTGyL3NR3mK7WZzffAYAH23bNRZYO4,127
16
+ nettracer3d/segmenter.py,sha256=O3xjCimPwoL8LM1w4cKVTB7saY-UptFuYC8qOIo3iWg,61637
17
+ nettracer3d/segmenter_GPU.py,sha256=3CJLXCiySZP2dJbkpfBoXwAYbV4TnvIYAm6oQv-T-y4,63479
18
+ nettracer3d/simple_network.py,sha256=dkG4jpc4zzdeuoaQobgGfL3PNo6N8dGKQ5hEEubFIvA,9947
19
+ nettracer3d/smart_dilate.py,sha256=TvRUh6B4q4zIdCO1BWH-xgTdND5OUNmo99eyxG9oIAU,27145
20
+ nettracer3d-0.8.5.dist-info/licenses/LICENSE,sha256=jnNT-yBeIAKAHpYthPvLeqCzJ6nSurgnKmloVnfsjCI,764
21
+ nettracer3d-0.8.5.dist-info/METADATA,sha256=AiCE19SzTrqneRhGlwFase_EbjCaiLTn0FOGDmHIN0Q,7008
22
+ nettracer3d-0.8.5.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
23
+ nettracer3d-0.8.5.dist-info/entry_points.txt,sha256=Nx1rr_0QhJXDBHAQg2vcqCzLMKBzSHfwy3xwGkueVyc,53
24
+ nettracer3d-0.8.5.dist-info/top_level.txt,sha256=zsYy9rZwirfCEOubolhee4TyzqBAL5gSUeFMzhFTX8c,12
25
+ nettracer3d-0.8.5.dist-info/RECORD,,
@@ -1,7 +1,5 @@
1
- NetTracer3D is freely available for academic and nonprofit use and can be obtained from Liam McLaughlin (boom2449@gmail.com) OR at pip (pip install nettracer3d), provided that the following citation is included in any abstract, paper, or presentation utilizing NetTracer3D.
1
+ NetTracer3D is freely available for academic and nonprofit use and can be obtained from Liam McLaughlin (boom2449@gmail.com) OR at pip (pip install nettracer3d), provided that the following citation is included in any abstract, paper, or presentation utilizing NetTracer3D:
2
2
 
3
- Three Dimensional Multiscalar Neurovascular Nephron Connectivity Map of the Human Kidney Across the Lifespan
4
- Liam McLaughlin, Bo Zhang, Siddharth Sharma, Amanda L. Knoten, Madhurima Kaushal, Jeffrey M. Purkerson, Heidy Huyck, Gloria S. Pryhuber, Joseph P. Gaut, Sanjay Jain
5
- bioRxiv 2024.07.29.605633; doi: https://doi.org/10.1101/2024.07.29.605633
3
+ McLaughlin, L., Zhang, B., Sharma, S. et al. Three dimensional multiscalar neurovascular nephron connectivity map of the human kidney across the lifespan. Nat Commun 16, 5161 (2025). https://doi.org/10.1038/s41467-025-60435-8
6
4
 
7
5
  Commercial use is available for a fee. Copyright © is held by Washington University. Please direct all commercial requests for licensing, information, and limited evaluation copies to Washington University's Office of Technology Management at OTM@wustl.edu.
@@ -1,24 +0,0 @@
1
- nettracer3d/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
2
- nettracer3d/cellpose_manager.py,sha256=qZpTxSkmPb38Pru8TmjJ88xxcD_wM02EfJB5Mw9Xx4Y,6021
3
- nettracer3d/community_extractor.py,sha256=08WWUO94ToZFglBU9X1L-T-WJuaIa-8t35-52kN4i6g,28167
4
- nettracer3d/excelotron.py,sha256=lS5vnpoOGZWp7fdqVpTPqeC-mUKrfwDrWHfx4PQ7Uzg,71384
5
- nettracer3d/modularity.py,sha256=O9OeKbjD3v6gSFz9K2GzP6LsxlpQaPfeJbM1pyIEigw,21788
6
- nettracer3d/morphology.py,sha256=jyDjYzrZ4LvI5jOyw8DLsxmo-i5lpqHsejYpW7Tq7Mo,19786
7
- nettracer3d/neighborhoods.py,sha256=ac_gjN7pUlXZZpMSZnUVErKbKtSlInxX2dHe22oDNJA,34532
8
- nettracer3d/nettracer.py,sha256=L7FGwgiuzIloFBcQmR7UNYGicJMHgHL-etIgogCrRE0,235084
9
- nettracer3d/nettracer_gui.py,sha256=QRZEEazgO-8jLjZu29ZDD2MLnC4rObISbZgLFiQxgbE,526421
10
- nettracer3d/network_analysis.py,sha256=yUEzy4hBDTuZvXwFuJWdIQcxqPW4z67APe4zcjCjDW8,43613
11
- nettracer3d/network_draw.py,sha256=F7fw6Pcf4qWOhdKwLmhwqWdschbDlHzwCVolQC9imeU,14117
12
- nettracer3d/node_draw.py,sha256=LoeTFeOcrX6kPquZvCqYnMW-jDd9oqKM27r-rTlKEtY,10274
13
- nettracer3d/proximity.py,sha256=mRkug_y6fbqq_pOYTkF5uOoiRhvYv2e_QFC92ZTraYE,38110
14
- nettracer3d/run.py,sha256=xYeaAc8FCx8MuzTGyL3NR3mK7WZzffAYAH23bNRZYO4,127
15
- nettracer3d/segmenter.py,sha256=VatOSpc41lxhPuYLTTejCxG1CcwP5hwiQ3ZFK9OBavA,60115
16
- nettracer3d/segmenter_GPU.py,sha256=sFVmz_cYIVOQqnfFV3peK9hzb6IoIV5WDQHH9Lws96I,53915
17
- nettracer3d/simple_network.py,sha256=dkG4jpc4zzdeuoaQobgGfL3PNo6N8dGKQ5hEEubFIvA,9947
18
- nettracer3d/smart_dilate.py,sha256=DOEOQq9ig6-AO4MpqAG0CqrGDFqw5_UBeqfSedqHk28,25933
19
- nettracer3d-0.8.3.dist-info/licenses/LICENSE,sha256=gM207DhJjWrxLuEWXl0Qz5ISbtWDmADfjHp3yC2XISs,888
20
- nettracer3d-0.8.3.dist-info/METADATA,sha256=yVQGa_obriAzfkWCzXCS0EYtxBRD8UmHL8OWmFIxFJ8,6750
21
- nettracer3d-0.8.3.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
22
- nettracer3d-0.8.3.dist-info/entry_points.txt,sha256=Nx1rr_0QhJXDBHAQg2vcqCzLMKBzSHfwy3xwGkueVyc,53
23
- nettracer3d-0.8.3.dist-info/top_level.txt,sha256=zsYy9rZwirfCEOubolhee4TyzqBAL5gSUeFMzhFTX8c,12
24
- nettracer3d-0.8.3.dist-info/RECORD,,