biomedisa 24.8.10__py3-none-any.whl → 25.6.1__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.
- biomedisa/deeplearning.py +35 -9
- biomedisa/features/DataGenerator.py +192 -123
- biomedisa/features/PredictDataGenerator.py +7 -5
- biomedisa/features/biomedisa_helper.py +59 -14
- biomedisa/features/crop_helper.py +7 -7
- biomedisa/features/keras_helper.py +281 -157
- biomedisa/features/random_walk/rw_large.py +6 -2
- biomedisa/features/random_walk/rw_small.py +7 -3
- biomedisa/features/remove_outlier.py +3 -3
- biomedisa/features/split_volume.py +12 -11
- biomedisa/interpolation.py +6 -9
- biomedisa/mesh.py +2 -2
- {biomedisa-24.8.10.dist-info → biomedisa-25.6.1.dist-info}/METADATA +3 -2
- {biomedisa-24.8.10.dist-info → biomedisa-25.6.1.dist-info}/RECORD +17 -17
- {biomedisa-24.8.10.dist-info → biomedisa-25.6.1.dist-info}/WHEEL +1 -1
- {biomedisa-24.8.10.dist-info → biomedisa-25.6.1.dist-info/licenses}/LICENSE +0 -0
- {biomedisa-24.8.10.dist-info → biomedisa-25.6.1.dist-info}/top_level.txt +0 -0
@@ -1,6 +1,6 @@
|
|
1
1
|
##########################################################################
|
2
2
|
## ##
|
3
|
-
## Copyright (c) 2019-
|
3
|
+
## Copyright (c) 2019-2025 Philipp Lösel. All rights reserved. ##
|
4
4
|
## ##
|
5
5
|
## This file is part of the open source project biomedisa. ##
|
6
6
|
## ##
|
@@ -176,7 +176,11 @@ def _diffusion_child(comm, bm=None):
|
|
176
176
|
mask = bm.labelData>0
|
177
177
|
dice = Dice_score(bm.labelData, final*mask)
|
178
178
|
if dice < 0.3:
|
179
|
-
|
179
|
+
if bm.slicer:
|
180
|
+
message = 'Bad result! If you label outside the red (axial) window, enable "All axes" and ensure that at least one slice is empty between pre-segmented slices in each view.'
|
181
|
+
_error_(bm, message, level=0)
|
182
|
+
else:
|
183
|
+
print('Warning: Bad result! Use "--allaxis" if you labeled axes other than the xy-plane.')
|
180
184
|
|
181
185
|
# regular result
|
182
186
|
final_result = np.zeros((bm.zsh, bm.ysh, bm.xsh), dtype=np.uint8)
|
@@ -1,6 +1,6 @@
|
|
1
1
|
##########################################################################
|
2
2
|
## ##
|
3
|
-
## Copyright (c) 2019-
|
3
|
+
## Copyright (c) 2019-2025 Philipp Lösel. All rights reserved. ##
|
4
4
|
## ##
|
5
5
|
## This file is part of the open source project biomedisa. ##
|
6
6
|
## ##
|
@@ -29,7 +29,7 @@
|
|
29
29
|
from biomedisa.features.remove_outlier import clean, fill
|
30
30
|
from biomedisa.features.active_contour import activeContour
|
31
31
|
from biomedisa.features.biomedisa_helper import (_get_device, save_data, unique_file_path,
|
32
|
-
sendToChild, _split_indices, get_labels, Dice_score)
|
32
|
+
sendToChild, _split_indices, get_labels, Dice_score, _error_)
|
33
33
|
from mpi4py import MPI
|
34
34
|
import numpy as np
|
35
35
|
import time
|
@@ -179,7 +179,11 @@ def _diffusion_child(comm, bm=None):
|
|
179
179
|
mask = bm.labelData>0
|
180
180
|
dice = Dice_score(bm.labelData, final_zero*mask)
|
181
181
|
if dice < 0.3:
|
182
|
-
|
182
|
+
if bm.slicer:
|
183
|
+
message = 'Bad result! If you label outside the red (axial) window, enable "All axes" and ensure that at least one slice is empty between pre-segmented slices in each view.'
|
184
|
+
_error_(bm, message, level=0)
|
185
|
+
else:
|
186
|
+
print('Warning: Bad result! Use "--allaxis" if you labeled axes other than the xy-plane.')
|
183
187
|
|
184
188
|
# regular result
|
185
189
|
final_result = np.zeros((bm.zsh, bm.ysh, bm.xsh), dtype=np.uint8)
|
@@ -30,7 +30,7 @@
|
|
30
30
|
import os
|
31
31
|
import biomedisa
|
32
32
|
from biomedisa.features.biomedisa_helper import (load_data, save_data,
|
33
|
-
unique_file_path, silent_remove)
|
33
|
+
unique_file_path, silent_remove, unique)
|
34
34
|
import numpy as np
|
35
35
|
from scipy import ndimage
|
36
36
|
import argparse
|
@@ -60,7 +60,7 @@ def reduce_blocksize(data):
|
|
60
60
|
|
61
61
|
def clean(image, threshold=0.1):
|
62
62
|
image_i = np.copy(image, order='C')
|
63
|
-
allLabels =
|
63
|
+
allLabels = unique(image_i)
|
64
64
|
mask = np.empty_like(image_i)
|
65
65
|
s = [[[0,0,0], [0,1,0], [0,0,0]], [[0,1,0], [1,1,1], [0,1,0]], [[0,0,0], [0,1,0], [0,0,0]]]
|
66
66
|
for k in allLabels[1:]:
|
@@ -99,7 +99,7 @@ def clean(image, threshold=0.1):
|
|
99
99
|
|
100
100
|
def fill(image, threshold=0.9):
|
101
101
|
image_i = np.copy(image, order='C')
|
102
|
-
allLabels =
|
102
|
+
allLabels = unique(image_i)
|
103
103
|
mask = np.empty_like(image_i)
|
104
104
|
s = [[[0,0,0], [0,1,0], [0,0,0]], [[0,1,0], [1,1,1], [0,1,0]], [[0,0,0], [0,1,0], [0,0,0]]]
|
105
105
|
for k in allLabels[1:]:
|
@@ -132,17 +132,18 @@ if __name__ == '__main__':
|
|
132
132
|
labelData = labelData[datamin_z:datamax_z,datamin_y:datamax_y,datamin_x:datamax_x].copy()
|
133
133
|
|
134
134
|
# interpolation
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
135
|
+
if np.any(labelData):
|
136
|
+
results = smart_interpolation(data, labelData, uncertainty=args.uncertainty, allaxis=args.allaxis, smooth=args.smooth)
|
137
|
+
|
138
|
+
# append results
|
139
|
+
final[blockmin_z:blockmax_z,blockmin_y:blockmax_y,blockmin_x:blockmax_x] \
|
140
|
+
= results['regular'][blockmin_z-datamin_z:blockmax_z-datamin_z,blockmin_y-datamin_y:blockmax_y-datamin_y,blockmin_x-datamin_x:blockmax_x-datamin_x]
|
141
|
+
if 'smooth' in results and results['smooth'] is not None:
|
142
|
+
final_smooth[blockmin_z:blockmax_z,blockmin_y:blockmax_y,blockmin_x:blockmax_x] \
|
143
|
+
= results['smooth'][blockmin_z-datamin_z:blockmax_z-datamin_z,blockmin_y-datamin_y:blockmax_y-datamin_y,blockmin_x-datamin_x:blockmax_x-datamin_x]
|
144
|
+
if 'uncertainty' in results and results['uncertainty'] is not None:
|
145
|
+
final_uncertainty[blockmin_z:blockmax_z,blockmin_y:blockmax_y,blockmin_x:blockmax_x] \
|
146
|
+
= results['uncertainty'][blockmin_z-datamin_z:blockmax_z-datamin_z,blockmin_y-datamin_y:blockmax_y-datamin_y,blockmin_x-datamin_x:blockmax_x-datamin_x]
|
146
147
|
|
147
148
|
# path to regular result
|
148
149
|
filename, extension = os.path.splitext(os.path.basename(args.path_to_data))
|
biomedisa/interpolation.py
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
#!/usr/bin/python3
|
2
2
|
##########################################################################
|
3
3
|
## ##
|
4
|
-
## Copyright (c) 2019-
|
4
|
+
## Copyright (c) 2019-2025 Philipp Lösel. All rights reserved. ##
|
5
5
|
## ##
|
6
6
|
## This file is part of the open source project biomedisa. ##
|
7
7
|
## ##
|
@@ -43,7 +43,7 @@ class Biomedisa(object):
|
|
43
43
|
def smart_interpolation(data, labelData, nbrw=10, sorw=4000, acwe=False, acwe_alpha=1.0, acwe_smooth=1, acwe_steps=3,
|
44
44
|
path_to_data=None, path_to_labels=None, denoise=False, uncertainty=False, platform=None,
|
45
45
|
allaxis=False, ignore='none', only='all', smooth=0, compression=True, return_hits=False,
|
46
|
-
img_id=None, label_id=None, remote=False, queue=0, clean=None, fill=None):
|
46
|
+
img_id=None, label_id=None, remote=False, queue=0, clean=None, fill=None, slicer=False):
|
47
47
|
|
48
48
|
freeze_support()
|
49
49
|
|
@@ -165,13 +165,8 @@ def smart_interpolation(data, labelData, nbrw=10, sorw=4000, acwe=False, acwe_al
|
|
165
165
|
bm.imageSize = int(bm.data.nbytes * 10e-7)
|
166
166
|
|
167
167
|
# add boundaries
|
168
|
-
|
169
|
-
|
170
|
-
tmp[1:-1, 1:-1, 1:-1] = bm.labelData
|
171
|
-
bm.labelData = tmp.copy(order='C')
|
172
|
-
tmp = np.zeros((1+zsh+1, 1+ysh+1, 1+xsh+1), dtype=bm.data.dtype)
|
173
|
-
tmp[1:-1, 1:-1, 1:-1] = bm.data
|
174
|
-
bm.data = tmp.copy(order='C')
|
168
|
+
bm.data = np.pad(bm.data, pad_width=1, mode='constant', constant_values=0)
|
169
|
+
bm.labelData = np.pad(bm.labelData, pad_width=1, mode='constant', constant_values=0)
|
175
170
|
bm.zsh, bm.ysh, bm.xsh = bm.data.shape
|
176
171
|
|
177
172
|
# check if labeled slices are adjacent
|
@@ -356,6 +351,8 @@ if __name__ == '__main__':
|
|
356
351
|
help='The interpolation is carried out on a remote server. Must be set up in config.py')
|
357
352
|
parser.add_argument('-q','--queue', type=int, default=0,
|
358
353
|
help='Processing queue when using a remote server')
|
354
|
+
parser.add_argument('--slicer', action='store_true', default=False,
|
355
|
+
help='Required for starting Biomedisa from 3D Slicer')
|
359
356
|
kwargs = vars(parser.parse_args())
|
360
357
|
|
361
358
|
# run interpolation
|
biomedisa/mesh.py
CHANGED
@@ -30,7 +30,7 @@
|
|
30
30
|
import os
|
31
31
|
import numpy as np
|
32
32
|
import biomedisa
|
33
|
-
from biomedisa.features.biomedisa_helper import load_data, unique_file_path
|
33
|
+
from biomedisa.features.biomedisa_helper import load_data, unique_file_path, unique
|
34
34
|
from biomedisa.features.django_env import create_pid_object
|
35
35
|
from vtk.util.numpy_support import vtk_to_numpy, numpy_to_vtk
|
36
36
|
from stl import mesh
|
@@ -107,7 +107,7 @@ def save_mesh(path_to_result, labels, x_res=1, y_res=1, z_res=1,
|
|
107
107
|
|
108
108
|
# get labels
|
109
109
|
zsh, ysh, xsh = labels.shape
|
110
|
-
allLabels =
|
110
|
+
allLabels = unique(labels)
|
111
111
|
b = np.empty_like(labels)
|
112
112
|
arr = np.empty((0,3,3))
|
113
113
|
nTotalCells = [0]
|
@@ -1,6 +1,6 @@
|
|
1
|
-
Metadata-Version: 2.
|
1
|
+
Metadata-Version: 2.4
|
2
2
|
Name: biomedisa
|
3
|
-
Version:
|
3
|
+
Version: 25.6.1
|
4
4
|
Summary: Segmentation of 3D volumetric image data
|
5
5
|
Author: Philipp Lösel
|
6
6
|
Author-email: philipp.loesel@anu.edu.au
|
@@ -13,6 +13,7 @@ Classifier: Operating System :: OS Independent
|
|
13
13
|
Requires-Python: >=3.9
|
14
14
|
Description-Content-Type: text/markdown
|
15
15
|
License-File: LICENSE
|
16
|
+
Dynamic: license-file
|
16
17
|
|
17
18
|
[](https://biomedisa.info)
|
18
19
|
-----------
|
@@ -1,27 +1,27 @@
|
|
1
1
|
biomedisa/__init__.py,sha256=hw4mzEjGFXm-vxus2DBfKFW0nKoG0ibL5SH6ShfchrY,1526
|
2
2
|
biomedisa/__main__.py,sha256=a1--8vhtztWEloHVtbM43FZLCfrFo4BELgdsgtWE8ls,536
|
3
|
-
biomedisa/deeplearning.py,sha256=
|
4
|
-
biomedisa/interpolation.py,sha256=
|
5
|
-
biomedisa/mesh.py,sha256=
|
6
|
-
biomedisa/features/DataGenerator.py,sha256=
|
3
|
+
biomedisa/deeplearning.py,sha256=7psQOP-pdRplxCGDFyfRFrRpz50VDYBhRvqVhHVGJO4,30126
|
4
|
+
biomedisa/interpolation.py,sha256=wiauUPPsklAi3aJpsXI6RjKzy00Iezvfba-ixtPfJAo,17239
|
5
|
+
biomedisa/mesh.py,sha256=ArBsKtf2m-KlWNUFMFRJgoiMcKJnHuUMtHI5NvQd4kQ,16067
|
6
|
+
biomedisa/features/DataGenerator.py,sha256=xgejeY7CpPbSHbxTBwyTFmTvSey1mb_mWhmhim-YVQ0,17734
|
7
7
|
biomedisa/features/DataGeneratorCrop.py,sha256=KtGqNadghOd59wIU9hATM_5YgSks95rS1kJ2lsSSX7w,6612
|
8
|
-
biomedisa/features/PredictDataGenerator.py,sha256=
|
8
|
+
biomedisa/features/PredictDataGenerator.py,sha256=r-iWdw4LP9Oqc2h8imvNVQkdu1vRTfKLhT2QbR5FSuM,4170
|
9
9
|
biomedisa/features/PredictDataGeneratorCrop.py,sha256=HF5tJbGtlJMHr7lMT9IiIdLG2CTjXstbKoOjlZJ93Is,3431
|
10
10
|
biomedisa/features/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
11
11
|
biomedisa/features/active_contour.py,sha256=FnPuvYck_KL4xYRFqwzm4Grdm288EdlcLFt88E0OtqA,17938
|
12
12
|
biomedisa/features/assd.py,sha256=q9NUQXEoA4Pi3d8b5fmys615CWu06Sm0N9-OGwJOFnw,6537
|
13
|
-
biomedisa/features/biomedisa_helper.py,sha256=
|
13
|
+
biomedisa/features/biomedisa_helper.py,sha256=4Tvg1XXOc-xuAYRFcVrXSnA19OJTcjO0hQRVXet_Avo,34204
|
14
14
|
biomedisa/features/create_slices.py,sha256=uSDH1OcEYc5BFPZHSy3UpS4P2DuoVnxOZ-l7wmyT_Po,13108
|
15
|
-
biomedisa/features/crop_helper.py,sha256=
|
15
|
+
biomedisa/features/crop_helper.py,sha256=6OmLSK8rH-lT8OaU3zTndnp0rpciWd1r37jKhEgyD_I,24255
|
16
16
|
biomedisa/features/curvop_numba.py,sha256=AjKQJcUBoURTB8pq1HmugQYpBwBELthhcEu51_r_xPI,7049
|
17
17
|
biomedisa/features/django_env.py,sha256=LNrZ6rBHZ5I0FaWa5xN8K-ASPgq0r5dGDEUI56HzJxE,8615
|
18
|
-
biomedisa/features/keras_helper.py,sha256=
|
18
|
+
biomedisa/features/keras_helper.py,sha256=pAcjsV5q9G1aUaNmtOaKXgcU8VZzsQ9KKsRhwEWTsh0,74619
|
19
19
|
biomedisa/features/nc_reader.py,sha256=RoRMwu3ELSNfoV3qZtaT2OWACnXb2EhNFu_DAF1T93o,7406
|
20
20
|
biomedisa/features/pid.py,sha256=Jmn1VIp0fBlgBrqZ-yUIQVVb5-NAxNBdibXALVr2PPI,2545
|
21
21
|
biomedisa/features/process_image.py,sha256=VtS3fGDvglqJiiJLPK1toe76J58j914NJ8XQKg3CRwo,11091
|
22
22
|
biomedisa/features/pycuda_test.py,sha256=UGAGIz_dgcCJkzjyCqnMlflp-WJPzpCtFQmE9C5DwIo,3275
|
23
|
-
biomedisa/features/remove_outlier.py,sha256=
|
24
|
-
biomedisa/features/split_volume.py,sha256=
|
23
|
+
biomedisa/features/remove_outlier.py,sha256=xa_a4hyEYv8dZRbBrbJyVTxzBGjgsIGZDU-XY1SSYNo,16629
|
24
|
+
biomedisa/features/split_volume.py,sha256=Selyt55ailT621XKpgcJ9IOahBETFhQZYWOUuD0P7gQ,8995
|
25
25
|
biomedisa/features/amira_to_np/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
26
26
|
biomedisa/features/amira_to_np/amira_data_stream.py,sha256=JrZTyKP01CKDFB5d9BlGtSFwBgoAo0AJeAmn3pADH88,32618
|
27
27
|
biomedisa/features/amira_to_np/amira_grammar.py,sha256=z1yajLHmn-GDb-rzZ5iHlKmPZDDbO9fNqP2jXf8z3KE,14324
|
@@ -35,10 +35,10 @@ biomedisa/features/random_walk/pycuda_small.py,sha256=rSwjq2DdtGyNGH1_EfiRQGSgEs
|
|
35
35
|
biomedisa/features/random_walk/pycuda_small_allx.py,sha256=z4koEQNWqy3EYOhHbMkO8sP6mpl6R7i8mM6OEQQ4kUQ,18225
|
36
36
|
biomedisa/features/random_walk/pyopencl_large.py,sha256=q79AxG3p3qFjxfiAZfUK9I5BAYT2prq48yEEmpP1Yjk,31015
|
37
37
|
biomedisa/features/random_walk/pyopencl_small.py,sha256=opNlS-qzOa9qWafBNJdvf6r1aRAFf7_JXf6ISDnkdXE,17068
|
38
|
-
biomedisa/features/random_walk/rw_large.py,sha256=
|
39
|
-
biomedisa/features/random_walk/rw_small.py,sha256=
|
40
|
-
biomedisa-
|
41
|
-
biomedisa-
|
42
|
-
biomedisa-
|
43
|
-
biomedisa-
|
44
|
-
biomedisa-
|
38
|
+
biomedisa/features/random_walk/rw_large.py,sha256=LtBffUEmNBU6OmcjkKUbISf2ZPTTnzXzbDlinspSm8g,20105
|
39
|
+
biomedisa/features/random_walk/rw_small.py,sha256=BudR1LVCcEPOYK45N-2400CK__MX3aVbunDwhEVvseY,15174
|
40
|
+
biomedisa-25.6.1.dist-info/licenses/LICENSE,sha256=sehayP6UhydNnmstfL4yFR3genMRdpuUh6uZVWJN1H0,14152
|
41
|
+
biomedisa-25.6.1.dist-info/METADATA,sha256=pXSLmSKc-LMVaPxdz_x2GjYj2nRxFIEUrljenX6nuFQ,9954
|
42
|
+
biomedisa-25.6.1.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
43
|
+
biomedisa-25.6.1.dist-info/top_level.txt,sha256=opsf1Eb4vCguPSxev4HHSeiUKCccT_C_RcUCdAYbHWQ,10
|
44
|
+
biomedisa-25.6.1.dist-info/RECORD,,
|
File without changes
|
File without changes
|