biomedisa 2024.5.14__tar.gz → 2024.5.16__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 (48) hide show
  1. {biomedisa-2024.5.14 → biomedisa-2024.5.16}/PKG-INFO +2 -2
  2. {biomedisa-2024.5.14 → biomedisa-2024.5.16}/pyproject.toml +2 -2
  3. {biomedisa-2024.5.14 → biomedisa-2024.5.16}/src/biomedisa/biomedisa_features/active_contour.py +2 -3
  4. {biomedisa-2024.5.14 → biomedisa-2024.5.16}/src/biomedisa/biomedisa_features/biomedisa_helper.py +51 -0
  5. {biomedisa-2024.5.14 → biomedisa-2024.5.16}/src/biomedisa/biomedisa_features/keras_helper.py +1 -2
  6. {biomedisa-2024.5.14 → biomedisa-2024.5.16}/src/biomedisa/biomedisa_features/process_image.py +2 -2
  7. {biomedisa-2024.5.14 → biomedisa-2024.5.16}/src/biomedisa/biomedisa_features/random_walk/rw_large.py +1 -2
  8. {biomedisa-2024.5.14 → biomedisa-2024.5.16}/src/biomedisa/biomedisa_features/random_walk/rw_small.py +1 -4
  9. {biomedisa-2024.5.14 → biomedisa-2024.5.16}/src/biomedisa/biomedisa_features/remove_outlier.py +3 -3
  10. {biomedisa-2024.5.14 → biomedisa-2024.5.16}/src/biomedisa/deeplearning.py +2 -3
  11. {biomedisa-2024.5.14 → biomedisa-2024.5.16}/src/biomedisa/mesh.py +2 -2
  12. {biomedisa-2024.5.14 → biomedisa-2024.5.16}/src/biomedisa.egg-info/PKG-INFO +2 -2
  13. {biomedisa-2024.5.14 → biomedisa-2024.5.16}/LICENSE +0 -0
  14. {biomedisa-2024.5.14 → biomedisa-2024.5.16}/README.md +0 -0
  15. {biomedisa-2024.5.14 → biomedisa-2024.5.16}/setup.cfg +0 -0
  16. {biomedisa-2024.5.14 → biomedisa-2024.5.16}/src/biomedisa/__init__.py +0 -0
  17. {biomedisa-2024.5.14 → biomedisa-2024.5.16}/src/biomedisa/__main__.py +0 -0
  18. {biomedisa-2024.5.14 → biomedisa-2024.5.16}/src/biomedisa/biomedisa_features/DataGenerator.py +0 -0
  19. {biomedisa-2024.5.14 → biomedisa-2024.5.16}/src/biomedisa/biomedisa_features/DataGeneratorCrop.py +0 -0
  20. {biomedisa-2024.5.14 → biomedisa-2024.5.16}/src/biomedisa/biomedisa_features/PredictDataGenerator.py +0 -0
  21. {biomedisa-2024.5.14 → biomedisa-2024.5.16}/src/biomedisa/biomedisa_features/PredictDataGeneratorCrop.py +0 -0
  22. {biomedisa-2024.5.14 → biomedisa-2024.5.16}/src/biomedisa/biomedisa_features/__init__.py +0 -0
  23. {biomedisa-2024.5.14 → biomedisa-2024.5.16}/src/biomedisa/biomedisa_features/amira_to_np/__init__.py +0 -0
  24. {biomedisa-2024.5.14 → biomedisa-2024.5.16}/src/biomedisa/biomedisa_features/amira_to_np/amira_data_stream.py +0 -0
  25. {biomedisa-2024.5.14 → biomedisa-2024.5.16}/src/biomedisa/biomedisa_features/amira_to_np/amira_grammar.py +0 -0
  26. {biomedisa-2024.5.14 → biomedisa-2024.5.16}/src/biomedisa/biomedisa_features/amira_to_np/amira_header.py +0 -0
  27. {biomedisa-2024.5.14 → biomedisa-2024.5.16}/src/biomedisa/biomedisa_features/amira_to_np/amira_helper.py +0 -0
  28. {biomedisa-2024.5.14 → biomedisa-2024.5.16}/src/biomedisa/biomedisa_features/assd.py +0 -0
  29. {biomedisa-2024.5.14 → biomedisa-2024.5.16}/src/biomedisa/biomedisa_features/create_slices.py +0 -0
  30. {biomedisa-2024.5.14 → biomedisa-2024.5.16}/src/biomedisa/biomedisa_features/crop_helper.py +0 -0
  31. {biomedisa-2024.5.14 → biomedisa-2024.5.16}/src/biomedisa/biomedisa_features/curvop_numba.py +0 -0
  32. {biomedisa-2024.5.14 → biomedisa-2024.5.16}/src/biomedisa/biomedisa_features/django_env.py +0 -0
  33. {biomedisa-2024.5.14 → biomedisa-2024.5.16}/src/biomedisa/biomedisa_features/nc_reader.py +0 -0
  34. {biomedisa-2024.5.14 → biomedisa-2024.5.16}/src/biomedisa/biomedisa_features/pid.py +0 -0
  35. {biomedisa-2024.5.14 → biomedisa-2024.5.16}/src/biomedisa/biomedisa_features/pycuda_test.py +0 -0
  36. {biomedisa-2024.5.14 → biomedisa-2024.5.16}/src/biomedisa/biomedisa_features/random_walk/__init__.py +0 -0
  37. {biomedisa-2024.5.14 → biomedisa-2024.5.16}/src/biomedisa/biomedisa_features/random_walk/gpu_kernels.py +0 -0
  38. {biomedisa-2024.5.14 → biomedisa-2024.5.16}/src/biomedisa/biomedisa_features/random_walk/pycuda_large.py +0 -0
  39. {biomedisa-2024.5.14 → biomedisa-2024.5.16}/src/biomedisa/biomedisa_features/random_walk/pycuda_large_allx.py +0 -0
  40. {biomedisa-2024.5.14 → biomedisa-2024.5.16}/src/biomedisa/biomedisa_features/random_walk/pycuda_small.py +0 -0
  41. {biomedisa-2024.5.14 → biomedisa-2024.5.16}/src/biomedisa/biomedisa_features/random_walk/pycuda_small_allx.py +0 -0
  42. {biomedisa-2024.5.14 → biomedisa-2024.5.16}/src/biomedisa/biomedisa_features/random_walk/pyopencl_large.py +0 -0
  43. {biomedisa-2024.5.14 → biomedisa-2024.5.16}/src/biomedisa/biomedisa_features/random_walk/pyopencl_small.py +0 -0
  44. {biomedisa-2024.5.14 → biomedisa-2024.5.16}/src/biomedisa/biomedisa_features/split_volume.py +0 -0
  45. {biomedisa-2024.5.14 → biomedisa-2024.5.16}/src/biomedisa/interpolation.py +0 -0
  46. {biomedisa-2024.5.14 → biomedisa-2024.5.16}/src/biomedisa.egg-info/SOURCES.txt +0 -0
  47. {biomedisa-2024.5.14 → biomedisa-2024.5.16}/src/biomedisa.egg-info/dependency_links.txt +0 -0
  48. {biomedisa-2024.5.14 → biomedisa-2024.5.16}/src/biomedisa.egg-info/top_level.txt +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: biomedisa
3
- Version: 2024.5.14
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.10
13
+ Requires-Python: >=3.8
14
14
  Description-Content-Type: text/markdown
15
15
  License-File: LICENSE
16
16
 
@@ -4,13 +4,13 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "biomedisa"
7
- version = "2024.5.14"
7
+ version = "2024.5.16"
8
8
  authors = [
9
9
  { name="Philipp Lösel"}, {email="philipp.loesel@anu.edu.au" },
10
10
  ]
11
11
  description = "Segmentation of 3D volumetric image data"
12
12
  readme = "README.md"
13
- requires-python = ">=3.10"
13
+ requires-python = ">=3.8"
14
14
  classifiers = [
15
15
  "Programming Language :: Python :: 3",
16
16
  "License :: OSI Approved :: European Union Public Licence 1.2 (EUPL 1.2)",
@@ -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, unique_file_path
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, unique_file_path
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, silent_remove
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, unique_file_path
269
+ from biomedisa_app.views import send_data_to_host, qsub_start, qsub_stop
270
270
 
271
271
  # get objects
272
272
  try:
@@ -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
@@ -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, unique_file_path
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.14
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.10
13
+ Requires-Python: >=3.8
14
14
  Description-Content-Type: text/markdown
15
15
  License-File: LICENSE
16
16
 
File without changes
File without changes
File without changes