nettracer3d 0.5.5__tar.gz → 0.5.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.
Files changed (27) hide show
  1. {nettracer3d-0.5.5/src/nettracer3d.egg-info → nettracer3d-0.5.6}/PKG-INFO +3 -7
  2. nettracer3d-0.5.6/README.md +13 -0
  3. {nettracer3d-0.5.5 → nettracer3d-0.5.6}/pyproject.toml +1 -1
  4. {nettracer3d-0.5.5 → nettracer3d-0.5.6}/src/nettracer3d/nettracer_gui.py +6 -2
  5. {nettracer3d-0.5.5 → nettracer3d-0.5.6}/src/nettracer3d/segmenter.py +15 -11
  6. {nettracer3d-0.5.5 → nettracer3d-0.5.6/src/nettracer3d.egg-info}/PKG-INFO +3 -7
  7. nettracer3d-0.5.5/README.md +0 -17
  8. {nettracer3d-0.5.5 → nettracer3d-0.5.6}/LICENSE +0 -0
  9. {nettracer3d-0.5.5 → nettracer3d-0.5.6}/setup.cfg +0 -0
  10. {nettracer3d-0.5.5 → nettracer3d-0.5.6}/src/nettracer3d/__init__.py +0 -0
  11. {nettracer3d-0.5.5 → nettracer3d-0.5.6}/src/nettracer3d/community_extractor.py +0 -0
  12. {nettracer3d-0.5.5 → nettracer3d-0.5.6}/src/nettracer3d/hub_getter.py +0 -0
  13. {nettracer3d-0.5.5 → nettracer3d-0.5.6}/src/nettracer3d/modularity.py +0 -0
  14. {nettracer3d-0.5.5 → nettracer3d-0.5.6}/src/nettracer3d/morphology.py +0 -0
  15. {nettracer3d-0.5.5 → nettracer3d-0.5.6}/src/nettracer3d/nettracer.py +0 -0
  16. {nettracer3d-0.5.5 → nettracer3d-0.5.6}/src/nettracer3d/network_analysis.py +0 -0
  17. {nettracer3d-0.5.5 → nettracer3d-0.5.6}/src/nettracer3d/network_draw.py +0 -0
  18. {nettracer3d-0.5.5 → nettracer3d-0.5.6}/src/nettracer3d/node_draw.py +0 -0
  19. {nettracer3d-0.5.5 → nettracer3d-0.5.6}/src/nettracer3d/proximity.py +0 -0
  20. {nettracer3d-0.5.5 → nettracer3d-0.5.6}/src/nettracer3d/run.py +0 -0
  21. {nettracer3d-0.5.5 → nettracer3d-0.5.6}/src/nettracer3d/simple_network.py +0 -0
  22. {nettracer3d-0.5.5 → nettracer3d-0.5.6}/src/nettracer3d/smart_dilate.py +0 -0
  23. {nettracer3d-0.5.5 → nettracer3d-0.5.6}/src/nettracer3d.egg-info/SOURCES.txt +0 -0
  24. {nettracer3d-0.5.5 → nettracer3d-0.5.6}/src/nettracer3d.egg-info/dependency_links.txt +0 -0
  25. {nettracer3d-0.5.5 → nettracer3d-0.5.6}/src/nettracer3d.egg-info/entry_points.txt +0 -0
  26. {nettracer3d-0.5.5 → nettracer3d-0.5.6}/src/nettracer3d.egg-info/requires.txt +0 -0
  27. {nettracer3d-0.5.5 → nettracer3d-0.5.6}/src/nettracer3d.egg-info/top_level.txt +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: nettracer3d
3
- Version: 0.5.5
3
+ Version: 0.5.6
4
4
  Summary: Scripts for intializing and analyzing networks from segmentations of three dimensional images.
5
5
  Author-email: Liam McLaughlin <mclaughlinliam99@gmail.com>
6
6
  Project-URL: User_Tutorial, https://www.youtube.com/watch?v=cRatn5VTWDY
@@ -44,10 +44,6 @@ NetTracer3D is free to use/fork for academic/nonprofit use so long as citation i
44
44
 
45
45
  NetTracer3D was developed by Liam McLaughlin while working under Dr. Sanjay Jain at Washington University School of Medicine.
46
46
 
47
- -- Version 0.5.5 updates --
47
+ -- Version 0.5.6 updates --
48
48
 
49
- 1. When the highlight overlay is being used in big overlays (and therefore defaulting to the mini overlay), updated system to just make one 2d overlay that regenerates on slice movement. Decided this was better than having it sit in a bigger 3d array when said array wasn't being used for anything and had to be rebuilt on slice movement or 3d operations anyway.
50
-
51
- 2. For the random forrest segmenter, added the option to segment by 2D slice instead of 3D. In short, the 3D version was very greedy with its RAM usage and essentially computes a set of feature maps for the target array that are equivalent dims. By default it makes 7 of these, so a 1 GB array is going to demand 7GB of RAM to store its feature maps. The 2D slice version segments by 2D slice instead, meaning it stores only feature maps for slices with actual slices on them for training the model, and then for predicting voxel foreground/background, it computes the feature maps for the current slice (admittedly in the threadpool so this is amplified by core amount in the CPU but generally speaking this will save a lot of RAM). The reason I made this segmenter is to give NetTracer3D all the bells and whistles to let a user do everything in one program, but admittedly there are more efficient ML segmenters out there, such as through FIJI's big data viewer which is a lot better at handling big arrays in memory. I considered a way to compute 3D feature maps one at a time, save them in chunks to hard mem, and then open them while doing the chunked total segmentation but frankly this would likely be too slow to want to use so I will just suggest using 2D slice segmenter if RAM runs low.
52
-
53
- I do not anticipate any major updates for this project for the foreseeable future beyond bug fixes.
49
+ 1. Minor change - Updated some of the overhead and post-random forrest voxel assignment for the segmenter to be faster. The major bottleneck for this is still querying sklearn which seems a bit harder to work around.
@@ -0,0 +1,13 @@
1
+ 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:
2
+
3
+
4
+ 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
5
+ for a video tutorial on using the GUI.
6
+
7
+ 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).
8
+
9
+ NetTracer3D was developed by Liam McLaughlin while working under Dr. Sanjay Jain at Washington University School of Medicine.
10
+
11
+ -- Version 0.5.6 updates --
12
+
13
+ 1. Minor change - Updated some of the overhead and post-random forrest voxel assignment for the segmenter to be faster. The major bottleneck for this is still querying sklearn which seems a bit harder to work around.
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "nettracer3d"
3
- version = "0.5.5"
3
+ version = "0.5.6"
4
4
  authors = [
5
5
  { name="Liam McLaughlin", email="mclaughlinliam99@gmail.com" },
6
6
  ]
@@ -6569,8 +6569,12 @@ class MachineWindow(QMainWindow):
6569
6569
  # Clean up when done
6570
6570
  self.segmenter.cleanup()
6571
6571
 
6572
- for z,y,x in foreground_coords:
6573
- self.parent().highlight_overlay[z,y,x] = 255
6572
+ fg_array = np.array(list(foreground_coords))
6573
+ if len(fg_array) > 0: # Check if we have any foreground coordinates
6574
+ # Unpack into separate coordinate arrays
6575
+ z_coords, y_coords, x_coords = fg_array[:, 0], fg_array[:, 1], fg_array[:, 2]
6576
+ # Assign values in a single vectorized operation
6577
+ self.parent().highlight_overlay[z_coords, y_coords, x_coords] = 255
6574
6578
 
6575
6579
  self.parent().load_channel(3, self.parent().highlight_overlay, True)
6576
6580
 
@@ -764,26 +764,30 @@ class InteractiveSegmenter:
764
764
  Returns:
765
765
  List of chunks, where each chunk contains the coordinates for one z-slice
766
766
  """
767
+ # Pre-calculate the number of coordinates per z-slice
768
+ coords_per_slice = self.image_3d.shape[1] * self.image_3d.shape[2]
769
+
770
+ # Create all coordinates at once
767
771
  chunks = []
768
-
769
- # Process one z-slice at a time
770
772
  for z in range(self.image_3d.shape[0]):
771
- # For each z-slice, gather all y,x coordinates
773
+ # Create y, x meshgrid once
772
774
  y_coords, x_coords = np.meshgrid(
773
775
  np.arange(self.image_3d.shape[1]),
774
776
  np.arange(self.image_3d.shape[2]),
775
777
  indexing='ij'
776
778
  )
777
779
 
778
- # Create the z-slice coordinates
779
- z_array = np.full_like(y_coords, z)
780
- coords = np.stack([z_array, y_coords, x_coords]).reshape(3, -1).T
780
+ # Create the slice coordinates more efficiently
781
+ slice_coords = np.column_stack((
782
+ np.full(coords_per_slice, z),
783
+ y_coords.ravel(),
784
+ x_coords.ravel()
785
+ ))
781
786
 
782
- # Convert to list of tuples and add as a chunk
783
- chunks.append(list(map(tuple, coords)))
784
-
785
- return chunks
787
+ # Convert to list of tuples
788
+ chunks.append(list(map(tuple, slice_coords)))
786
789
 
790
+ return chunks
787
791
  try:
788
792
  from cuml.ensemble import RandomForestClassifier as cuRandomForestClassifier
789
793
  except:
@@ -853,7 +857,7 @@ class InteractiveSegmenter:
853
857
  print("Segmenting chunks...")
854
858
 
855
859
 
856
- with ThreadPoolExecutor() as executor:
860
+ with ThreadPoolExecutor(max_workers=multiprocessing.cpu_count()) as executor:
857
861
  if gpu:
858
862
  try:
859
863
  futures = [executor.submit(self.process_chunk_GPU, chunk) for chunk in chunks]
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: nettracer3d
3
- Version: 0.5.5
3
+ Version: 0.5.6
4
4
  Summary: Scripts for intializing and analyzing networks from segmentations of three dimensional images.
5
5
  Author-email: Liam McLaughlin <mclaughlinliam99@gmail.com>
6
6
  Project-URL: User_Tutorial, https://www.youtube.com/watch?v=cRatn5VTWDY
@@ -44,10 +44,6 @@ NetTracer3D is free to use/fork for academic/nonprofit use so long as citation i
44
44
 
45
45
  NetTracer3D was developed by Liam McLaughlin while working under Dr. Sanjay Jain at Washington University School of Medicine.
46
46
 
47
- -- Version 0.5.5 updates --
47
+ -- Version 0.5.6 updates --
48
48
 
49
- 1. When the highlight overlay is being used in big overlays (and therefore defaulting to the mini overlay), updated system to just make one 2d overlay that regenerates on slice movement. Decided this was better than having it sit in a bigger 3d array when said array wasn't being used for anything and had to be rebuilt on slice movement or 3d operations anyway.
50
-
51
- 2. For the random forrest segmenter, added the option to segment by 2D slice instead of 3D. In short, the 3D version was very greedy with its RAM usage and essentially computes a set of feature maps for the target array that are equivalent dims. By default it makes 7 of these, so a 1 GB array is going to demand 7GB of RAM to store its feature maps. The 2D slice version segments by 2D slice instead, meaning it stores only feature maps for slices with actual slices on them for training the model, and then for predicting voxel foreground/background, it computes the feature maps for the current slice (admittedly in the threadpool so this is amplified by core amount in the CPU but generally speaking this will save a lot of RAM). The reason I made this segmenter is to give NetTracer3D all the bells and whistles to let a user do everything in one program, but admittedly there are more efficient ML segmenters out there, such as through FIJI's big data viewer which is a lot better at handling big arrays in memory. I considered a way to compute 3D feature maps one at a time, save them in chunks to hard mem, and then open them while doing the chunked total segmentation but frankly this would likely be too slow to want to use so I will just suggest using 2D slice segmenter if RAM runs low.
52
-
53
- I do not anticipate any major updates for this project for the foreseeable future beyond bug fixes.
49
+ 1. Minor change - Updated some of the overhead and post-random forrest voxel assignment for the segmenter to be faster. The major bottleneck for this is still querying sklearn which seems a bit harder to work around.
@@ -1,17 +0,0 @@
1
- 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:
2
-
3
-
4
- 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
5
- for a video tutorial on using the GUI.
6
-
7
- 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).
8
-
9
- NetTracer3D was developed by Liam McLaughlin while working under Dr. Sanjay Jain at Washington University School of Medicine.
10
-
11
- -- Version 0.5.5 updates --
12
-
13
- 1. When the highlight overlay is being used in big overlays (and therefore defaulting to the mini overlay), updated system to just make one 2d overlay that regenerates on slice movement. Decided this was better than having it sit in a bigger 3d array when said array wasn't being used for anything and had to be rebuilt on slice movement or 3d operations anyway.
14
-
15
- 2. For the random forrest segmenter, added the option to segment by 2D slice instead of 3D. In short, the 3D version was very greedy with its RAM usage and essentially computes a set of feature maps for the target array that are equivalent dims. By default it makes 7 of these, so a 1 GB array is going to demand 7GB of RAM to store its feature maps. The 2D slice version segments by 2D slice instead, meaning it stores only feature maps for slices with actual slices on them for training the model, and then for predicting voxel foreground/background, it computes the feature maps for the current slice (admittedly in the threadpool so this is amplified by core amount in the CPU but generally speaking this will save a lot of RAM). The reason I made this segmenter is to give NetTracer3D all the bells and whistles to let a user do everything in one program, but admittedly there are more efficient ML segmenters out there, such as through FIJI's big data viewer which is a lot better at handling big arrays in memory. I considered a way to compute 3D feature maps one at a time, save them in chunks to hard mem, and then open them while doing the chunked total segmentation but frankly this would likely be too slow to want to use so I will just suggest using 2D slice segmenter if RAM runs low.
16
-
17
- I do not anticipate any major updates for this project for the foreseeable future beyond bug fixes.
File without changes
File without changes