nettracer3d 0.7.9__tar.gz → 0.8.1__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.

Potentially problematic release.


This version of nettracer3d might be problematic. Click here for more details.

Files changed (29) hide show
  1. {nettracer3d-0.7.9/src/nettracer3d.egg-info → nettracer3d-0.8.1}/PKG-INFO +5 -3
  2. {nettracer3d-0.7.9 → nettracer3d-0.8.1}/README.md +4 -2
  3. {nettracer3d-0.7.9 → nettracer3d-0.8.1}/pyproject.toml +1 -1
  4. {nettracer3d-0.7.9 → nettracer3d-0.8.1}/src/nettracer3d/community_extractor.py +17 -26
  5. nettracer3d-0.8.1/src/nettracer3d/neighborhoods.py +691 -0
  6. {nettracer3d-0.7.9 → nettracer3d-0.8.1}/src/nettracer3d/nettracer.py +230 -39
  7. {nettracer3d-0.7.9 → nettracer3d-0.8.1}/src/nettracer3d/nettracer_gui.py +1195 -202
  8. {nettracer3d-0.7.9 → nettracer3d-0.8.1}/src/nettracer3d/node_draw.py +22 -12
  9. {nettracer3d-0.7.9 → nettracer3d-0.8.1}/src/nettracer3d/proximity.py +83 -6
  10. {nettracer3d-0.7.9 → nettracer3d-0.8.1}/src/nettracer3d/segmenter.py +1 -1
  11. {nettracer3d-0.7.9 → nettracer3d-0.8.1}/src/nettracer3d/segmenter_GPU.py +1 -1
  12. {nettracer3d-0.7.9 → nettracer3d-0.8.1}/src/nettracer3d/simple_network.py +43 -25
  13. {nettracer3d-0.7.9 → nettracer3d-0.8.1/src/nettracer3d.egg-info}/PKG-INFO +5 -3
  14. nettracer3d-0.7.9/src/nettracer3d/neighborhoods.py +0 -354
  15. {nettracer3d-0.7.9 → nettracer3d-0.8.1}/LICENSE +0 -0
  16. {nettracer3d-0.7.9 → nettracer3d-0.8.1}/setup.cfg +0 -0
  17. {nettracer3d-0.7.9 → nettracer3d-0.8.1}/src/nettracer3d/__init__.py +0 -0
  18. {nettracer3d-0.7.9 → nettracer3d-0.8.1}/src/nettracer3d/excelotron.py +0 -0
  19. {nettracer3d-0.7.9 → nettracer3d-0.8.1}/src/nettracer3d/modularity.py +0 -0
  20. {nettracer3d-0.7.9 → nettracer3d-0.8.1}/src/nettracer3d/morphology.py +0 -0
  21. {nettracer3d-0.7.9 → nettracer3d-0.8.1}/src/nettracer3d/network_analysis.py +0 -0
  22. {nettracer3d-0.7.9 → nettracer3d-0.8.1}/src/nettracer3d/network_draw.py +0 -0
  23. {nettracer3d-0.7.9 → nettracer3d-0.8.1}/src/nettracer3d/run.py +0 -0
  24. {nettracer3d-0.7.9 → nettracer3d-0.8.1}/src/nettracer3d/smart_dilate.py +0 -0
  25. {nettracer3d-0.7.9 → nettracer3d-0.8.1}/src/nettracer3d.egg-info/SOURCES.txt +0 -0
  26. {nettracer3d-0.7.9 → nettracer3d-0.8.1}/src/nettracer3d.egg-info/dependency_links.txt +0 -0
  27. {nettracer3d-0.7.9 → nettracer3d-0.8.1}/src/nettracer3d.egg-info/entry_points.txt +0 -0
  28. {nettracer3d-0.7.9 → nettracer3d-0.8.1}/src/nettracer3d.egg-info/requires.txt +0 -0
  29. {nettracer3d-0.7.9 → nettracer3d-0.8.1}/src/nettracer3d.egg-info/top_level.txt +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: nettracer3d
3
- Version: 0.7.9
3
+ Version: 0.8.1
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/
@@ -73,6 +73,8 @@ NetTracer3D is free to use/fork for academic/nonprofit use so long as citation i
73
73
 
74
74
  NetTracer3D was developed by Liam McLaughlin while working under Dr. Sanjay Jain at Washington University School of Medicine.
75
75
 
76
- -- Version 0.7.9 Updates --
76
+ -- Version 0.8.1 Updates --
77
77
 
78
- * The GPU segmenter was being imported regardless of GPU status, causing the program to fail without cupy (which should be optional), fixed that.
78
+ * Added nearest neighbor evaluation function (Analysis -> Stats -> Avg Nearest Neighbor)
79
+ * Added heatmap outputs for node degrees (Analysis -> Data/Overlays -> Get Degree Information).
80
+ * Bug fixes and misc improvements.
@@ -34,6 +34,8 @@ NetTracer3D is free to use/fork for academic/nonprofit use so long as citation i
34
34
 
35
35
  NetTracer3D was developed by Liam McLaughlin while working under Dr. Sanjay Jain at Washington University School of Medicine.
36
36
 
37
- -- Version 0.7.9 Updates --
37
+ -- Version 0.8.1 Updates --
38
38
 
39
- * The GPU segmenter was being imported regardless of GPU status, causing the program to fail without cupy (which should be optional), fixed that.
39
+ * Added nearest neighbor evaluation function (Analysis -> Stats -> Avg Nearest Neighbor)
40
+ * Added heatmap outputs for node degrees (Analysis -> Data/Overlays -> Get Degree Information).
41
+ * Bug fixes and misc improvements.
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "nettracer3d"
3
- version = "0.7.9"
3
+ version = "0.8.1"
4
4
  authors = [
5
5
  { name="Liam McLaughlin", email="liamm@wustl.edu" },
6
6
  ]
@@ -492,48 +492,39 @@ def generate_distinct_colors(n_colors: int) -> List[Tuple[int, int, int]]:
492
492
  return colors
493
493
 
494
494
  def assign_node_colors(node_list: List[int], labeled_array: np.ndarray) -> Tuple[np.ndarray, Dict[int, str]]:
495
- """
496
- Assign distinct colors to nodes and create an RGBA image.
497
-
498
- Args:
499
- node_list: List of node IDs
500
- labeled_array: 3D numpy array with labels corresponding to node IDs
495
+ """fast version using lookup table approach."""
501
496
 
502
- Returns:
503
- Tuple of (RGBA-coded numpy array (H, W, D, 4), dictionary mapping nodes to color names)
504
- """
505
-
506
- # Sort communities by size (descending)
507
- sorted_nodes= sorted(node_list, reverse=True)
497
+ # Sort nodes by size (descending)
498
+ sorted_nodes = sorted(node_list, reverse=True)
508
499
 
509
500
  # Generate distinct colors
510
501
  colors = generate_distinct_colors(len(node_list))
511
- random.shuffle(colors) #Randomly sorted to make adjacent structures likely stand out
502
+ random.shuffle(colors) # Randomly sorted to make adjacent structures likely stand out
512
503
 
513
504
  # Convert RGB colors to RGBA by adding alpha channel
514
- colors_rgba = [(r, g, b, 255) for r, g, b in colors] # Full opacity for colored regions
505
+ colors_rgba = np.array([(r, g, b, 255) for r, g, b in colors], dtype=np.uint8)
515
506
 
516
- # Create mapping from community to color
507
+ # Create mapping from node to color
517
508
  node_to_color = {node: colors_rgba[i] for i, node in enumerate(sorted_nodes)}
518
509
 
519
- # Create RGBA array (initialize with transparent background)
520
- rgba_array = np.zeros((*labeled_array.shape, 4), dtype=np.uint8)
510
+ # Create lookup table
511
+ max_label = max(max(labeled_array.flat), max(node_list) if node_list else 0)
512
+ color_lut = np.zeros((max_label + 1, 4), dtype=np.uint8) # Transparent by default
521
513
 
522
- # Assign colors to each voxel based on its label
523
- for label in np.unique(labeled_array):
524
- if label in node_to_color: # Skip background (usually label 0)
525
- mask = labeled_array == label
526
- for i in range(4): # RGBA channels
527
- rgba_array[mask, i] = node_to_color[label][i]
528
-
529
- # Convert the RGB portion of community_to_color back to RGB for color naming
514
+ for node_id, color in node_to_color.items():
515
+ color_lut[node_id] = color
516
+
517
+ # Single vectorized operation - eliminates all loops!
518
+ rgba_array = color_lut[labeled_array]
519
+
520
+ # Convert colors for naming
530
521
  node_to_color_rgb = {k: tuple(v[:3]) for k, v in node_to_color.items()}
531
522
  node_to_color_names = convert_node_colors_to_names(node_to_color_rgb)
532
523
 
533
524
  return rgba_array, node_to_color_names
534
525
 
535
526
  def assign_community_colors(community_dict: Dict[int, int], labeled_array: np.ndarray) -> Tuple[np.ndarray, Dict[int, str]]:
536
- """Ultra-fast version using lookup table approach."""
527
+ """fast version using lookup table approach."""
537
528
 
538
529
  # Same setup as before
539
530
  communities = set(community_dict.values())