nettracer3d 0.6.4__py3-none-any.whl → 0.6.6__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.
- nettracer3d/morphology.py +207 -5
- nettracer3d/nettracer.py +48 -6
- nettracer3d/nettracer_gui.py +291 -76
- nettracer3d/segmenter.py +239 -164
- nettracer3d/smart_dilate.py +2 -31
- {nettracer3d-0.6.4.dist-info → nettracer3d-0.6.6.dist-info}/METADATA +5 -11
- {nettracer3d-0.6.4.dist-info → nettracer3d-0.6.6.dist-info}/RECORD +11 -11
- {nettracer3d-0.6.4.dist-info → nettracer3d-0.6.6.dist-info}/WHEEL +0 -0
- {nettracer3d-0.6.4.dist-info → nettracer3d-0.6.6.dist-info}/entry_points.txt +0 -0
- {nettracer3d-0.6.4.dist-info → nettracer3d-0.6.6.dist-info}/licenses/LICENSE +0 -0
- {nettracer3d-0.6.4.dist-info → nettracer3d-0.6.6.dist-info}/top_level.txt +0 -0
nettracer3d/smart_dilate.py
CHANGED
|
@@ -9,11 +9,9 @@ import math
|
|
|
9
9
|
import re
|
|
10
10
|
from . import nettracer
|
|
11
11
|
import multiprocessing as mp
|
|
12
|
-
from skimage.feature import peak_local_max
|
|
13
12
|
try:
|
|
14
13
|
import cupy as cp
|
|
15
14
|
import cupyx.scipy.ndimage as cpx
|
|
16
|
-
from cupyx.scipy.ndimage import maximum_filter
|
|
17
15
|
except:
|
|
18
16
|
pass
|
|
19
17
|
|
|
@@ -467,7 +465,7 @@ def compute_distance_transform_distance_GPU(nodes):
|
|
|
467
465
|
nodes_cp = cp.asarray(nodes)
|
|
468
466
|
|
|
469
467
|
# Compute the distance transform on the GPU
|
|
470
|
-
distance
|
|
468
|
+
distance = cpx.distance_transform_edt(nodes_cp)
|
|
471
469
|
|
|
472
470
|
# Convert results back to numpy arrays
|
|
473
471
|
distance = cp.asnumpy(distance)
|
|
@@ -485,7 +483,7 @@ def compute_distance_transform_distance(nodes):
|
|
|
485
483
|
nodes = np.squeeze(nodes) # Convert to 2D for processing
|
|
486
484
|
|
|
487
485
|
# Fallback to CPU if there's an issue with GPU computation
|
|
488
|
-
distance
|
|
486
|
+
distance = distance_transform_edt(nodes)
|
|
489
487
|
if is_pseudo_3d:
|
|
490
488
|
np.expand_dims(distance, axis = 0)
|
|
491
489
|
return distance
|
|
@@ -519,33 +517,6 @@ def gaussian(search_region, GPU = True):
|
|
|
519
517
|
blurred_search = gaussian_filter(search_region, sigma = 1)
|
|
520
518
|
return blurred_search
|
|
521
519
|
|
|
522
|
-
def get_local_maxima(distance, image):
|
|
523
|
-
try:
|
|
524
|
-
if cp.cuda.runtime.getDeviceCount() > 0:
|
|
525
|
-
print("GPU detected. Using CuPy for local maxima.")
|
|
526
|
-
|
|
527
|
-
distance = cp.asarray(distance)
|
|
528
|
-
|
|
529
|
-
# Perform a maximum filter to find local maxima
|
|
530
|
-
footprint = cp.ones((3, 3, 3)) # Define your footprint
|
|
531
|
-
filtered = maximum_filter(distance, footprint=footprint)
|
|
532
|
-
|
|
533
|
-
# Find local maxima by comparing with the original array
|
|
534
|
-
local_max = (distance == filtered) # Peaks are where the filtered result matches the original
|
|
535
|
-
|
|
536
|
-
# Extract coordinates of local maxima
|
|
537
|
-
coords = cp.argwhere(local_max)
|
|
538
|
-
coords = cp.asnumpy(coords)
|
|
539
|
-
|
|
540
|
-
return coords
|
|
541
|
-
else:
|
|
542
|
-
print("No GPU detected. Using CPU for local maxima.")
|
|
543
|
-
coords = peak_local_max(distance, footprint=np.ones((3, 3, 3)), labels=image)
|
|
544
|
-
return coords
|
|
545
|
-
except Exception as e:
|
|
546
|
-
print("GPU operation failed or did not detect GPU (cupy must be installed with a CUDA toolkit set up...). Computing CPU local maxima instead.")
|
|
547
|
-
coords = peak_local_max(distance, footprint=np.ones((3, 3, 3)), labels=image)
|
|
548
|
-
return coords
|
|
549
520
|
|
|
550
521
|
|
|
551
522
|
def catch_memory(e):
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: nettracer3d
|
|
3
|
-
Version: 0.6.
|
|
3
|
+
Version: 0.6.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
|
|
@@ -27,6 +27,7 @@ Requires-Dist: qtrangeslider==0.1.5
|
|
|
27
27
|
Requires-Dist: PyQt6==6.8.0
|
|
28
28
|
Requires-Dist: scikit-learn==1.6.1
|
|
29
29
|
Requires-Dist: nibabel==5.2.0
|
|
30
|
+
Requires-Dist: setuptools>=65.0.0
|
|
30
31
|
Provides-Extra: cuda11
|
|
31
32
|
Requires-Dist: cupy-cuda11x; extra == "cuda11"
|
|
32
33
|
Provides-Extra: cuda12
|
|
@@ -45,15 +46,8 @@ NetTracer3D is free to use/fork for academic/nonprofit use so long as citation i
|
|
|
45
46
|
|
|
46
47
|
NetTracer3D was developed by Liam McLaughlin while working under Dr. Sanjay Jain at Washington University School of Medicine.
|
|
47
48
|
|
|
48
|
-
-- Version 0.6.
|
|
49
|
+
-- Version 0.6.6 updates --
|
|
49
50
|
|
|
50
|
-
1.
|
|
51
|
+
1. Updated flexibility of the fill holes method for user with varying use cases.
|
|
51
52
|
|
|
52
|
-
2.
|
|
53
|
-
|
|
54
|
-
3. Removed attempted trendline fitting from degree distribution
|
|
55
|
-
|
|
56
|
-
4. Added new feature to skeletonization (and corresponding branch labeler/gennodes)
|
|
57
|
-
Now you can have the program attempt to auto-correct 3D skeletonization loop artifacts through a method that just runs the 3d fill holes algo and then attempts to reskeletonize the output. This worked well in my own testing.
|
|
58
|
-
|
|
59
|
-
5. Other minor fixes/improvements
|
|
53
|
+
2. Greatly improved memory efficiency of segmenter. Now works comfortably with 3.5 GB array on my machine for example (my machine has 64 GB RAM and this occupied around 20% of it I would say). Removed the non-memory efficient option (now always prioritizes mem - the former wasn't even that much faster anyway), removed GPU option (would need an entire cupy-centric build, does not make sense to be sharing a script with the CPU version).
|
|
@@ -1,20 +1,20 @@
|
|
|
1
1
|
nettracer3d/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
2
2
|
nettracer3d/community_extractor.py,sha256=Zq8ZM595CTzeR6zLEZ4I6KvhkNfCPUReWvAKxTlaVfk,33495
|
|
3
3
|
nettracer3d/modularity.py,sha256=V1f3s_vGd8EuVz27mzq6ycIGr0BWIpH7c7NU4QjgAHU,30247
|
|
4
|
-
nettracer3d/morphology.py,sha256=
|
|
5
|
-
nettracer3d/nettracer.py,sha256=
|
|
6
|
-
nettracer3d/nettracer_gui.py,sha256=
|
|
4
|
+
nettracer3d/morphology.py,sha256=yncUj04Noj_mcdJze4qMfYw-21AbebwiIcu1bDWGgCM,17778
|
|
5
|
+
nettracer3d/nettracer.py,sha256=iq2EybaXzC9pdkNMmLQ_EqfFqHWMK-jxYqpb8Su61xQ,210230
|
|
6
|
+
nettracer3d/nettracer_gui.py,sha256=o2DiNbEDrf5CK_CdIZNjArmx-eKbwHk25rzBwVeRE5A,394393
|
|
7
7
|
nettracer3d/network_analysis.py,sha256=q1q7lxtA3lebxitfC_jfiT9cnpYXJw4q0Oy2_-Aj8qE,48068
|
|
8
8
|
nettracer3d/network_draw.py,sha256=F7fw6Pcf4qWOhdKwLmhwqWdschbDlHzwCVolQC9imeU,14117
|
|
9
9
|
nettracer3d/node_draw.py,sha256=k3sCTfUCJs3aH1C1q1gTNxDz9EAQbBd1hsUIJajxRx8,9823
|
|
10
10
|
nettracer3d/proximity.py,sha256=FnIiI_AzfXd22HwCIFIyQRZxKYJ8YscIDdPnIv-wsO4,10560
|
|
11
11
|
nettracer3d/run.py,sha256=xYeaAc8FCx8MuzTGyL3NR3mK7WZzffAYAH23bNRZYO4,127
|
|
12
|
-
nettracer3d/segmenter.py,sha256=
|
|
12
|
+
nettracer3d/segmenter.py,sha256=MC4-Bkz1JKcbkISwJaoCwhNmys9E2iXp1gmCn049JjU,85023
|
|
13
13
|
nettracer3d/simple_network.py,sha256=fP1gkDdtQcHruEZpUdasKdZeVacoLOxKhR3bY0L1CAQ,15426
|
|
14
|
-
nettracer3d/smart_dilate.py,sha256=
|
|
15
|
-
nettracer3d-0.6.
|
|
16
|
-
nettracer3d-0.6.
|
|
17
|
-
nettracer3d-0.6.
|
|
18
|
-
nettracer3d-0.6.
|
|
19
|
-
nettracer3d-0.6.
|
|
20
|
-
nettracer3d-0.6.
|
|
14
|
+
nettracer3d/smart_dilate.py,sha256=vnBj2soDGVBioKaNQi-bcyAtg0nuWcNGmlrzUNFFYQE,23191
|
|
15
|
+
nettracer3d-0.6.6.dist-info/licenses/LICENSE,sha256=gM207DhJjWrxLuEWXl0Qz5ISbtWDmADfjHp3yC2XISs,888
|
|
16
|
+
nettracer3d-0.6.6.dist-info/METADATA,sha256=gro7B_GK6lL1oL-nd64pO69ynXwbZKBvShNBTKJVYu0,3559
|
|
17
|
+
nettracer3d-0.6.6.dist-info/WHEEL,sha256=CmyFI0kx5cdEMTLiONQRbGQwjIoR1aIYB7eCAQ4KPJ0,91
|
|
18
|
+
nettracer3d-0.6.6.dist-info/entry_points.txt,sha256=Nx1rr_0QhJXDBHAQg2vcqCzLMKBzSHfwy3xwGkueVyc,53
|
|
19
|
+
nettracer3d-0.6.6.dist-info/top_level.txt,sha256=zsYy9rZwirfCEOubolhee4TyzqBAL5gSUeFMzhFTX8c,12
|
|
20
|
+
nettracer3d-0.6.6.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|