nettracer3d 0.5.0__py3-none-any.whl → 0.5.2__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.
@@ -1069,24 +1069,29 @@ class ImageViewerWindow(QMainWindow):
1069
1069
 
1070
1070
  neighbors = set() # Use a set from the start to avoid duplicates
1071
1071
  nodes += self.clicked_values['nodes']
1072
+
1073
+ try:
1072
1074
 
1073
- # Get the existing DataFrame from the model
1074
- original_df = self.network_table.model()._data
1075
-
1076
- # Create mask for pairs that have nodes of the ID in question
1077
- mask = (
1078
- (original_df.iloc[:, 0].isin(nodes)) | (original_df.iloc[:, 1].isin(nodes))
1079
- )
1080
-
1081
- # Filter the DataFrame to only include direct connections
1082
- filtered_df = original_df[mask].copy()
1083
-
1084
- # Create new model with filtered DataFrame and update selection table
1085
- new_model = PandasModel(filtered_df)
1086
- self.selection_table.setModel(new_model)
1087
-
1088
- # Switch to selection table
1089
- self.selection_button.click()
1075
+ # Get the existing DataFrame from the model
1076
+ original_df = self.network_table.model()._data
1077
+
1078
+ # Create mask for pairs that have nodes of the ID in question
1079
+ mask = (
1080
+ (original_df.iloc[:, 0].isin(nodes)) | (original_df.iloc[:, 1].isin(nodes))
1081
+ )
1082
+
1083
+
1084
+ # Filter the DataFrame to only include direct connections
1085
+ filtered_df = original_df[mask].copy()
1086
+
1087
+ # Create new model with filtered DataFrame and update selection table
1088
+ new_model = PandasModel(filtered_df)
1089
+ self.selection_table.setModel(new_model)
1090
+
1091
+ # Switch to selection table
1092
+ self.selection_button.click()
1093
+ except:
1094
+ pass
1090
1095
 
1091
1096
  print(f"Found {len(filtered_df)} direct connections between nodes of ID {sort} and their neighbors (of any ID)")
1092
1097
 
@@ -2065,18 +2070,19 @@ class ImageViewerWindow(QMainWindow):
2065
2070
  x_idx = int(round(event.xdata))
2066
2071
  y_idx = int(round(event.ydata))
2067
2072
  # Check if Ctrl key is pressed (using matplotlib's key_press system)
2068
- ctrl_pressed = 'ctrl' in event.modifiers
2069
- if self.channel_data[self.active_channel][self.current_slice, y_idx, x_idx] != 0:
2070
- clicked_value = self.channel_data[self.active_channel][self.current_slice, y_idx, x_idx]
2071
- else:
2072
- if not ctrl_pressed:
2073
- self.clicked_values = {
2074
- 'nodes': [],
2075
- 'edges': []
2076
- }
2077
- self.create_highlight_overlay()
2078
- return
2079
-
2073
+ ctrl_pressed = 'ctrl' in event.modifiers
2074
+ if len(self.channel_data[self.active_channel].shape) != 4:
2075
+ if self.channel_data[self.active_channel][self.current_slice, y_idx, x_idx] != 0:
2076
+ clicked_value = self.channel_data[self.active_channel][self.current_slice, y_idx, x_idx]
2077
+ else:
2078
+ if not ctrl_pressed:
2079
+ self.clicked_values = {
2080
+ 'nodes': [],
2081
+ 'edges': []
2082
+ }
2083
+ self.create_highlight_overlay()
2084
+ return
2085
+
2080
2086
 
2081
2087
  starting_vals = copy.deepcopy(self.clicked_values)
2082
2088
 
@@ -5834,8 +5840,12 @@ class MachineWindow(QMainWindow):
5834
5840
 
5835
5841
  if self.parent().active_channel == 0:
5836
5842
  if self.parent().channel_data[0] is not None:
5837
- active_data = self.parent().channel_data[0]
5838
- act_channel = 0
5843
+ try:
5844
+ active_data = self.parent().channel_data[0]
5845
+ act_channel = 0
5846
+ except:
5847
+ active_data = self.parent().channel_data[1]
5848
+ act_channel = 1
5839
5849
  else:
5840
5850
  active_data = self.parent().channel_data[1]
5841
5851
  act_channel = 1
nettracer3d/node_draw.py CHANGED
@@ -175,7 +175,11 @@ def degree_draw(degree_dict, centroid_dict, nodes):
175
175
 
176
176
  for node in centroid_dict:
177
177
 
178
- degree = degree_dict[node]
178
+ try:
179
+ degree = degree_dict[node]
180
+ except:
181
+ continue
182
+
179
183
  z, y, x = centroid_dict[node].astype(int)
180
184
 
181
185
  try:
nettracer3d/segmenter.py CHANGED
@@ -2,8 +2,14 @@ from sklearn.ensemble import RandomForestClassifier
2
2
  import numpy as np
3
3
  try:
4
4
  import torch
5
+ except:
6
+ pass
7
+ try:
5
8
  import cupy as cp
6
9
  import cupyx.scipy.ndimage as cpx
10
+ except:
11
+ pass
12
+ try:
7
13
  from cuml.ensemble import RandomForestClassifier as cuRandomForestClassifier
8
14
  except:
9
15
  pass
@@ -19,9 +25,15 @@ class InteractiveSegmenter:
19
25
  self.image_3d = image_3d
20
26
  self.patterns = []
21
27
 
22
- self.use_gpu = use_gpu and cp.cuda.is_available()
28
+ try:
29
+ self.use_gpu = use_gpu and cp.cuda.is_available()
30
+ except:
31
+ self.use_gpu = False
23
32
  if self.use_gpu:
24
- print(f"Using GPU: {torch.cuda.get_device_name()}")
33
+ try:
34
+ print(f"Using GPU: {torch.cuda.get_device_name()}")
35
+ except:
36
+ pass
25
37
  self.image_gpu = cp.asarray(image_3d)
26
38
  try:
27
39
  self.model = cuRandomForestClassifier(
@@ -23,7 +23,7 @@ def dilate_3D(tiff_array, dilated_x, dilated_y, dilated_z):
23
23
  Arguments are an array, and the desired pixel dilation amounts in X, Y, Z."""
24
24
 
25
25
  if tiff_array.shape[0] == 1:
26
- return dilate_2D(tiff_array, ((dilated_x - 1) / 2))
26
+ return nettracer.dilate_2D(tiff_array, ((dilated_x - 1) / 2))
27
27
 
28
28
  if dilated_x == 3 and dilated_y == 3 and dilated_z == 3:
29
29
 
@@ -1,9 +1,9 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: nettracer3d
3
- Version: 0.5.0
3
+ Version: 0.5.2
4
4
  Summary: Scripts for intializing and analyzing networks from segmentations of three dimensional images.
5
- Author-email: Liam McLaughlin <boom2449@gmail.com>
6
- Project-URL: User_Manual, https://drive.google.com/drive/folders/1fTkz3n4LN9_VxKRKC8lVQSlrz_wq0bVn?usp=drive_link
5
+ Author-email: Liam McLaughlin <mclaughlinliam99@gmail.com>
6
+ Project-URL: User_Tutorial, https://www.youtube.com/watch?v=cRatn5VTWDY
7
7
  Project-URL: Reference_Citation_For_Use, https://doi.org/10.1101/2024.07.29.605633
8
8
  Classifier: Programming Language :: Python :: 3
9
9
  Classifier: License :: Other/Proprietary License
@@ -36,8 +36,8 @@ Requires-Dist: cupy; extra == "cupy"
36
36
  NetTracer3D is a python package developed for both 2D and 3D analysis of microscopic images in the .tif file format. It supports generation of 3D networks showing the relationships between objects (or nodes) in three dimensional space, either based on their own proximity or connectivity via connecting objects such as nerves or blood vessels. In addition to these functionalities are several advanced 3D data processing algorithms, such as labeling of branched structures or abstraction of branched structures into networks. Note that nettracer3d uses segmented data, which can be segmented from other softwares such as ImageJ and imported into NetTracer3D, although it does offer its own segmentation via intensity and volumetric thresholding, or random forest machine learning segmentation. NetTracer3D currently has a fully functional GUI. To use the GUI, after installing the nettracer3d package via pip, enter the command 'nettracer3d' in your command prompt:
37
37
 
38
38
 
39
- This gui is built from the PyQt6 package and therefore may not function on dockers or virtual envs that are unable to support PyQt6 displays. More advanced documentation (especially for the GUI) is coming down the line, but for now please see: https://drive.google.com/drive/folders/1fTkz3n4LN9_VxKRKC8lVQSlrz_wq0bVn?usp=drive_link
40
- for a user manual that provides older documentation.
39
+ This gui is built from the PyQt6 package and therefore may not function on dockers or virtual envs that are unable to support PyQt6 displays. More advanced documentation is coming down the line, but for now please see: https://www.youtube.com/watch?v=cRatn5VTWDY
40
+ for a video tutorial on using the GUI.
41
41
 
42
42
  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).
43
43
 
@@ -4,18 +4,18 @@ nettracer3d/hub_getter.py,sha256=KiNtxdajLkwB1ftslvrh1FE1Ch9ZCFEmHSEEotwR-To,829
4
4
  nettracer3d/modularity.py,sha256=V1f3s_vGd8EuVz27mzq6ycIGr0BWIpH7c7NU4QjgAHU,30247
5
5
  nettracer3d/morphology.py,sha256=CsRWB0DY-vBBlKdF9IQwgfYYZswuE7n1Iu_Osxgmxnw,13042
6
6
  nettracer3d/nettracer.py,sha256=hDccGy6RybSJFvY6dsN1l5eM3wKZW93CizlTvgEeyNs,209690
7
- nettracer3d/nettracer_gui.py,sha256=Owg9ZmRqP8fZRvZpAd5T0VpwYyYc40RfVRtRiN9XnKI,339971
7
+ nettracer3d/nettracer_gui.py,sha256=dQUhNeeVQCkuXrvtdUmqSs184Gr8Y-neoWPWcXhGaAo,340385
8
8
  nettracer3d/network_analysis.py,sha256=MJBBjslA1k_R8ymid77U-qGSgzxFVfzGVQhE0IdhnbE,48046
9
9
  nettracer3d/network_draw.py,sha256=F7fw6Pcf4qWOhdKwLmhwqWdschbDlHzwCVolQC9imeU,14117
10
- nettracer3d/node_draw.py,sha256=BMiD_FrlOHeGD4AQZ_Emd152PfxFuMgGf2x4S0TOTnw,9752
10
+ nettracer3d/node_draw.py,sha256=k3sCTfUCJs3aH1C1q1gTNxDz9EAQbBd1hsUIJajxRx8,9823
11
11
  nettracer3d/proximity.py,sha256=B1pmFegx5Wb0JKI5rvpILv2VRU09f6M2iljAQAqBja0,11059
12
12
  nettracer3d/run.py,sha256=xYeaAc8FCx8MuzTGyL3NR3mK7WZzffAYAH23bNRZYO4,127
13
- nettracer3d/segmenter.py,sha256=EUH7KEiYhET_D6j0T-wKqZaohcvIGYYIEwUU2Dzl51Q,29502
13
+ nettracer3d/segmenter.py,sha256=Rr5MUUWgGHYzzTy4hzbO3zzJhNIKsyjV1Qxg99Pb8QY,29686
14
14
  nettracer3d/simple_network.py,sha256=fP1gkDdtQcHruEZpUdasKdZeVacoLOxKhR3bY0L1CAQ,15426
15
- nettracer3d/smart_dilate.py,sha256=dvbG2UhWzMQrtDqSj281rixNRgwUHOFGlJZ9RSl6rKs,24590
16
- nettracer3d-0.5.0.dist-info/LICENSE,sha256=gM207DhJjWrxLuEWXl0Qz5ISbtWDmADfjHp3yC2XISs,888
17
- nettracer3d-0.5.0.dist-info/METADATA,sha256=UoZAyKclOEgiSTlefWVpC8WVD1YMsm6Zjt7R9bdLufw,3029
18
- nettracer3d-0.5.0.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
19
- nettracer3d-0.5.0.dist-info/entry_points.txt,sha256=Nx1rr_0QhJXDBHAQg2vcqCzLMKBzSHfwy3xwGkueVyc,53
20
- nettracer3d-0.5.0.dist-info/top_level.txt,sha256=zsYy9rZwirfCEOubolhee4TyzqBAL5gSUeFMzhFTX8c,12
21
- nettracer3d-0.5.0.dist-info/RECORD,,
15
+ nettracer3d/smart_dilate.py,sha256=Kekm6YIVlJniMvJMG6_AwwNmCqK2l4Qtvg9VzzqPKMw,24600
16
+ nettracer3d-0.5.2.dist-info/LICENSE,sha256=gM207DhJjWrxLuEWXl0Qz5ISbtWDmADfjHp3yC2XISs,888
17
+ nettracer3d-0.5.2.dist-info/METADATA,sha256=M7khbzBNHwsNJ2KqmNKwnP1rvk1v37E6BI7dD9mQU58,2912
18
+ nettracer3d-0.5.2.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
19
+ nettracer3d-0.5.2.dist-info/entry_points.txt,sha256=Nx1rr_0QhJXDBHAQg2vcqCzLMKBzSHfwy3xwGkueVyc,53
20
+ nettracer3d-0.5.2.dist-info/top_level.txt,sha256=zsYy9rZwirfCEOubolhee4TyzqBAL5gSUeFMzhFTX8c,12
21
+ nettracer3d-0.5.2.dist-info/RECORD,,