biomedisa 2024.5.14__py3-none-any.whl → 2024.5.16__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/biomedisa_features/active_contour.py +2 -3
- biomedisa/biomedisa_features/biomedisa_helper.py +51 -0
- biomedisa/biomedisa_features/keras_helper.py +1 -2
- biomedisa/biomedisa_features/process_image.py +2 -2
- biomedisa/biomedisa_features/random_walk/rw_large.py +1 -2
- biomedisa/biomedisa_features/random_walk/rw_small.py +1 -4
- biomedisa/biomedisa_features/remove_outlier.py +3 -3
- biomedisa/deeplearning.py +2 -3
- biomedisa/mesh.py +2 -2
- {biomedisa-2024.5.14.dist-info → biomedisa-2024.5.16.dist-info}/METADATA +2 -2
- {biomedisa-2024.5.14.dist-info → biomedisa-2024.5.16.dist-info}/RECORD +14 -14
- {biomedisa-2024.5.14.dist-info → biomedisa-2024.5.16.dist-info}/LICENSE +0 -0
- {biomedisa-2024.5.14.dist-info → biomedisa-2024.5.16.dist-info}/WHEEL +0 -0
- {biomedisa-2024.5.14.dist-info → biomedisa-2024.5.16.dist-info}/top_level.txt +0 -0
@@ -33,7 +33,7 @@ if not BASE_DIR in sys.path:
|
|
33
33
|
sys.path.append(BASE_DIR)
|
34
34
|
import biomedisa
|
35
35
|
from biomedisa_features.curvop_numba import curvop, evolution
|
36
|
-
from biomedisa_features.biomedisa_helper import (load_data, save_data,
|
36
|
+
from biomedisa_features.biomedisa_helper import (unique_file_path, load_data, save_data,
|
37
37
|
pre_processing, img_to_uint8, silent_remove)
|
38
38
|
import numpy as np
|
39
39
|
import numba
|
@@ -198,7 +198,6 @@ def activeContour(data, labelData, alpha=1.0, smooth=1, steps=3,
|
|
198
198
|
|
199
199
|
# save result
|
200
200
|
if bm.django_env and not bm.remote:
|
201
|
-
from biomedisa_app.views import unique_file_path
|
202
201
|
path_to_acwe = unique_file_path(path_to_acwe)
|
203
202
|
if bm.path_to_data:
|
204
203
|
save_data(path_to_acwe, final, bm.header, bm.final_image_type, bm.compression)
|
@@ -288,7 +287,7 @@ def init_active_contour(image_id, friend_id, label_id, simple=False):
|
|
288
287
|
django.setup()
|
289
288
|
from biomedisa_app.models import Upload
|
290
289
|
from biomedisa_app.config import config
|
291
|
-
from biomedisa_app.views import send_data_to_host, qsub_start, qsub_stop
|
290
|
+
from biomedisa_app.views import send_data_to_host, qsub_start, qsub_stop
|
292
291
|
|
293
292
|
# get objects
|
294
293
|
try:
|
@@ -43,6 +43,7 @@ import zipfile
|
|
43
43
|
import numba
|
44
44
|
import shutil
|
45
45
|
import subprocess
|
46
|
+
import re
|
46
47
|
import math
|
47
48
|
|
48
49
|
def silent_remove(filename):
|
@@ -51,6 +52,56 @@ def silent_remove(filename):
|
|
51
52
|
except OSError:
|
52
53
|
pass
|
53
54
|
|
55
|
+
# create a unique filename
|
56
|
+
def unique_file_path(path, dir_path=BASE_DIR+'/private_storage/'):
|
57
|
+
|
58
|
+
# get extension
|
59
|
+
username = os.path.basename(os.path.dirname(path))
|
60
|
+
filename = os.path.basename(path)
|
61
|
+
filename, extension = os.path.splitext(filename)
|
62
|
+
if extension == '.gz':
|
63
|
+
filename, extension = os.path.splitext(filename)
|
64
|
+
if extension == '.nii':
|
65
|
+
extension = '.nii.gz'
|
66
|
+
elif extension == '.tar':
|
67
|
+
extension = '.tar.gz'
|
68
|
+
|
69
|
+
# get suffix
|
70
|
+
suffix = re.search("-[0-999]"+extension, path)
|
71
|
+
if suffix:
|
72
|
+
suffix = suffix.group()
|
73
|
+
filename = os.path.basename(path)
|
74
|
+
filename = filename[:-len(suffix)]
|
75
|
+
i = int(suffix[1:-len(extension)]) + 1
|
76
|
+
else:
|
77
|
+
suffix = extension
|
78
|
+
i = 1
|
79
|
+
|
80
|
+
# get finaltype
|
81
|
+
addon = ''
|
82
|
+
for feature in ['.filled','.smooth','.acwe','.cleaned','.8bit','.refined', '.cropped',
|
83
|
+
'.uncertainty','.smooth.cleaned','.cleaned.filled','.denoised']:
|
84
|
+
if filename[-len(feature):] == feature:
|
85
|
+
addon = feature
|
86
|
+
|
87
|
+
if addon:
|
88
|
+
filename = filename[:-len(addon)]
|
89
|
+
|
90
|
+
# maximum lenght of path
|
91
|
+
pic_path = f'images/{username}/{filename}'
|
92
|
+
limit = 100 - len(addon) - len(suffix)
|
93
|
+
path = dir_path + pic_path[:limit] + addon + suffix
|
94
|
+
|
95
|
+
# check if file already exists
|
96
|
+
file_already_exists = os.path.exists(path)
|
97
|
+
while file_already_exists:
|
98
|
+
limit = 100 - len(addon) - len('-') - len(str(i)) - len(extension)
|
99
|
+
path = dir_path + pic_path[:limit] + addon + '-' + str(i) + extension
|
100
|
+
file_already_exists = os.path.exists(path)
|
101
|
+
i += 1
|
102
|
+
|
103
|
+
return path
|
104
|
+
|
54
105
|
def Dice_score(ground_truth, result, average_dice=False):
|
55
106
|
if average_dice:
|
56
107
|
dice = 0
|
@@ -43,7 +43,7 @@ from tensorflow.keras.callbacks import Callback, ModelCheckpoint, EarlyStopping
|
|
43
43
|
from biomedisa_features.DataGenerator import DataGenerator
|
44
44
|
from biomedisa_features.PredictDataGenerator import PredictDataGenerator
|
45
45
|
from biomedisa_features.biomedisa_helper import (
|
46
|
-
img_resize, load_data, save_data, set_labels_to_zero, id_generator)
|
46
|
+
img_resize, load_data, save_data, set_labels_to_zero, id_generator, unique_file_path)
|
47
47
|
from biomedisa_features.remove_outlier import clean, fill
|
48
48
|
from biomedisa_features.active_contour import activeContour
|
49
49
|
import matplotlib.pyplot as plt
|
@@ -1148,7 +1148,6 @@ def predict_semantic_segmentation(bm, img, path_to_model,
|
|
1148
1148
|
extension = '.nii.gz'
|
1149
1149
|
bm.path_to_final = os.path.splitext(bm.path_to_final)[0] + extension
|
1150
1150
|
if bm.django_env and not bm.remote and not bm.tmp_dir:
|
1151
|
-
from biomedisa_app.views import unique_file_path
|
1152
1151
|
bm.path_to_final = unique_file_path(bm.path_to_final)
|
1153
1152
|
|
1154
1153
|
# handle amira header
|
@@ -32,7 +32,7 @@ BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
|
|
32
32
|
if not BASE_DIR in sys.path:
|
33
33
|
sys.path.append(BASE_DIR)
|
34
34
|
import numpy as np
|
35
|
-
from biomedisa_features.biomedisa_helper import (load_data, save_data,
|
35
|
+
from biomedisa_features.biomedisa_helper import (load_data, save_data, unique_file_path,
|
36
36
|
img_to_uint8, smooth_img_3x3)
|
37
37
|
from biomedisa_features.create_slices import create_slices
|
38
38
|
from shutil import copytree
|
@@ -46,7 +46,7 @@ def init_process_image(id, process=None):
|
|
46
46
|
django.setup()
|
47
47
|
from biomedisa_app.models import Upload
|
48
48
|
from biomedisa_app.config import config
|
49
|
-
from biomedisa_app.views import send_data_to_host, qsub_start, qsub_stop
|
49
|
+
from biomedisa_app.views import send_data_to_host, qsub_start, qsub_stop
|
50
50
|
from redis import Redis
|
51
51
|
from rq import Queue
|
52
52
|
|
@@ -28,7 +28,7 @@
|
|
28
28
|
|
29
29
|
from biomedisa_features.remove_outlier import clean, fill
|
30
30
|
from biomedisa_features.active_contour import activeContour
|
31
|
-
from biomedisa_features.biomedisa_helper import (_get_device, save_data, _error_,
|
31
|
+
from biomedisa_features.biomedisa_helper import (_get_device, save_data, _error_, unique_file_path,
|
32
32
|
splitlargedata, read_labeled_slices_allx_large, read_labeled_slices_large, sendToChildLarge,
|
33
33
|
Dice_score)
|
34
34
|
from mpi4py import MPI
|
@@ -184,7 +184,6 @@ def _diffusion_child(comm, bm=None):
|
|
184
184
|
final_result = final_result[1:-1, 1:-1, 1:-1]
|
185
185
|
results['regular'] = final_result
|
186
186
|
if bm.django_env and not bm.remote:
|
187
|
-
from biomedisa_app.views import unique_file_path
|
188
187
|
bm.path_to_final = unique_file_path(bm.path_to_final)
|
189
188
|
if bm.path_to_data:
|
190
189
|
save_data(bm.path_to_final, final_result, bm.header, bm.final_image_type, bm.compression)
|
@@ -28,7 +28,7 @@
|
|
28
28
|
|
29
29
|
from biomedisa_features.remove_outlier import clean, fill
|
30
30
|
from biomedisa_features.active_contour import activeContour
|
31
|
-
from biomedisa_features.biomedisa_helper import (_get_device, save_data,
|
31
|
+
from biomedisa_features.biomedisa_helper import (_get_device, save_data, unique_file_path,
|
32
32
|
sendToChild, _split_indices, get_labels, Dice_score)
|
33
33
|
from mpi4py import MPI
|
34
34
|
import numpy as np
|
@@ -105,9 +105,6 @@ def _diffusion_child(comm, bm=None):
|
|
105
105
|
xsh_gpu = np.int32(xsh_tmp)
|
106
106
|
ysh_gpu = np.int32(ysh_tmp)
|
107
107
|
|
108
|
-
if bm.django_env:
|
109
|
-
from biomedisa_app.views import unique_file_path
|
110
|
-
|
111
108
|
# smooth
|
112
109
|
if bm.smooth:
|
113
110
|
try:
|
@@ -32,7 +32,8 @@ BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
|
|
32
32
|
if not BASE_DIR in sys.path:
|
33
33
|
sys.path.append(BASE_DIR)
|
34
34
|
import biomedisa
|
35
|
-
from biomedisa_features.biomedisa_helper import load_data, save_data,
|
35
|
+
from biomedisa_features.biomedisa_helper import (load_data, save_data,
|
36
|
+
unique_file_path, silent_remove)
|
36
37
|
import numpy as np
|
37
38
|
from scipy import ndimage
|
38
39
|
import argparse
|
@@ -179,7 +180,6 @@ def main_helper(path_to_labels, img_id=None, friend_id=None, fill_holes=True,
|
|
179
180
|
|
180
181
|
# unique_file_paths
|
181
182
|
if django_env and not remote:
|
182
|
-
from biomedisa_app.views import unique_file_path
|
183
183
|
path_to_cleaned = unique_file_path(path_to_cleaned)
|
184
184
|
path_to_filled = unique_file_path(path_to_filled)
|
185
185
|
path_to_cleaned_filled = unique_file_path(path_to_cleaned_filled)
|
@@ -266,7 +266,7 @@ def init_remove_outlier(image_id, final_id, label_id, fill_holes=True):
|
|
266
266
|
django.setup()
|
267
267
|
from biomedisa_app.models import Upload
|
268
268
|
from biomedisa_app.config import config
|
269
|
-
from biomedisa_app.views import send_data_to_host, qsub_start, qsub_stop
|
269
|
+
from biomedisa_app.views import send_data_to_host, qsub_start, qsub_stop
|
270
270
|
|
271
271
|
# get objects
|
272
272
|
try:
|
biomedisa/deeplearning.py
CHANGED
@@ -33,7 +33,7 @@ sys.path.append(BASE_DIR)
|
|
33
33
|
import biomedisa
|
34
34
|
import biomedisa_features.crop_helper as ch
|
35
35
|
from biomedisa_features.keras_helper import *
|
36
|
-
from biomedisa_features.biomedisa_helper import _error_
|
36
|
+
from biomedisa_features.biomedisa_helper import _error_, unique_file_path
|
37
37
|
from tensorflow.python.framework.errors_impl import ResourceExhaustedError
|
38
38
|
import tensorflow as tf
|
39
39
|
import numpy as np
|
@@ -100,8 +100,6 @@ def deep_learning(img_data, label_data=None, val_img_data=None, val_label_data=N
|
|
100
100
|
|
101
101
|
# django environment
|
102
102
|
if bm.django_env:
|
103
|
-
from biomedisa_app.views import unique_file_path
|
104
|
-
from biomedisa_features.django_env import create_pid_object
|
105
103
|
|
106
104
|
# path to image data
|
107
105
|
if bm.train:
|
@@ -130,6 +128,7 @@ def deep_learning(img_data, label_data=None, val_img_data=None, val_label_data=N
|
|
130
128
|
project = os.path.splitext(os.path.basename(bm.path_to_model))[0]
|
131
129
|
|
132
130
|
# create pid object
|
131
|
+
from biomedisa_features.django_env import create_pid_object
|
133
132
|
create_pid_object(os.getpid(), bm.remote, bm.queue, bm.img_id, (bm.path_to_model if bm.train else ''))
|
134
133
|
|
135
134
|
# write in log file
|
biomedisa/mesh.py
CHANGED
@@ -32,7 +32,7 @@ BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
|
|
32
32
|
if not BASE_DIR in sys.path:
|
33
33
|
sys.path.append(BASE_DIR)
|
34
34
|
import numpy as np
|
35
|
-
from biomedisa_features.biomedisa_helper import load_data
|
35
|
+
from biomedisa_features.biomedisa_helper import load_data, unique_file_path
|
36
36
|
from biomedisa_features.django_env import create_pid_object
|
37
37
|
from vtk.util.numpy_support import vtk_to_numpy, numpy_to_vtk
|
38
38
|
from stl import mesh
|
@@ -215,7 +215,7 @@ def init_create_mesh(id):
|
|
215
215
|
django.setup()
|
216
216
|
from biomedisa_app.models import Upload
|
217
217
|
from biomedisa_app.config import config
|
218
|
-
from biomedisa_app.views import send_data_to_host, qsub_start, qsub_stop
|
218
|
+
from biomedisa_app.views import send_data_to_host, qsub_start, qsub_stop
|
219
219
|
|
220
220
|
# get object
|
221
221
|
try:
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: biomedisa
|
3
|
-
Version: 2024.5.
|
3
|
+
Version: 2024.5.16
|
4
4
|
Summary: Segmentation of 3D volumetric image data
|
5
5
|
Author: Philipp Lösel
|
6
6
|
Author-email: philipp.loesel@anu.edu.au
|
@@ -10,7 +10,7 @@ Project-URL: GitHub, https://github.com/biomedisa/biomedisa
|
|
10
10
|
Classifier: Programming Language :: Python :: 3
|
11
11
|
Classifier: License :: OSI Approved :: European Union Public Licence 1.2 (EUPL 1.2)
|
12
12
|
Classifier: Operating System :: OS Independent
|
13
|
-
Requires-Python: >=3.
|
13
|
+
Requires-Python: >=3.8
|
14
14
|
Description-Content-Type: text/markdown
|
15
15
|
License-File: LICENSE
|
16
16
|
|
@@ -1,26 +1,26 @@
|
|
1
1
|
biomedisa/__init__.py,sha256=BLbuGv-c8I8XMzOOnc07qrcWxq8CUA5NM73S3gkixEI,1690
|
2
2
|
biomedisa/__main__.py,sha256=a1--8vhtztWEloHVtbM43FZLCfrFo4BELgdsgtWE8ls,536
|
3
|
-
biomedisa/deeplearning.py,sha256=
|
3
|
+
biomedisa/deeplearning.py,sha256=eobgRva1ucb1IKpj7SNxmBOsWdZCPAJ-BNbIKnApNeA,27063
|
4
4
|
biomedisa/interpolation.py,sha256=mz5Ieiee2RftqisqNzKcCU7IV1n0LGON4zyhvBwE94s,17335
|
5
|
-
biomedisa/mesh.py,sha256=
|
5
|
+
biomedisa/mesh.py,sha256=6f5klVPoA3zmF3jxLCOUkCXelLtlroS6tJquRHaMwsQ,15920
|
6
6
|
biomedisa/biomedisa_features/DataGenerator.py,sha256=FTktX35_FboSzk4UXG_ZN58xXYJqwjX_7ZJ65bzNuFs,12770
|
7
7
|
biomedisa/biomedisa_features/DataGeneratorCrop.py,sha256=cL_1rbXSq79vCNAHnIwvow-J1s-4gWStR1pWTbF_VTY,5454
|
8
8
|
biomedisa/biomedisa_features/PredictDataGenerator.py,sha256=MISkB2tlxCw6rd8pfwwz1clVnvyPwg5dB-8yxR6WsBw,4074
|
9
9
|
biomedisa/biomedisa_features/PredictDataGeneratorCrop.py,sha256=JBwFcOZMakNMlL5UvP5bNg9FlQl5sbrM9UVSCyFhwBQ,3431
|
10
10
|
biomedisa/biomedisa_features/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
11
|
-
biomedisa/biomedisa_features/active_contour.py,sha256=
|
11
|
+
biomedisa/biomedisa_features/active_contour.py,sha256=PUAfCzHKU-p7xeQoWxmDh0ZFbnInXEsafgeE1k-96d0,18131
|
12
12
|
biomedisa/biomedisa_features/assd.py,sha256=cXHAhwJqhwOvzgTodlQb21NvYafWTjBJ7_H_icuBNMU,6537
|
13
|
-
biomedisa/biomedisa_features/biomedisa_helper.py,sha256=
|
13
|
+
biomedisa/biomedisa_features/biomedisa_helper.py,sha256=fY7kHLg5VBLF4f_W-p9tZaeqZn6wCq9OHPImZC41GRU,32401
|
14
14
|
biomedisa/biomedisa_features/create_slices.py,sha256=gQJev1-DXvqDchGbnLC1bsCtb1gAnv4D82IgOnCJVt8,13329
|
15
15
|
biomedisa/biomedisa_features/crop_helper.py,sha256=Op8x10IltAR_5YMotuVHzF3hSbxiOkAchhJM5L0qutw,23894
|
16
16
|
biomedisa/biomedisa_features/curvop_numba.py,sha256=9jc4OvHQ6JDN-DaFhRQMLpBDU85HhqzX_YUVBf3Q3vA,7049
|
17
17
|
biomedisa/biomedisa_features/django_env.py,sha256=S-ajQpw5A2aBlTYgn_FiyIr02QH05rInzhBDulb9lNg,8989
|
18
|
-
biomedisa/biomedisa_features/keras_helper.py,sha256=
|
18
|
+
biomedisa/biomedisa_features/keras_helper.py,sha256=J4VZNPgdoQSH5wnCcdkubRhxquNmPOUzEAlSkTZltuw,50343
|
19
19
|
biomedisa/biomedisa_features/nc_reader.py,sha256=7uwdmz4pLC__xb8hWjZ7Y9jrkNJOyD01kIA1EOP8GV0,7406
|
20
20
|
biomedisa/biomedisa_features/pid.py,sha256=HAIq52F-PKwDGRyKE74qsY-bdBTs1s85vcIQTKaMIy8,2528
|
21
|
-
biomedisa/biomedisa_features/process_image.py,sha256=
|
21
|
+
biomedisa/biomedisa_features/process_image.py,sha256=yxBC3ACV2umscEycXZtY9Hsi1ATws7omnvXROEDfQfA,11159
|
22
22
|
biomedisa/biomedisa_features/pycuda_test.py,sha256=LLd5JnlDu1hOZUTFs8IbuE2I2sBSRyZaU3sRdNpdy5Y,3274
|
23
|
-
biomedisa/biomedisa_features/remove_outlier.py,sha256=
|
23
|
+
biomedisa/biomedisa_features/remove_outlier.py,sha256=V-3E7w3SGwmHMBCk1QzVoUJFdMV_NEYkUZG_-R15bqI,16801
|
24
24
|
biomedisa/biomedisa_features/split_volume.py,sha256=yBdoO3ojEphnfs9P-Ap8NPFrmb-WM8CCZSV9deIEASs,12394
|
25
25
|
biomedisa/biomedisa_features/amira_to_np/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
26
26
|
biomedisa/biomedisa_features/amira_to_np/amira_data_stream.py,sha256=JrZTyKP01CKDFB5d9BlGtSFwBgoAo0AJeAmn3pADH88,32618
|
@@ -35,10 +35,10 @@ biomedisa/biomedisa_features/random_walk/pycuda_small.py,sha256=691oa8JhVwDmS-y7
|
|
35
35
|
biomedisa/biomedisa_features/random_walk/pycuda_small_allx.py,sha256=8bNHDKDxa-02q1ykWo_YWjzYQkM77raX_DivpWkVoQY,18225
|
36
36
|
biomedisa/biomedisa_features/random_walk/pyopencl_large.py,sha256=cOBhvxrdKCkbr6xaKneBTiUMXPk9lSdjwt95TdHC2EY,31015
|
37
37
|
biomedisa/biomedisa_features/random_walk/pyopencl_small.py,sha256=2XALYNNv9D8Gb1u2lcjR1O4W9UM0Xxjj0r4nr-NiEkk,17068
|
38
|
-
biomedisa/biomedisa_features/random_walk/rw_large.py,sha256=
|
39
|
-
biomedisa/biomedisa_features/random_walk/rw_small.py,sha256=
|
40
|
-
biomedisa-2024.5.
|
41
|
-
biomedisa-2024.5.
|
42
|
-
biomedisa-2024.5.
|
43
|
-
biomedisa-2024.5.
|
44
|
-
biomedisa-2024.5.
|
38
|
+
biomedisa/biomedisa_features/random_walk/rw_large.py,sha256=FERIsTXmqZprGCTShRR75PesIX5MMVtptk-SqI-4abo,19805
|
39
|
+
biomedisa/biomedisa_features/random_walk/rw_small.py,sha256=0YFL0Ovb_400Ikbxv5yOXWskl3vAyfQ_0_Gz5EXzvVQ,14881
|
40
|
+
biomedisa-2024.5.16.dist-info/LICENSE,sha256=sehayP6UhydNnmstfL4yFR3genMRdpuUh6uZVWJN1H0,14152
|
41
|
+
biomedisa-2024.5.16.dist-info/METADATA,sha256=h2Eq4HFLRDvAG4P-TgLp1FgQkq6_p50v1pYxtSCSA7k,11677
|
42
|
+
biomedisa-2024.5.16.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
|
43
|
+
biomedisa-2024.5.16.dist-info/top_level.txt,sha256=opsf1Eb4vCguPSxev4HHSeiUKCccT_C_RcUCdAYbHWQ,10
|
44
|
+
biomedisa-2024.5.16.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|