nettracer3d 0.7.5__tar.gz → 0.7.6__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 (26) hide show
  1. {nettracer3d-0.7.5/src/nettracer3d.egg-info → nettracer3d-0.7.6}/PKG-INFO +3 -8
  2. {nettracer3d-0.7.5 → nettracer3d-0.7.6}/README.md +3 -8
  3. {nettracer3d-0.7.5 → nettracer3d-0.7.6}/pyproject.toml +1 -1
  4. {nettracer3d-0.7.5 → nettracer3d-0.7.6}/src/nettracer3d/nettracer_gui.py +99 -85
  5. {nettracer3d-0.7.5 → nettracer3d-0.7.6/src/nettracer3d.egg-info}/PKG-INFO +3 -8
  6. {nettracer3d-0.7.5 → nettracer3d-0.7.6}/LICENSE +0 -0
  7. {nettracer3d-0.7.5 → nettracer3d-0.7.6}/setup.cfg +0 -0
  8. {nettracer3d-0.7.5 → nettracer3d-0.7.6}/src/nettracer3d/__init__.py +0 -0
  9. {nettracer3d-0.7.5 → nettracer3d-0.7.6}/src/nettracer3d/community_extractor.py +0 -0
  10. {nettracer3d-0.7.5 → nettracer3d-0.7.6}/src/nettracer3d/modularity.py +0 -0
  11. {nettracer3d-0.7.5 → nettracer3d-0.7.6}/src/nettracer3d/morphology.py +0 -0
  12. {nettracer3d-0.7.5 → nettracer3d-0.7.6}/src/nettracer3d/nettracer.py +0 -0
  13. {nettracer3d-0.7.5 → nettracer3d-0.7.6}/src/nettracer3d/network_analysis.py +0 -0
  14. {nettracer3d-0.7.5 → nettracer3d-0.7.6}/src/nettracer3d/network_draw.py +0 -0
  15. {nettracer3d-0.7.5 → nettracer3d-0.7.6}/src/nettracer3d/node_draw.py +0 -0
  16. {nettracer3d-0.7.5 → nettracer3d-0.7.6}/src/nettracer3d/proximity.py +0 -0
  17. {nettracer3d-0.7.5 → nettracer3d-0.7.6}/src/nettracer3d/run.py +0 -0
  18. {nettracer3d-0.7.5 → nettracer3d-0.7.6}/src/nettracer3d/segmenter.py +0 -0
  19. {nettracer3d-0.7.5 → nettracer3d-0.7.6}/src/nettracer3d/segmenter_GPU.py +0 -0
  20. {nettracer3d-0.7.5 → nettracer3d-0.7.6}/src/nettracer3d/simple_network.py +0 -0
  21. {nettracer3d-0.7.5 → nettracer3d-0.7.6}/src/nettracer3d/smart_dilate.py +0 -0
  22. {nettracer3d-0.7.5 → nettracer3d-0.7.6}/src/nettracer3d.egg-info/SOURCES.txt +0 -0
  23. {nettracer3d-0.7.5 → nettracer3d-0.7.6}/src/nettracer3d.egg-info/dependency_links.txt +0 -0
  24. {nettracer3d-0.7.5 → nettracer3d-0.7.6}/src/nettracer3d.egg-info/entry_points.txt +0 -0
  25. {nettracer3d-0.7.5 → nettracer3d-0.7.6}/src/nettracer3d.egg-info/requires.txt +0 -0
  26. {nettracer3d-0.7.5 → nettracer3d-0.7.6}/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.5
3
+ Version: 0.7.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/
@@ -72,11 +72,6 @@ NetTracer3D is free to use/fork for academic/nonprofit use so long as citation i
72
72
 
73
73
  NetTracer3D was developed by Liam McLaughlin while working under Dr. Sanjay Jain at Washington University School of Medicine.
74
74
 
75
- -- Version 0.7.5 Updates --
75
+ -- Version 0.7.6 Updates --
76
76
 
77
- * Bug fixes
78
- * The segmenter GPU option has been updated to include 2D segmentation and to also be able to load/save models.
79
- * A new function (Analyze -> Stats -> Calculate Generic Network Histograms has been added (gives a few histograms about the network and their corresponding tables. Previously stats mostly gave averages).
80
- * The function 'Analyze -> Data/Overlays -> Get Hub Information' now looks for the upper hubs unique to each separate network component. It will also ignore smaller components that have too few nodes to be reasonably considered having hubs relative to the threshold the user sets.
81
- * The function to split non-connected nodes has been improved a bit (its faster albeit still slowish - its a tough operation)
82
- * Removed python-louvain dependence, now uses networkx for Louvain partitioning. (On top of this, now the user can set the random seed they desire for partitioning for reproducibility purposes).
77
+ * Bug Fixes
@@ -34,11 +34,6 @@ 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.5 Updates --
38
-
39
- * Bug fixes
40
- * The segmenter GPU option has been updated to include 2D segmentation and to also be able to load/save models.
41
- * A new function (Analyze -> Stats -> Calculate Generic Network Histograms has been added (gives a few histograms about the network and their corresponding tables. Previously stats mostly gave averages).
42
- * The function 'Analyze -> Data/Overlays -> Get Hub Information' now looks for the upper hubs unique to each separate network component. It will also ignore smaller components that have too few nodes to be reasonably considered having hubs relative to the threshold the user sets.
43
- * The function to split non-connected nodes has been improved a bit (its faster albeit still slowish - its a tough operation)
44
- * Removed python-louvain dependence, now uses networkx for Louvain partitioning. (On top of this, now the user can set the random seed they desire for partitioning for reproducibility purposes).
37
+ -- Version 0.7.6 Updates --
38
+
39
+ * Bug Fixes
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "nettracer3d"
3
- version = "0.7.5"
3
+ version = "0.7.6"
4
4
  authors = [
5
5
  { name="Liam McLaughlin", email="liamm@wustl.edu" },
6
6
  ]
@@ -1448,7 +1448,7 @@ class ImageViewerWindow(QMainWindow):
1448
1448
 
1449
1449
  print("Note, this method is a tad slow...")
1450
1450
 
1451
- def separate_nontouching_objects(input_array):
1451
+ def separate_nontouching_objects(input_array, max_val = 0):
1452
1452
  """
1453
1453
  Efficiently separate non-touching objects in a labeled array.
1454
1454
 
@@ -1483,7 +1483,7 @@ class ImageViewerWindow(QMainWindow):
1483
1483
 
1484
1484
  # Step 3: Create a new output array with unique labels for each connected component
1485
1485
  output_array = np.zeros_like(input_array)
1486
- next_label = 1
1486
+ next_label = 1 + max_val
1487
1487
 
1488
1488
  # Map of (original_label, connected_component) -> new_unique_label
1489
1489
  unique_label_map = {}
@@ -1512,9 +1512,14 @@ class ImageViewerWindow(QMainWindow):
1512
1512
 
1513
1513
  # Get non-highlighted part of the array
1514
1514
  non_highlighted = my_network.nodes * (~self.highlight_overlay)
1515
+
1516
+ if (highlighted_nodes==non_highlighted).all():
1517
+ max_val = 0
1518
+ else:
1519
+ max_val = np.max(non_highlighted)
1515
1520
 
1516
1521
  # Process highlighted part
1517
- processed_highlights = separate_nontouching_objects(highlighted_nodes)
1522
+ processed_highlights = separate_nontouching_objects(highlighted_nodes, max_val)
1518
1523
 
1519
1524
  # Combine back with non-highlighted parts
1520
1525
  my_network.nodes = non_highlighted + processed_highlights
@@ -1534,9 +1539,14 @@ class ImageViewerWindow(QMainWindow):
1534
1539
 
1535
1540
  # Get non-highlighted part of the array
1536
1541
  non_highlighted = my_network.edges * (~self.highlight_overlay)
1542
+
1543
+ if (highlighted_nodes==non_highlighted).all():
1544
+ max_val = 0
1545
+ else:
1546
+ max_val = np.max(non_highlighted)
1537
1547
 
1538
1548
  # Process highlighted part
1539
- processed_highlights = separate_nontouching_objects(highlighted_edges)
1549
+ processed_highlights = separate_nontouching_objects(highlighted_edges, max_val)
1540
1550
 
1541
1551
  # Combine back with non-highlighted parts
1542
1552
  my_network.edges = non_highlighted + processed_highlights
@@ -1545,7 +1555,7 @@ class ImageViewerWindow(QMainWindow):
1545
1555
 
1546
1556
  self.highlight_overlay = None
1547
1557
  self.update_display()
1548
- print("Network is not updated automatically, please recompute if necessary. Identities are not automatically updated.")
1558
+ print("Network is not updated automatically, please recompute if necessary - this method has a high chance of disrupting the network. Identities are not automatically updated.")
1549
1559
  self.show_centroid_dialog()
1550
1560
  except Exception as e:
1551
1561
  print(f"Error separating: {e}")
@@ -2837,99 +2847,103 @@ class ImageViewerWindow(QMainWindow):
2837
2847
 
2838
2848
  """from networkx documentation"""
2839
2849
 
2840
- G = my_network.network
2850
+ try:
2841
2851
 
2842
- shortest_path_lengths = dict(nx.all_pairs_shortest_path_length(G))
2843
- diameter = max(nx.eccentricity(G, sp=shortest_path_lengths).values())
2844
- # We know the maximum shortest path length (the diameter), so create an array
2845
- # to store values from 0 up to (and including) diameter
2846
- path_lengths = np.zeros(diameter + 1, dtype=int)
2852
+ G = my_network.network
2847
2853
 
2854
+ shortest_path_lengths = dict(nx.all_pairs_shortest_path_length(G))
2855
+ diameter = max(nx.eccentricity(G, sp=shortest_path_lengths).values())
2856
+ # We know the maximum shortest path length (the diameter), so create an array
2857
+ # to store values from 0 up to (and including) diameter
2858
+ path_lengths = np.zeros(diameter + 1, dtype=int)
2848
2859
 
2849
2860
 
2850
- # Extract the frequency of shortest path lengths between two nodes
2851
- for pls in shortest_path_lengths.values():
2852
- pl, cnts = np.unique(list(pls.values()), return_counts=True)
2853
- path_lengths[pl] += cnts
2854
2861
 
2855
- # Express frequency distribution as a percentage (ignoring path lengths of 0)
2856
- freq_percent = 100 * path_lengths[1:] / path_lengths[1:].sum()
2862
+ # Extract the frequency of shortest path lengths between two nodes
2863
+ for pls in shortest_path_lengths.values():
2864
+ pl, cnts = np.unique(list(pls.values()), return_counts=True)
2865
+ path_lengths[pl] += cnts
2857
2866
 
2858
- # Plot the frequency distribution (ignoring path lengths of 0) as a percentage
2859
- fig, ax = plt.subplots(figsize=(15, 8))
2860
- ax.bar(np.arange(1, diameter + 1), height=freq_percent)
2861
- ax.set_title(
2862
- "Distribution of shortest path length in G", fontdict={"size": 35}, loc="center"
2863
- )
2864
- ax.set_xlabel("Shortest Path Length", fontdict={"size": 22})
2865
- ax.set_ylabel("Frequency (%)", fontdict={"size": 22})
2866
-
2867
- plt.show()
2868
- freq_dict = {freq: length for length, freq in enumerate(freq_percent, start=1)}
2869
- self.format_for_upperright_table(freq_dict, metric='Frequency (%)', value='Shortest Path Length', title="Distribution of shortest path length in G")
2870
-
2871
- degree_centrality = nx.centrality.degree_centrality(G)
2872
- plt.figure(figsize=(15, 8))
2873
- plt.hist(degree_centrality.values(), bins=25)
2874
- plt.xticks(ticks=[0, 0.025, 0.05, 0.1, 0.15, 0.2]) # set the x axis ticks
2875
- plt.title("Degree Centrality Histogram ", fontdict={"size": 35}, loc="center")
2876
- plt.xlabel("Degree Centrality", fontdict={"size": 20})
2877
- plt.ylabel("Counts", fontdict={"size": 20})
2878
- plt.show()
2879
- self.format_for_upperright_table(degree_centrality, metric='Node', value='Degree Centrality', title="Degree Centrality Table")
2880
-
2881
-
2882
- betweenness_centrality = nx.centrality.betweenness_centrality(
2883
- G
2884
- )
2885
- plt.figure(figsize=(15, 8))
2886
- plt.hist(betweenness_centrality.values(), bins=100)
2887
- plt.xticks(ticks=[0, 0.02, 0.1, 0.2, 0.3, 0.4, 0.5]) # set the x axis ticks
2888
- plt.title("Betweenness Centrality Histogram ", fontdict={"size": 35}, loc="center")
2889
- plt.xlabel("Betweenness Centrality", fontdict={"size": 20})
2890
- plt.ylabel("Counts", fontdict={"size": 20})
2891
- plt.show()
2892
- self.format_for_upperright_table(betweenness_centrality, metric='Node', value='Betweenness Centrality', title="Betweenness Centrality Table")
2893
-
2894
-
2895
- closeness_centrality = nx.centrality.closeness_centrality(
2896
- G
2897
- )
2898
- plt.figure(figsize=(15, 8))
2899
- plt.hist(closeness_centrality.values(), bins=60)
2900
- plt.title("Closeness Centrality Histogram ", fontdict={"size": 35}, loc="center")
2901
- plt.xlabel("Closeness Centrality", fontdict={"size": 20})
2902
- plt.ylabel("Counts", fontdict={"size": 20})
2903
- plt.show()
2904
- self.format_for_upperright_table(closeness_centrality, metric='Node', value='Closeness Centrality', title="Closeness Centrality Table")
2867
+ # Express frequency distribution as a percentage (ignoring path lengths of 0)
2868
+ freq_percent = 100 * path_lengths[1:] / path_lengths[1:].sum()
2905
2869
 
2870
+ # Plot the frequency distribution (ignoring path lengths of 0) as a percentage
2871
+ fig, ax = plt.subplots(figsize=(15, 8))
2872
+ ax.bar(np.arange(1, diameter + 1), height=freq_percent)
2873
+ ax.set_title(
2874
+ "Distribution of shortest path length in G", fontdict={"size": 35}, loc="center"
2875
+ )
2876
+ ax.set_xlabel("Shortest Path Length", fontdict={"size": 22})
2877
+ ax.set_ylabel("Frequency (%)", fontdict={"size": 22})
2878
+
2879
+ plt.show()
2880
+ freq_dict = {freq: length for length, freq in enumerate(freq_percent, start=1)}
2881
+ self.format_for_upperright_table(freq_dict, metric='Frequency (%)', value='Shortest Path Length', title="Distribution of shortest path length in G")
2882
+
2883
+ degree_centrality = nx.centrality.degree_centrality(G)
2884
+ plt.figure(figsize=(15, 8))
2885
+ plt.hist(degree_centrality.values(), bins=25)
2886
+ plt.xticks(ticks=[0, 0.025, 0.05, 0.1, 0.15, 0.2]) # set the x axis ticks
2887
+ plt.title("Degree Centrality Histogram ", fontdict={"size": 35}, loc="center")
2888
+ plt.xlabel("Degree Centrality", fontdict={"size": 20})
2889
+ plt.ylabel("Counts", fontdict={"size": 20})
2890
+ plt.show()
2891
+ self.format_for_upperright_table(degree_centrality, metric='Node', value='Degree Centrality', title="Degree Centrality Table")
2892
+
2893
+
2894
+ betweenness_centrality = nx.centrality.betweenness_centrality(
2895
+ G
2896
+ )
2897
+ plt.figure(figsize=(15, 8))
2898
+ plt.hist(betweenness_centrality.values(), bins=100)
2899
+ plt.xticks(ticks=[0, 0.02, 0.1, 0.2, 0.3, 0.4, 0.5]) # set the x axis ticks
2900
+ plt.title("Betweenness Centrality Histogram ", fontdict={"size": 35}, loc="center")
2901
+ plt.xlabel("Betweenness Centrality", fontdict={"size": 20})
2902
+ plt.ylabel("Counts", fontdict={"size": 20})
2903
+ plt.show()
2904
+ self.format_for_upperright_table(betweenness_centrality, metric='Node', value='Betweenness Centrality', title="Betweenness Centrality Table")
2905
+
2906
+
2907
+ closeness_centrality = nx.centrality.closeness_centrality(
2908
+ G
2909
+ )
2910
+ plt.figure(figsize=(15, 8))
2911
+ plt.hist(closeness_centrality.values(), bins=60)
2912
+ plt.title("Closeness Centrality Histogram ", fontdict={"size": 35}, loc="center")
2913
+ plt.xlabel("Closeness Centrality", fontdict={"size": 20})
2914
+ plt.ylabel("Counts", fontdict={"size": 20})
2915
+ plt.show()
2916
+ self.format_for_upperright_table(closeness_centrality, metric='Node', value='Closeness Centrality', title="Closeness Centrality Table")
2906
2917
 
2907
- eigenvector_centrality = nx.centrality.eigenvector_centrality(
2908
- G
2909
- )
2910
- plt.figure(figsize=(15, 8))
2911
- plt.hist(eigenvector_centrality.values(), bins=60)
2912
- plt.xticks(ticks=[0, 0.01, 0.02, 0.04, 0.06, 0.08]) # set the x axis ticks
2913
- plt.title("Eigenvector Centrality Histogram ", fontdict={"size": 35}, loc="center")
2914
- plt.xlabel("Eigenvector Centrality", fontdict={"size": 20})
2915
- plt.ylabel("Counts", fontdict={"size": 20})
2916
- plt.show()
2917
- self.format_for_upperright_table(eigenvector_centrality, metric='Node', value='Eigenvector Centrality', title="Eigenvector Centrality Table")
2918
+
2919
+ eigenvector_centrality = nx.centrality.eigenvector_centrality(
2920
+ G
2921
+ )
2922
+ plt.figure(figsize=(15, 8))
2923
+ plt.hist(eigenvector_centrality.values(), bins=60)
2924
+ plt.xticks(ticks=[0, 0.01, 0.02, 0.04, 0.06, 0.08]) # set the x axis ticks
2925
+ plt.title("Eigenvector Centrality Histogram ", fontdict={"size": 35}, loc="center")
2926
+ plt.xlabel("Eigenvector Centrality", fontdict={"size": 20})
2927
+ plt.ylabel("Counts", fontdict={"size": 20})
2928
+ plt.show()
2929
+ self.format_for_upperright_table(eigenvector_centrality, metric='Node', value='Eigenvector Centrality', title="Eigenvector Centrality Table")
2918
2930
 
2919
2931
 
2920
2932
 
2921
- clusters = nx.clustering(G)
2922
- plt.figure(figsize=(15, 8))
2923
- plt.hist(clusters.values(), bins=50)
2924
- plt.title("Clustering Coefficient Histogram ", fontdict={"size": 35}, loc="center")
2925
- plt.xlabel("Clustering Coefficient", fontdict={"size": 20})
2926
- plt.ylabel("Counts", fontdict={"size": 20})
2927
- plt.show()
2928
- self.format_for_upperright_table(clusters, metric='Node', value='Clustering Coefficient', title="Clustering Coefficient Table")
2933
+ clusters = nx.clustering(G)
2934
+ plt.figure(figsize=(15, 8))
2935
+ plt.hist(clusters.values(), bins=50)
2936
+ plt.title("Clustering Coefficient Histogram ", fontdict={"size": 35}, loc="center")
2937
+ plt.xlabel("Clustering Coefficient", fontdict={"size": 20})
2938
+ plt.ylabel("Counts", fontdict={"size": 20})
2939
+ plt.show()
2940
+ self.format_for_upperright_table(clusters, metric='Node', value='Clustering Coefficient', title="Clustering Coefficient Table")
2929
2941
 
2930
- bridges = list(nx.bridges(G))
2931
- self.format_for_upperright_table(bridges, metric = 'Node Pair', title="Bridges")
2942
+ bridges = list(nx.bridges(G))
2943
+ self.format_for_upperright_table(bridges, metric = 'Node Pair', title="Bridges")
2932
2944
 
2945
+ except Exception as e:
2946
+ print(f"Error generating histograms: {e}")
2933
2947
 
2934
2948
  def volumes(self):
2935
2949
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: nettracer3d
3
- Version: 0.7.5
3
+ Version: 0.7.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/
@@ -72,11 +72,6 @@ NetTracer3D is free to use/fork for academic/nonprofit use so long as citation i
72
72
 
73
73
  NetTracer3D was developed by Liam McLaughlin while working under Dr. Sanjay Jain at Washington University School of Medicine.
74
74
 
75
- -- Version 0.7.5 Updates --
75
+ -- Version 0.7.6 Updates --
76
76
 
77
- * Bug fixes
78
- * The segmenter GPU option has been updated to include 2D segmentation and to also be able to load/save models.
79
- * A new function (Analyze -> Stats -> Calculate Generic Network Histograms has been added (gives a few histograms about the network and their corresponding tables. Previously stats mostly gave averages).
80
- * The function 'Analyze -> Data/Overlays -> Get Hub Information' now looks for the upper hubs unique to each separate network component. It will also ignore smaller components that have too few nodes to be reasonably considered having hubs relative to the threshold the user sets.
81
- * The function to split non-connected nodes has been improved a bit (its faster albeit still slowish - its a tough operation)
82
- * Removed python-louvain dependence, now uses networkx for Louvain partitioning. (On top of this, now the user can set the random seed they desire for partitioning for reproducibility purposes).
77
+ * Bug Fixes
File without changes
File without changes