biomedisa 24.7.1__py3-none-any.whl → 24.8.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 +4 -2
- biomedisa/features/biomedisa_helper.py +20 -11
- biomedisa/features/crop_helper.py +2 -1
- biomedisa/features/keras_helper.py +12 -5
- biomedisa/interpolation.py +1 -0
- {biomedisa-24.7.1.dist-info → biomedisa-24.8.1.dist-info}/METADATA +9 -8
- {biomedisa-24.7.1.dist-info → biomedisa-24.8.1.dist-info}/RECORD +10 -10
- {biomedisa-24.7.1.dist-info → biomedisa-24.8.1.dist-info}/WHEEL +1 -1
- {biomedisa-24.7.1.dist-info → biomedisa-24.8.1.dist-info}/LICENSE +0 -0
- {biomedisa-24.7.1.dist-info → biomedisa-24.8.1.dist-info}/top_level.txt +0 -0
biomedisa/deeplearning.py
CHANGED
@@ -220,7 +220,7 @@ def deep_learning(img_data, label_data=None, val_img_data=None, val_label_data=N
|
|
220
220
|
normalization_parameters = np.array(meta['normalization'], dtype=float)
|
221
221
|
else:
|
222
222
|
normalization_parameters = np.array([[mu],[sig]])
|
223
|
-
allLabels = np.array(meta.get('labels'))
|
223
|
+
bm.allLabels = np.array(meta.get('labels'))
|
224
224
|
if 'patch_normalization' in meta:
|
225
225
|
bm.patch_normalization = bool(meta['patch_normalization'][()])
|
226
226
|
if 'scaling' in meta:
|
@@ -293,7 +293,7 @@ def deep_learning(img_data, label_data=None, val_img_data=None, val_label_data=N
|
|
293
293
|
|
294
294
|
# make prediction
|
295
295
|
results, bm = predict_semantic_segmentation(bm,
|
296
|
-
header, img_header,
|
296
|
+
header, img_header,
|
297
297
|
region_of_interest, extension, img_data,
|
298
298
|
channels, normalization_parameters)
|
299
299
|
|
@@ -479,6 +479,8 @@ if __name__ == '__main__':
|
|
479
479
|
help='Processing queue when using a remote server')
|
480
480
|
parser.add_argument('-hf','--header_file', type=str, metavar='PATH', default=None,
|
481
481
|
help='Location of header file')
|
482
|
+
parser.add_argument('-ext','--extension', type=str, default='.tif',
|
483
|
+
help='Save data for example as NRRD file using --extension=".nrrd"')
|
482
484
|
bm = parser.parse_args()
|
483
485
|
bm.success = True
|
484
486
|
|
@@ -416,25 +416,33 @@ def pre_processing(bm):
|
|
416
416
|
if bm.labelData is None:
|
417
417
|
return _error_(bm, 'Invalid label data.')
|
418
418
|
|
419
|
+
# dimension errors
|
419
420
|
if len(bm.labelData.shape) != 3:
|
420
|
-
return _error_(bm, 'Label must be three-dimensional.')
|
421
|
-
|
421
|
+
return _error_(bm, 'Label data must be three-dimensional.')
|
422
422
|
if bm.data.shape != bm.labelData.shape:
|
423
|
-
return _error_(bm, 'Image and label must have the same x,y,z-dimensions.')
|
423
|
+
return _error_(bm, 'Image and label data must have the same x,y,z-dimensions.')
|
424
|
+
|
425
|
+
# label data type
|
426
|
+
if bm.labelData.dtype in ['float16','float32','float64']:
|
427
|
+
if bm.django_env:
|
428
|
+
return _error_(bm, 'Label data must be of integer type.')
|
429
|
+
print(f'Warning: Potential label loss during conversion from {bm.labelData.dtype} to int32.')
|
430
|
+
bm.labelData = bm.labelData.astype(np.int32)
|
424
431
|
|
425
432
|
# get labels
|
426
433
|
bm.allLabels = np.unique(bm.labelData)
|
427
434
|
index = np.argwhere(bm.allLabels<0)
|
428
435
|
bm.allLabels = np.delete(bm.allLabels, index)
|
429
436
|
|
430
|
-
|
431
|
-
return _error_(bm, 'No labels higher than 255 allowed.')
|
432
|
-
|
437
|
+
# labels greater than 255
|
433
438
|
if np.any(bm.allLabels > 255):
|
434
|
-
bm.
|
435
|
-
|
436
|
-
|
437
|
-
|
439
|
+
if bm.django_env:
|
440
|
+
return _error_(bm, 'No labels greater than 255 allowed.')
|
441
|
+
else:
|
442
|
+
bm.labelData[bm.labelData > 255] = 0
|
443
|
+
index = np.argwhere(bm.allLabels > 255)
|
444
|
+
bm.allLabels = np.delete(bm.allLabels, index)
|
445
|
+
print('Warning: Only labels <=255 are allowed. Labels greater than 255 will be removed.')
|
438
446
|
|
439
447
|
# add background label if not existing
|
440
448
|
if not np.any(bm.allLabels==0):
|
@@ -486,7 +494,8 @@ def save_data(path_to_final, final, header=None, final_image_type=None, compress
|
|
486
494
|
np_to_nc(path_to_final, final, header)
|
487
495
|
elif final_image_type in ['.hdr', '.mhd', '.mha', '.nrrd', '.nii', '.nii.gz']:
|
488
496
|
simg = sitk.GetImageFromArray(final)
|
489
|
-
|
497
|
+
if header is not None:
|
498
|
+
simg.CopyInformation(header)
|
490
499
|
sitk.WriteImage(simg, path_to_final, useCompression=compress)
|
491
500
|
elif final_image_type in ['.zip', 'directory', '']:
|
492
501
|
with tempfile.TemporaryDirectory() as temp_dir:
|
@@ -542,7 +542,8 @@ def load_and_train(normalize,path_to_img,path_to_labels,path_to_model,
|
|
542
542
|
cropping_weights.append(arr)
|
543
543
|
|
544
544
|
# configuration data
|
545
|
-
cropping_config = np.array([channels, x_scale, y_scale, z_scale, normalize,
|
545
|
+
cropping_config = np.array([channels, x_scale, y_scale, z_scale, normalize,
|
546
|
+
normalization_parameters[0,0], normalization_parameters[1,0]])
|
546
547
|
|
547
548
|
return cropping_weights, cropping_config, normalization_parameters
|
548
549
|
|
@@ -780,7 +780,9 @@ def train_semantic_segmentation(bm,
|
|
780
780
|
bm.only, bm.ignore, img, label, None, None, header, extension)
|
781
781
|
|
782
782
|
# configuration data
|
783
|
-
configuration_data = np.array([bm.channels,
|
783
|
+
configuration_data = np.array([bm.channels,
|
784
|
+
bm.x_scale, bm.y_scale, bm.z_scale, bm.normalize,
|
785
|
+
normalization_parameters[0,0], normalization_parameters[1,0]])
|
784
786
|
|
785
787
|
# img shape
|
786
788
|
zsh, ysh, xsh, _ = img.shape
|
@@ -959,6 +961,10 @@ def load_prediction_data(bm, channels, normalize, normalization_parameters,
|
|
959
961
|
img_header = None
|
960
962
|
tif = TiffFile(bm.path_to_image)
|
961
963
|
img = imread(bm.path_to_image, key=range(z,min(len(tif.pages),z+bm.z_patch)))
|
964
|
+
if img.shape[0] < bm.z_patch:
|
965
|
+
rest = bm.z_patch - img.shape[0]
|
966
|
+
tmp = imread(bm.path_to_image, key=range(len(tif.pages)-rest,len(tif.pages)))
|
967
|
+
img = np.append(img, tmp[::-1], axis=0)
|
962
968
|
else:
|
963
969
|
img, img_header = load_data(bm.path_to_image, 'first_queue')
|
964
970
|
|
@@ -1032,7 +1038,7 @@ def append_ghost_areas(bm, img):
|
|
1032
1038
|
return img, z_rest, y_rest, x_rest
|
1033
1039
|
|
1034
1040
|
def predict_semantic_segmentation(bm,
|
1035
|
-
header, img_header,
|
1041
|
+
header, img_header,
|
1036
1042
|
region_of_interest, extension, img_data,
|
1037
1043
|
channels, normalization_parameters):
|
1038
1044
|
|
@@ -1040,7 +1046,8 @@ def predict_semantic_segmentation(bm,
|
|
1040
1046
|
results = {}
|
1041
1047
|
|
1042
1048
|
# number of labels
|
1043
|
-
nb_labels = len(allLabels)
|
1049
|
+
nb_labels = len(bm.allLabels)
|
1050
|
+
results['allLabels'] = bm.allLabels
|
1044
1051
|
|
1045
1052
|
# load model
|
1046
1053
|
if bm.dice_loss:
|
@@ -1222,7 +1229,7 @@ def predict_semantic_segmentation(bm,
|
|
1222
1229
|
rest = ID % (ysh*xsh)
|
1223
1230
|
l = rest // xsh
|
1224
1231
|
m = rest % xsh
|
1225
|
-
if i < max_i:
|
1232
|
+
if step*bm.batch_size+i < max_i:
|
1226
1233
|
probs[:,l:l+bm.y_patch,m:m+bm.x_patch] += Y[i]
|
1227
1234
|
|
1228
1235
|
# overlap in z direction
|
@@ -1280,7 +1287,7 @@ def predict_semantic_segmentation(bm,
|
|
1280
1287
|
label = np.copy(tmp, order='C')
|
1281
1288
|
|
1282
1289
|
# get result
|
1283
|
-
label = get_labels(label, allLabels)
|
1290
|
+
label = get_labels(label, bm.allLabels)
|
1284
1291
|
results['regular'] = label
|
1285
1292
|
|
1286
1293
|
# load header from file
|
biomedisa/interpolation.py
CHANGED
@@ -154,6 +154,7 @@ def smart_interpolation(data, labelData, nbrw=10, sorw=4000, acwe=False, acwe_al
|
|
154
154
|
bm.data /= np.amax(bm.data)
|
155
155
|
bm.data *= 255.0
|
156
156
|
if bm.labelData.dtype in ['uint32','int64','uint64']:
|
157
|
+
print(f'Warning: Potential label loss during conversion from {bm.labelData.dtype} to int32.')
|
157
158
|
bm.labelData = bm.labelData.astype(np.int32)
|
158
159
|
|
159
160
|
# denoise image data
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: biomedisa
|
3
|
-
Version: 24.
|
3
|
+
Version: 24.8.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
|
@@ -36,17 +36,17 @@ License-File: LICENSE
|
|
36
36
|
Biomedisa (https://biomedisa.info) is a free and easy-to-use open-source application for segmenting large 3D volumetric images such as CT and MRI scans, developed at [The Australian National University CTLab](https://ctlab.anu.edu.au/). Biomedisa's smart interpolation of sparsely pre-segmented slices enables accurate semi-automated segmentation by considering the complete underlying image data. Additionally, Biomedisa enables deep learning for fully automated segmentation across similar samples and structures. It is compatible with segmentation tools like Amira/Avizo, ImageJ/Fiji and 3D Slicer. If you are using Biomedisa or the data for your research please cite: Lösel, P.D. et al. [Introducing Biomedisa as an open-source online platform for biomedical image segmentation.](https://www.nature.com/articles/s41467-020-19303-w) *Nat. Commun.* **11**, 5577 (2020).
|
37
37
|
|
38
38
|
## Hardware Requirements
|
39
|
-
+ One or more NVIDIA GPUs with compute capability 3.0 or higher
|
39
|
+
+ One or more NVIDIA GPUs with compute capability 3.0 or higher.
|
40
40
|
|
41
41
|
## Installation (command-line based)
|
42
|
-
+ [Ubuntu 22.04 +
|
43
|
-
+ [Ubuntu 22.04 +
|
44
|
-
+ [Windows 10 +
|
45
|
-
+ [Windows
|
46
|
-
+ [Windows 10 + OpenCL + CPU (very slow)](https://github.com/biomedisa/biomedisa/blob/master/README/windows10_opencl_cpu_cli.md)
|
42
|
+
+ [Ubuntu 22.04 + Smart Interpolation](https://github.com/biomedisa/biomedisa/blob/master/README/ubuntu2204_interpolation_cli.md)
|
43
|
+
+ [Ubuntu 22.04 + Smart Interpolation + Deep Learning](https://github.com/biomedisa/biomedisa/blob/master/README/ubuntu2204_cuda11.8_gpu_cli.md)
|
44
|
+
+ [Windows 10 + Smart Interpolation + Deep Learning](https://github.com/biomedisa/biomedisa/blob/master/README/windows10_cuda_gpu_cli.md)
|
45
|
+
+ [Windows (WSL) + Smart Interpolation + Deep Learning](https://github.com/biomedisa/biomedisa/blob/master/README/windows_wsl.md)
|
47
46
|
|
48
47
|
## Installation (3D Slicer extension)
|
49
|
-
+ [Ubuntu 22.04 +
|
48
|
+
+ [Ubuntu 22.04 + Smart Interpolation + Deep Learning](https://github.com/biomedisa/biomedisa/blob/master/README/ubuntu2204_cuda11.8_gpu_slicer.md)
|
49
|
+
+ [Windows 10 + Smart Interpolation](https://github.com/biomedisa/biomedisa/blob/master/README/windows10_cuda_gpu_slicer.md)
|
50
50
|
|
51
51
|
## Installation (browser based)
|
52
52
|
+ [Ubuntu 22.04](https://github.com/biomedisa/biomedisa/blob/master/README/ubuntu2204_cuda11.8.md)
|
@@ -58,6 +58,7 @@ Biomedisa (https://biomedisa.info) is a free and easy-to-use open-source applica
|
|
58
58
|
24.7.1
|
59
59
|
+ 3D Slicer extension
|
60
60
|
+ Prediction of large data block by block
|
61
|
+
|
61
62
|
24.5.22
|
62
63
|
+ Pip is the preferred installation method
|
63
64
|
+ Commands, module names and imports have been changed to conform to the Pip standard
|
@@ -1,7 +1,7 @@
|
|
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=
|
3
|
+
biomedisa/deeplearning.py,sha256=Tfi1iSpsYi9RetgJpff_-mHx_VxlDybHZqTBJURwTBM,27970
|
4
|
+
biomedisa/interpolation.py,sha256=i10aqwEl-wsVU_nQ-zyubhAs27NSKF4ial7LyhaBLv0,17273
|
5
5
|
biomedisa/mesh.py,sha256=8-iuVsrfW5JovaMrAez7qSxv1LCU3eiqOdik0s0DV1w,16062
|
6
6
|
biomedisa/features/DataGenerator.py,sha256=MYPSY9-ssMwPx9UOI_ZfE7_5rddOSn4aHbVQ0HtYQVA,12757
|
7
7
|
biomedisa/features/DataGeneratorCrop.py,sha256=23R4Z-8tB1CsjYTYfhHGovlJpAny_q9OV9hq8kc2GJg,5454
|
@@ -10,12 +10,12 @@ biomedisa/features/PredictDataGeneratorCrop.py,sha256=HF5tJbGtlJMHr7lMT9IiIdLG2C
|
|
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=oIsOmIJ8xUQVwgbzMgw65dXcZmzwePpFQoIdbgLTnF8,32727
|
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=5do03z_DT13qWRR6IGtkFn4BNaw0mWmUXgg3Lk-U6QY,24597
|
16
16
|
biomedisa/features/curvop_numba.py,sha256=AjKQJcUBoURTB8pq1HmugQYpBwBELthhcEu51_r_xPI,7049
|
17
17
|
biomedisa/features/django_env.py,sha256=pdiPcBpqu1BWuyvh-palIGVwHFaY-leQ4Gatlbm8hIg,8942
|
18
|
-
biomedisa/features/keras_helper.py,sha256=
|
18
|
+
biomedisa/features/keras_helper.py,sha256=Y48N8VizQ2F7yrFzdUPOIFS19wm8fFWguQJqVFLVHWA,57637
|
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
|
@@ -37,8 +37,8 @@ biomedisa/features/random_walk/pyopencl_large.py,sha256=q79AxG3p3qFjxfiAZfUK9I5B
|
|
37
37
|
biomedisa/features/random_walk/pyopencl_small.py,sha256=opNlS-qzOa9qWafBNJdvf6r1aRAFf7_JXf6ISDnkdXE,17068
|
38
38
|
biomedisa/features/random_walk/rw_large.py,sha256=ZnITvk00Y11ZZlGuBRaJO1EwU0wYBdEwdpj9vvXCqF4,19805
|
39
39
|
biomedisa/features/random_walk/rw_small.py,sha256=RPzZe24YrEwYelJukDjvqaoD_SyhgdriEi7uV3kZGXI,14881
|
40
|
-
biomedisa-24.
|
41
|
-
biomedisa-24.
|
42
|
-
biomedisa-24.
|
43
|
-
biomedisa-24.
|
44
|
-
biomedisa-24.
|
40
|
+
biomedisa-24.8.1.dist-info/LICENSE,sha256=sehayP6UhydNnmstfL4yFR3genMRdpuUh6uZVWJN1H0,14152
|
41
|
+
biomedisa-24.8.1.dist-info/METADATA,sha256=GRHftPc4P9kZG5mgWe0KYpu-QMYWYBg2mSJqKuVitiE,10569
|
42
|
+
biomedisa-24.8.1.dist-info/WHEEL,sha256=Mdi9PDNwEZptOjTlUcAth7XJDFtKrHYaQMPulZeBCiQ,91
|
43
|
+
biomedisa-24.8.1.dist-info/top_level.txt,sha256=opsf1Eb4vCguPSxev4HHSeiUKCccT_C_RcUCdAYbHWQ,10
|
44
|
+
biomedisa-24.8.1.dist-info/RECORD,,
|
File without changes
|
File without changes
|