biomedisa 2024.5.19__tar.gz → 2024.5.21__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.
- {biomedisa-2024.5.19 → biomedisa-2024.5.21}/PKG-INFO +34 -51
- {biomedisa-2024.5.19 → biomedisa-2024.5.21}/README.md +33 -50
- {biomedisa-2024.5.19 → biomedisa-2024.5.21}/pyproject.toml +1 -1
- {biomedisa-2024.5.19 → biomedisa-2024.5.21}/src/biomedisa/__init__.py +3 -7
- {biomedisa-2024.5.19 → biomedisa-2024.5.21}/src/biomedisa/deeplearning.py +10 -12
- {biomedisa-2024.5.19/src/biomedisa/biomedisa_features → biomedisa-2024.5.21/src/biomedisa/features}/DataGenerator.py +1 -1
- {biomedisa-2024.5.19/src/biomedisa/biomedisa_features → biomedisa-2024.5.21/src/biomedisa/features}/DataGeneratorCrop.py +1 -1
- {biomedisa-2024.5.19/src/biomedisa/biomedisa_features → biomedisa-2024.5.21/src/biomedisa/features}/PredictDataGenerator.py +1 -1
- {biomedisa-2024.5.19/src/biomedisa/biomedisa_features → biomedisa-2024.5.21/src/biomedisa/features}/PredictDataGeneratorCrop.py +1 -1
- {biomedisa-2024.5.19/src/biomedisa/biomedisa_features → biomedisa-2024.5.21/src/biomedisa/features}/active_contour.py +15 -18
- {biomedisa-2024.5.19/src/biomedisa/biomedisa_features → biomedisa-2024.5.21/src/biomedisa/features}/assd.py +1 -1
- {biomedisa-2024.5.19/src/biomedisa/biomedisa_features → biomedisa-2024.5.21/src/biomedisa/features}/biomedisa_helper.py +7 -7
- {biomedisa-2024.5.19/src/biomedisa/biomedisa_features → biomedisa-2024.5.21/src/biomedisa/features}/create_slices.py +2 -4
- {biomedisa-2024.5.19/src/biomedisa/biomedisa_features → biomedisa-2024.5.21/src/biomedisa/features}/crop_helper.py +5 -5
- {biomedisa-2024.5.19/src/biomedisa/biomedisa_features → biomedisa-2024.5.21/src/biomedisa/features}/curvop_numba.py +1 -1
- {biomedisa-2024.5.19/src/biomedisa/biomedisa_features → biomedisa-2024.5.21/src/biomedisa/features}/django_env.py +9 -10
- {biomedisa-2024.5.19/src/biomedisa/biomedisa_features → biomedisa-2024.5.21/src/biomedisa/features}/keras_helper.py +6 -7
- {biomedisa-2024.5.19/src/biomedisa/biomedisa_features → biomedisa-2024.5.21/src/biomedisa/features}/nc_reader.py +1 -1
- {biomedisa-2024.5.19/src/biomedisa/biomedisa_features → biomedisa-2024.5.21/src/biomedisa/features}/pid.py +2 -2
- {biomedisa-2024.5.19/src/biomedisa/biomedisa_features → biomedisa-2024.5.21/src/biomedisa/features}/process_image.py +12 -14
- {biomedisa-2024.5.19/src/biomedisa/biomedisa_features → biomedisa-2024.5.21/src/biomedisa/features}/pycuda_test.py +2 -1
- {biomedisa-2024.5.19/src/biomedisa/biomedisa_features → biomedisa-2024.5.21/src/biomedisa/features}/random_walk/gpu_kernels.py +2 -1
- {biomedisa-2024.5.19/src/biomedisa/biomedisa_features → biomedisa-2024.5.21/src/biomedisa/features}/random_walk/pycuda_large.py +2 -2
- {biomedisa-2024.5.19/src/biomedisa/biomedisa_features → biomedisa-2024.5.21/src/biomedisa/features}/random_walk/pycuda_large_allx.py +2 -2
- {biomedisa-2024.5.19/src/biomedisa/biomedisa_features → biomedisa-2024.5.21/src/biomedisa/features}/random_walk/pycuda_small.py +2 -2
- {biomedisa-2024.5.19/src/biomedisa/biomedisa_features → biomedisa-2024.5.21/src/biomedisa/features}/random_walk/pycuda_small_allx.py +2 -2
- {biomedisa-2024.5.19/src/biomedisa/biomedisa_features → biomedisa-2024.5.21/src/biomedisa/features}/random_walk/pyopencl_large.py +1 -1
- {biomedisa-2024.5.19/src/biomedisa/biomedisa_features → biomedisa-2024.5.21/src/biomedisa/features}/random_walk/pyopencl_small.py +1 -1
- {biomedisa-2024.5.19/src/biomedisa/biomedisa_features → biomedisa-2024.5.21/src/biomedisa/features}/random_walk/rw_large.py +11 -11
- {biomedisa-2024.5.19/src/biomedisa/biomedisa_features → biomedisa-2024.5.21/src/biomedisa/features}/random_walk/rw_small.py +12 -12
- {biomedisa-2024.5.19/src/biomedisa/biomedisa_features → biomedisa-2024.5.21/src/biomedisa/features}/remove_outlier.py +13 -16
- biomedisa-2024.5.21/src/biomedisa/features/split_volume.py +167 -0
- {biomedisa-2024.5.19 → biomedisa-2024.5.21}/src/biomedisa/interpolation.py +10 -12
- {biomedisa-2024.5.19 → biomedisa-2024.5.21}/src/biomedisa/mesh.py +9 -12
- {biomedisa-2024.5.19 → biomedisa-2024.5.21}/src/biomedisa.egg-info/PKG-INFO +34 -51
- biomedisa-2024.5.21/src/biomedisa.egg-info/SOURCES.txt +46 -0
- biomedisa-2024.5.19/src/biomedisa/biomedisa_features/split_volume.py +0 -274
- biomedisa-2024.5.19/src/biomedisa.egg-info/SOURCES.txt +0 -46
- {biomedisa-2024.5.19 → biomedisa-2024.5.21}/LICENSE +0 -0
- {biomedisa-2024.5.19 → biomedisa-2024.5.21}/setup.cfg +0 -0
- {biomedisa-2024.5.19 → biomedisa-2024.5.21}/src/biomedisa/__main__.py +0 -0
- {biomedisa-2024.5.19/src/biomedisa/biomedisa_features → biomedisa-2024.5.21/src/biomedisa/features}/__init__.py +0 -0
- {biomedisa-2024.5.19/src/biomedisa/biomedisa_features → biomedisa-2024.5.21/src/biomedisa/features}/amira_to_np/__init__.py +0 -0
- {biomedisa-2024.5.19/src/biomedisa/biomedisa_features → biomedisa-2024.5.21/src/biomedisa/features}/amira_to_np/amira_data_stream.py +0 -0
- {biomedisa-2024.5.19/src/biomedisa/biomedisa_features → biomedisa-2024.5.21/src/biomedisa/features}/amira_to_np/amira_grammar.py +0 -0
- {biomedisa-2024.5.19/src/biomedisa/biomedisa_features → biomedisa-2024.5.21/src/biomedisa/features}/amira_to_np/amira_header.py +0 -0
- {biomedisa-2024.5.19/src/biomedisa/biomedisa_features → biomedisa-2024.5.21/src/biomedisa/features}/amira_to_np/amira_helper.py +0 -0
- {biomedisa-2024.5.19/src/biomedisa/biomedisa_features → biomedisa-2024.5.21/src/biomedisa/features}/random_walk/__init__.py +0 -0
- {biomedisa-2024.5.19 → biomedisa-2024.5.21}/src/biomedisa.egg-info/dependency_links.txt +0 -0
- {biomedisa-2024.5.19 → biomedisa-2024.5.21}/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.
|
3
|
+
Version: 2024.5.21
|
4
4
|
Summary: Segmentation of 3D volumetric image data
|
5
5
|
Author: Philipp Lösel
|
6
6
|
Author-email: philipp.loesel@anu.edu.au
|
@@ -14,48 +14,53 @@ Requires-Python: >=3.8
|
|
14
14
|
Description-Content-Type: text/markdown
|
15
15
|
License-File: LICENSE
|
16
16
|
|
17
|
-
[](https://biomedisa.info)
|
17
|
+
[](https://biomedisa.info)
|
18
18
|
-----------
|
19
19
|
- [Overview](#overview)
|
20
20
|
- [Hardware Requirements](#hardware-requirements)
|
21
21
|
- [Installation (command-line based)](#installation-command-line-based)
|
22
22
|
- [Installation (browser based)](#installation-browser-based)
|
23
23
|
- [Download Data](#download-data)
|
24
|
+
- [Revisions](#revisions)
|
24
25
|
- [Smart Interpolation](#smart-interpolation)
|
25
26
|
- [Deep Learning](#deep-learning)
|
26
27
|
- [Biomedisa Features](#biomedisa-features)
|
27
|
-
- [Update Biomedisa](#update-biomedisa)
|
28
|
-
- [Releases](#releases)
|
29
28
|
- [Authors](#authors)
|
30
29
|
- [FAQ](#faq)
|
31
30
|
- [Citation](#citation)
|
32
31
|
- [License](#license)
|
33
32
|
|
34
|
-
|
33
|
+
## Overview
|
35
34
|
Biomedisa (https://biomedisa.info) is a free and easy-to-use open-source application for segmenting large volumetric images, e.g. CT and MRI scans, developed at [The Australian National University CTLab](https://ctlab.anu.edu.au/). Biomedisa's semi-automated segmentation is based on a smart interpolation of sparsely pre-segmented slices, taking into account the complete underlying image data. In addition, Biomedisa enables deep learning for the fully automated segmentation of series of similar samples. It can be used in combination with segmentation tools such as 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).
|
36
35
|
|
37
|
-
|
36
|
+
## Hardware Requirements
|
38
37
|
+ One or more NVIDIA GPUs with compute capability 3.0 or higher or an Intel CPU.
|
39
38
|
|
40
|
-
|
39
|
+
## Installation (command-line based)
|
41
40
|
+ [Ubuntu 22.04 + CUDA + GPU (recommended)](https://github.com/biomedisa/biomedisa/blob/master/README/ubuntu2204_cuda11.8_gpu_cli.md)
|
42
41
|
+ [Ubuntu 22.04 + OpenCL + CPU (smart interpolation only and very slow)](https://github.com/biomedisa/biomedisa/blob/master/README/ubuntu2204_opencl_cpu_cli.md)
|
43
42
|
+ [Windows 10 + CUDA + GPU (recommended)](https://github.com/biomedisa/biomedisa/blob/master/README/windows10_cuda_gpu_cli.md)
|
44
43
|
+ [Windows 10 + OpenCL + GPU (easy to install but lacks features like allaxis, smoothing, uncertainty, optimized GPU memory usage)](https://github.com/biomedisa/biomedisa/blob/master/README/windows10_opencl_gpu_cli.md)
|
45
44
|
+ [Windows 10 + OpenCL + CPU (very slow)](https://github.com/biomedisa/biomedisa/blob/master/README/windows10_opencl_cpu_cli.md)
|
46
45
|
|
47
|
-
|
46
|
+
## Installation (browser based)
|
48
47
|
+ [Ubuntu 22.04](https://github.com/biomedisa/biomedisa/blob/master/README/ubuntu2204_cuda11.8.md)
|
49
48
|
|
50
|
-
|
49
|
+
## Download Data
|
51
50
|
+ Download the data from our [gallery](https://biomedisa.info/gallery/)
|
52
51
|
|
53
|
-
|
52
|
+
## Revisions
|
53
|
+
2024.05.21
|
54
|
+
+ Pip is the preferred installation method
|
55
|
+
+ Commands, module names and imports have been changed to conform to the Pip standard
|
56
|
+
+ For versions <=2023.09.1 please check [README](https://github.com/biomedisa/biomedisa/blob/master/README/deprecated/README_2023.09.1.md)
|
57
|
+
|
58
|
+
## Smart Interpolation
|
54
59
|
+ [Parameters and Examples](https://github.com/biomedisa/biomedisa/blob/master/README/smart_interpolation.md)
|
55
60
|
|
56
61
|
#### Python example
|
57
62
|
```python
|
58
|
-
from biomedisa.
|
63
|
+
from biomedisa.features.biomedisa_helper import load_data, save_data
|
59
64
|
from biomedisa.interpolation import smart_interpolation
|
60
65
|
|
61
66
|
# load data
|
@@ -77,14 +82,17 @@ save_data('Downloads/final.trigonopterus.smooth.am', smooth_result, header=heade
|
|
77
82
|
#### Command-line based
|
78
83
|
```
|
79
84
|
python -m biomedisa.interpolation C:\Users\%USERNAME%\Downloads\tumor.tif C:\Users\%USERNAME%\Downloads\labels.tumor.tif
|
85
|
+
|
86
|
+
# if pre-segmentation is not exclusively in the XY plane
|
87
|
+
python -m biomedisa.interpolation C:\Users\%USERNAME%\Downloads\tumor.tif C:\Users\%USERNAME%\Downloads\labels.tumor.tif --allaxis
|
80
88
|
```
|
81
89
|
|
82
|
-
|
90
|
+
## Deep Learning
|
83
91
|
+ [Parameters and Examples](https://github.com/biomedisa/biomedisa/blob/master/README/deep_learning.md)
|
84
92
|
|
85
93
|
#### Python example (training)
|
86
94
|
```python
|
87
|
-
from biomedisa.
|
95
|
+
from biomedisa.features.biomedisa_helper import load_data
|
88
96
|
from biomedisa.deeplearning import deep_learning
|
89
97
|
|
90
98
|
# load image data
|
@@ -115,16 +123,16 @@ deep_learning(img_data, label_data, train=True, batch_size=12,
|
|
115
123
|
#### Command-line based (training)
|
116
124
|
```
|
117
125
|
# start training with a batch size of 12
|
118
|
-
python -m biomedisa.deeplearning C:\Users\%USERNAME%\Downloads\training_heart C:\Users\%USERNAME%\Downloads\training_heart_labels -t -bs
|
126
|
+
python -m biomedisa.deeplearning C:\Users\%USERNAME%\Downloads\training_heart C:\Users\%USERNAME%\Downloads\training_heart_labels -t -bs=12
|
119
127
|
|
120
128
|
# validation (optional)
|
121
|
-
python -m biomedisa.deeplearning C:\Users\%USERNAME%\Downloads\training_heart C:\Users\%USERNAME%\Downloads\training_heart_labels -t -vi
|
129
|
+
python -m biomedisa.deeplearning C:\Users\%USERNAME%\Downloads\training_heart C:\Users\%USERNAME%\Downloads\training_heart_labels -t -vi=C:\Users\%USERNAME%\Downloads\val_img -vl=C:\Users\%USERNAME%\Downloads\val_labels
|
122
130
|
```
|
123
131
|
If running into ResourceExhaustedError due to out of memory (OOM), try to use smaller batch size.
|
124
132
|
|
125
133
|
#### Python example (prediction)
|
126
134
|
```python
|
127
|
-
from biomedisa.
|
135
|
+
from biomedisa.features.biomedisa_helper import load_data, save_data
|
128
136
|
from biomedisa.deeplearning import deep_learning
|
129
137
|
|
130
138
|
# load data
|
@@ -143,11 +151,11 @@ save_data('final.Head5.am', results['regular'], results['header'])
|
|
143
151
|
python -m biomedisa.deeplearning C:\Users\%USERNAME%\Downloads\testing_axial_crop_pat13.nii.gz C:\Users\%USERNAME%\Downloads\heart.h5 -p
|
144
152
|
```
|
145
153
|
|
146
|
-
|
154
|
+
## Biomedisa Features
|
147
155
|
|
148
156
|
#### Load and save data (such as Amira Mesh, TIFF, NRRD, NIfTI or DICOM)
|
149
157
|
```python
|
150
|
-
from biomedisa.
|
158
|
+
from biomedisa.features.biomedisa_helper import load_data, save_data
|
151
159
|
|
152
160
|
# load data as numpy array
|
153
161
|
# for DICOM, PNG files, or similar formats, 'path_to_data' must reference
|
@@ -160,7 +168,7 @@ save_data(path_to_data, data, header)
|
|
160
168
|
|
161
169
|
#### Create STL mesh from segmentation (label values are saved as attributes)
|
162
170
|
```python
|
163
|
-
from biomedisa.
|
171
|
+
from biomedisa.features.biomedisa_helper import load_data, save_data
|
164
172
|
from biomedisa.mesh import get_voxel_spacing, save_mesh
|
165
173
|
|
166
174
|
# load segmentation
|
@@ -193,7 +201,7 @@ python -m biomedisa.mesh <path_to_data>
|
|
193
201
|
|
194
202
|
#### Resize data
|
195
203
|
```python
|
196
|
-
from biomedisa.
|
204
|
+
from biomedisa.features.biomedisa_helper import img_resize
|
197
205
|
|
198
206
|
# resize image data
|
199
207
|
zsh, ysh, xsh = data.shape
|
@@ -206,7 +214,7 @@ label_data = img_resize(label_data, new_zsh, new_ysh, new_xsh, labels=True)
|
|
206
214
|
|
207
215
|
#### Remove outliers and fill holes
|
208
216
|
```python
|
209
|
-
from biomedisa.
|
217
|
+
from biomedisa.features.biomedisa_helper import clean, fill
|
210
218
|
|
211
219
|
# delete outliers smaller than 90% of the segment
|
212
220
|
label_data = clean(label_data, 0.9)
|
@@ -217,46 +225,21 @@ label_data = fill(label_data, 0.9)
|
|
217
225
|
|
218
226
|
#### Accuracy assessment
|
219
227
|
```python
|
220
|
-
from biomedisa.
|
228
|
+
from biomedisa.features.biomedisa_helper import Dice_score, ASSD
|
221
229
|
dice = Dice_score(ground_truth, result)
|
222
230
|
assd = ASSD(ground_truth, result)
|
223
231
|
```
|
224
232
|
|
225
|
-
|
226
|
-
If you installed Biomedisa via Pip
|
227
|
-
```
|
228
|
-
pip install --upgrade biomedisa
|
229
|
-
```
|
230
|
-
If you used `git clone`, change to the Biomedisa directory and make a pull request
|
231
|
-
```
|
232
|
-
cd git/biomedisa
|
233
|
-
git pull
|
234
|
-
```
|
235
|
-
|
236
|
-
If you installed the browser based version of Biomedisa (including MySQL database), you also need to update the database
|
237
|
-
```
|
238
|
-
python manage.py migrate
|
239
|
-
```
|
240
|
-
|
241
|
-
If you installed an [Apache Server](https://github.com/biomedisa/biomedisa/blob/master/README/APACHE_SERVER.md), you need to restart the server
|
242
|
-
```
|
243
|
-
sudo service apache2 restart
|
244
|
-
```
|
245
|
-
|
246
|
-
# Releases
|
247
|
-
|
248
|
-
For the versions available, see the [list of releases](https://github.com/biomedisa/biomedisa/releases).
|
249
|
-
|
250
|
-
# Authors
|
233
|
+
## Authors
|
251
234
|
|
252
235
|
* **Philipp D. Lösel**
|
253
236
|
|
254
237
|
See also the list of [contributors](https://github.com/biomedisa/biomedisa/blob/master/credits.md) who participated in this project.
|
255
238
|
|
256
|
-
|
239
|
+
## FAQ
|
257
240
|
Frequently asked questions can be found at: https://biomedisa.info/faq/.
|
258
241
|
|
259
|
-
|
242
|
+
## Citation
|
260
243
|
|
261
244
|
If you use Biomedisa or the data, please cite the following paper:
|
262
245
|
|
@@ -270,7 +253,7 @@ If you use Biomedisa's Smart Interpolation, you can also cite the initial descri
|
|
270
253
|
|
271
254
|
`Lösel, P. & Heuveline, V. Enhancing a diffusion algorithm for 4D image segmentation using local information. Proc. SPIE 9784, 97842L (2016).` https://doi.org/10.1117/12.2216202
|
272
255
|
|
273
|
-
|
256
|
+
## License
|
274
257
|
|
275
258
|
This project is covered under the **EUROPEAN UNION PUBLIC LICENCE v. 1.2 (EUPL)**.
|
276
259
|
|
@@ -1,45 +1,50 @@
|
|
1
|
-
[](https://biomedisa.info)
|
1
|
+
[](https://biomedisa.info)
|
2
2
|
-----------
|
3
3
|
- [Overview](#overview)
|
4
4
|
- [Hardware Requirements](#hardware-requirements)
|
5
5
|
- [Installation (command-line based)](#installation-command-line-based)
|
6
6
|
- [Installation (browser based)](#installation-browser-based)
|
7
7
|
- [Download Data](#download-data)
|
8
|
+
- [Revisions](#revisions)
|
8
9
|
- [Smart Interpolation](#smart-interpolation)
|
9
10
|
- [Deep Learning](#deep-learning)
|
10
11
|
- [Biomedisa Features](#biomedisa-features)
|
11
|
-
- [Update Biomedisa](#update-biomedisa)
|
12
|
-
- [Releases](#releases)
|
13
12
|
- [Authors](#authors)
|
14
13
|
- [FAQ](#faq)
|
15
14
|
- [Citation](#citation)
|
16
15
|
- [License](#license)
|
17
16
|
|
18
|
-
|
17
|
+
## Overview
|
19
18
|
Biomedisa (https://biomedisa.info) is a free and easy-to-use open-source application for segmenting large volumetric images, e.g. CT and MRI scans, developed at [The Australian National University CTLab](https://ctlab.anu.edu.au/). Biomedisa's semi-automated segmentation is based on a smart interpolation of sparsely pre-segmented slices, taking into account the complete underlying image data. In addition, Biomedisa enables deep learning for the fully automated segmentation of series of similar samples. It can be used in combination with segmentation tools such as 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).
|
20
19
|
|
21
|
-
|
20
|
+
## Hardware Requirements
|
22
21
|
+ One or more NVIDIA GPUs with compute capability 3.0 or higher or an Intel CPU.
|
23
22
|
|
24
|
-
|
23
|
+
## Installation (command-line based)
|
25
24
|
+ [Ubuntu 22.04 + CUDA + GPU (recommended)](https://github.com/biomedisa/biomedisa/blob/master/README/ubuntu2204_cuda11.8_gpu_cli.md)
|
26
25
|
+ [Ubuntu 22.04 + OpenCL + CPU (smart interpolation only and very slow)](https://github.com/biomedisa/biomedisa/blob/master/README/ubuntu2204_opencl_cpu_cli.md)
|
27
26
|
+ [Windows 10 + CUDA + GPU (recommended)](https://github.com/biomedisa/biomedisa/blob/master/README/windows10_cuda_gpu_cli.md)
|
28
27
|
+ [Windows 10 + OpenCL + GPU (easy to install but lacks features like allaxis, smoothing, uncertainty, optimized GPU memory usage)](https://github.com/biomedisa/biomedisa/blob/master/README/windows10_opencl_gpu_cli.md)
|
29
28
|
+ [Windows 10 + OpenCL + CPU (very slow)](https://github.com/biomedisa/biomedisa/blob/master/README/windows10_opencl_cpu_cli.md)
|
30
29
|
|
31
|
-
|
30
|
+
## Installation (browser based)
|
32
31
|
+ [Ubuntu 22.04](https://github.com/biomedisa/biomedisa/blob/master/README/ubuntu2204_cuda11.8.md)
|
33
32
|
|
34
|
-
|
33
|
+
## Download Data
|
35
34
|
+ Download the data from our [gallery](https://biomedisa.info/gallery/)
|
36
35
|
|
37
|
-
|
36
|
+
## Revisions
|
37
|
+
2024.05.21
|
38
|
+
+ Pip is the preferred installation method
|
39
|
+
+ Commands, module names and imports have been changed to conform to the Pip standard
|
40
|
+
+ For versions <=2023.09.1 please check [README](https://github.com/biomedisa/biomedisa/blob/master/README/deprecated/README_2023.09.1.md)
|
41
|
+
|
42
|
+
## Smart Interpolation
|
38
43
|
+ [Parameters and Examples](https://github.com/biomedisa/biomedisa/blob/master/README/smart_interpolation.md)
|
39
44
|
|
40
45
|
#### Python example
|
41
46
|
```python
|
42
|
-
from biomedisa.
|
47
|
+
from biomedisa.features.biomedisa_helper import load_data, save_data
|
43
48
|
from biomedisa.interpolation import smart_interpolation
|
44
49
|
|
45
50
|
# load data
|
@@ -61,14 +66,17 @@ save_data('Downloads/final.trigonopterus.smooth.am', smooth_result, header=heade
|
|
61
66
|
#### Command-line based
|
62
67
|
```
|
63
68
|
python -m biomedisa.interpolation C:\Users\%USERNAME%\Downloads\tumor.tif C:\Users\%USERNAME%\Downloads\labels.tumor.tif
|
69
|
+
|
70
|
+
# if pre-segmentation is not exclusively in the XY plane
|
71
|
+
python -m biomedisa.interpolation C:\Users\%USERNAME%\Downloads\tumor.tif C:\Users\%USERNAME%\Downloads\labels.tumor.tif --allaxis
|
64
72
|
```
|
65
73
|
|
66
|
-
|
74
|
+
## Deep Learning
|
67
75
|
+ [Parameters and Examples](https://github.com/biomedisa/biomedisa/blob/master/README/deep_learning.md)
|
68
76
|
|
69
77
|
#### Python example (training)
|
70
78
|
```python
|
71
|
-
from biomedisa.
|
79
|
+
from biomedisa.features.biomedisa_helper import load_data
|
72
80
|
from biomedisa.deeplearning import deep_learning
|
73
81
|
|
74
82
|
# load image data
|
@@ -99,16 +107,16 @@ deep_learning(img_data, label_data, train=True, batch_size=12,
|
|
99
107
|
#### Command-line based (training)
|
100
108
|
```
|
101
109
|
# start training with a batch size of 12
|
102
|
-
python -m biomedisa.deeplearning C:\Users\%USERNAME%\Downloads\training_heart C:\Users\%USERNAME%\Downloads\training_heart_labels -t -bs
|
110
|
+
python -m biomedisa.deeplearning C:\Users\%USERNAME%\Downloads\training_heart C:\Users\%USERNAME%\Downloads\training_heart_labels -t -bs=12
|
103
111
|
|
104
112
|
# validation (optional)
|
105
|
-
python -m biomedisa.deeplearning C:\Users\%USERNAME%\Downloads\training_heart C:\Users\%USERNAME%\Downloads\training_heart_labels -t -vi
|
113
|
+
python -m biomedisa.deeplearning C:\Users\%USERNAME%\Downloads\training_heart C:\Users\%USERNAME%\Downloads\training_heart_labels -t -vi=C:\Users\%USERNAME%\Downloads\val_img -vl=C:\Users\%USERNAME%\Downloads\val_labels
|
106
114
|
```
|
107
115
|
If running into ResourceExhaustedError due to out of memory (OOM), try to use smaller batch size.
|
108
116
|
|
109
117
|
#### Python example (prediction)
|
110
118
|
```python
|
111
|
-
from biomedisa.
|
119
|
+
from biomedisa.features.biomedisa_helper import load_data, save_data
|
112
120
|
from biomedisa.deeplearning import deep_learning
|
113
121
|
|
114
122
|
# load data
|
@@ -127,11 +135,11 @@ save_data('final.Head5.am', results['regular'], results['header'])
|
|
127
135
|
python -m biomedisa.deeplearning C:\Users\%USERNAME%\Downloads\testing_axial_crop_pat13.nii.gz C:\Users\%USERNAME%\Downloads\heart.h5 -p
|
128
136
|
```
|
129
137
|
|
130
|
-
|
138
|
+
## Biomedisa Features
|
131
139
|
|
132
140
|
#### Load and save data (such as Amira Mesh, TIFF, NRRD, NIfTI or DICOM)
|
133
141
|
```python
|
134
|
-
from biomedisa.
|
142
|
+
from biomedisa.features.biomedisa_helper import load_data, save_data
|
135
143
|
|
136
144
|
# load data as numpy array
|
137
145
|
# for DICOM, PNG files, or similar formats, 'path_to_data' must reference
|
@@ -144,7 +152,7 @@ save_data(path_to_data, data, header)
|
|
144
152
|
|
145
153
|
#### Create STL mesh from segmentation (label values are saved as attributes)
|
146
154
|
```python
|
147
|
-
from biomedisa.
|
155
|
+
from biomedisa.features.biomedisa_helper import load_data, save_data
|
148
156
|
from biomedisa.mesh import get_voxel_spacing, save_mesh
|
149
157
|
|
150
158
|
# load segmentation
|
@@ -177,7 +185,7 @@ python -m biomedisa.mesh <path_to_data>
|
|
177
185
|
|
178
186
|
#### Resize data
|
179
187
|
```python
|
180
|
-
from biomedisa.
|
188
|
+
from biomedisa.features.biomedisa_helper import img_resize
|
181
189
|
|
182
190
|
# resize image data
|
183
191
|
zsh, ysh, xsh = data.shape
|
@@ -190,7 +198,7 @@ label_data = img_resize(label_data, new_zsh, new_ysh, new_xsh, labels=True)
|
|
190
198
|
|
191
199
|
#### Remove outliers and fill holes
|
192
200
|
```python
|
193
|
-
from biomedisa.
|
201
|
+
from biomedisa.features.biomedisa_helper import clean, fill
|
194
202
|
|
195
203
|
# delete outliers smaller than 90% of the segment
|
196
204
|
label_data = clean(label_data, 0.9)
|
@@ -201,46 +209,21 @@ label_data = fill(label_data, 0.9)
|
|
201
209
|
|
202
210
|
#### Accuracy assessment
|
203
211
|
```python
|
204
|
-
from biomedisa.
|
212
|
+
from biomedisa.features.biomedisa_helper import Dice_score, ASSD
|
205
213
|
dice = Dice_score(ground_truth, result)
|
206
214
|
assd = ASSD(ground_truth, result)
|
207
215
|
```
|
208
216
|
|
209
|
-
|
210
|
-
If you installed Biomedisa via Pip
|
211
|
-
```
|
212
|
-
pip install --upgrade biomedisa
|
213
|
-
```
|
214
|
-
If you used `git clone`, change to the Biomedisa directory and make a pull request
|
215
|
-
```
|
216
|
-
cd git/biomedisa
|
217
|
-
git pull
|
218
|
-
```
|
219
|
-
|
220
|
-
If you installed the browser based version of Biomedisa (including MySQL database), you also need to update the database
|
221
|
-
```
|
222
|
-
python manage.py migrate
|
223
|
-
```
|
224
|
-
|
225
|
-
If you installed an [Apache Server](https://github.com/biomedisa/biomedisa/blob/master/README/APACHE_SERVER.md), you need to restart the server
|
226
|
-
```
|
227
|
-
sudo service apache2 restart
|
228
|
-
```
|
229
|
-
|
230
|
-
# Releases
|
231
|
-
|
232
|
-
For the versions available, see the [list of releases](https://github.com/biomedisa/biomedisa/releases).
|
233
|
-
|
234
|
-
# Authors
|
217
|
+
## Authors
|
235
218
|
|
236
219
|
* **Philipp D. Lösel**
|
237
220
|
|
238
221
|
See also the list of [contributors](https://github.com/biomedisa/biomedisa/blob/master/credits.md) who participated in this project.
|
239
222
|
|
240
|
-
|
223
|
+
## FAQ
|
241
224
|
Frequently asked questions can be found at: https://biomedisa.info/faq/.
|
242
225
|
|
243
|
-
|
226
|
+
## Citation
|
244
227
|
|
245
228
|
If you use Biomedisa or the data, please cite the following paper:
|
246
229
|
|
@@ -254,7 +237,7 @@ If you use Biomedisa's Smart Interpolation, you can also cite the initial descri
|
|
254
237
|
|
255
238
|
`Lösel, P. & Heuveline, V. Enhancing a diffusion algorithm for 4D image segmentation using local information. Proc. SPIE 9784, 97842L (2016).` https://doi.org/10.1117/12.2216202
|
256
239
|
|
257
|
-
|
240
|
+
## License
|
258
241
|
|
259
242
|
This project is covered under the **EUROPEAN UNION PUBLIC LICENCE v. 1.2 (EUPL)**.
|
260
243
|
|
@@ -1,15 +1,11 @@
|
|
1
1
|
import os
|
2
|
-
import sys
|
3
2
|
import subprocess
|
4
3
|
|
5
|
-
#
|
4
|
+
# base directory
|
6
5
|
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
|
7
6
|
|
8
|
-
# pip
|
9
|
-
if not os.path.exists(os.path.join(BASE_DIR,'
|
10
|
-
BASE_DIR = os.path.dirname(os.path.abspath(__file__))
|
11
|
-
# add BASE_DIR to PYTHONPATH for absolute imports
|
12
|
-
sys.path.append(BASE_DIR)
|
7
|
+
# pip installation
|
8
|
+
if not os.path.exists(os.path.join(BASE_DIR,'biomedisa/settings.py')):
|
13
9
|
|
14
10
|
# metadata
|
15
11
|
import importlib_metadata
|
@@ -1,7 +1,7 @@
|
|
1
1
|
#!/usr/bin/python3
|
2
2
|
##########################################################################
|
3
3
|
## ##
|
4
|
-
## Copyright (c) 2024 Philipp Lösel. All rights reserved.
|
4
|
+
## Copyright (c) 2019-2024 Philipp Lösel. All rights reserved. ##
|
5
5
|
## ##
|
6
6
|
## This file is part of the open source project biomedisa. ##
|
7
7
|
## ##
|
@@ -27,13 +27,11 @@
|
|
27
27
|
## ##
|
28
28
|
##########################################################################
|
29
29
|
|
30
|
-
import
|
31
|
-
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
|
32
|
-
sys.path.append(BASE_DIR)
|
30
|
+
import os
|
33
31
|
import biomedisa
|
34
|
-
import
|
35
|
-
from
|
36
|
-
from
|
32
|
+
import biomedisa.features.crop_helper as ch
|
33
|
+
from biomedisa.features.keras_helper import *
|
34
|
+
from biomedisa.features.biomedisa_helper import _error_, unique_file_path
|
37
35
|
from tensorflow.python.framework.errors_impl import ResourceExhaustedError
|
38
36
|
import tensorflow as tf
|
39
37
|
import numpy as np
|
@@ -121,7 +119,7 @@ def deep_learning(img_data, label_data=None, val_img_data=None, val_label_data=N
|
|
121
119
|
project = os.path.splitext(bm.shortfilename)[0]
|
122
120
|
|
123
121
|
# path to model
|
124
|
-
bm.path_to_model = BASE_DIR + f'/private_storage/images/{bm.username}/{project}.h5'
|
122
|
+
bm.path_to_model = biomedisa.BASE_DIR + f'/private_storage/images/{bm.username}/{project}.h5'
|
125
123
|
if not bm.remote:
|
126
124
|
bm.path_to_model = unique_file_path(bm.path_to_model)
|
127
125
|
|
@@ -129,7 +127,7 @@ def deep_learning(img_data, label_data=None, val_img_data=None, val_label_data=N
|
|
129
127
|
project = os.path.splitext(os.path.basename(bm.path_to_model))[0]
|
130
128
|
|
131
129
|
# create pid object
|
132
|
-
from
|
130
|
+
from biomedisa.features.django_env import create_pid_object
|
133
131
|
create_pid_object(os.getpid(), bm.remote, bm.queue, bm.img_id, (bm.path_to_model if bm.train else ''))
|
134
132
|
|
135
133
|
# write in log file
|
@@ -319,7 +317,7 @@ def deep_learning(img_data, label_data=None, val_img_data=None, val_label_data=N
|
|
319
317
|
# django environment
|
320
318
|
if bm.django_env:
|
321
319
|
from biomedisa_app.config import config
|
322
|
-
from
|
320
|
+
from biomedisa.features.django_env import post_processing
|
323
321
|
validation=True if bm.validation_split or (bm.val_images is not None and bm.val_images[0] is not None) else False
|
324
322
|
post_processing(bm.path_to_final, time_str, config['SERVER_ALIAS'], bm.remote, bm.queue,
|
325
323
|
img_id=bm.img_id, label_id=bm.label_id, path_to_model=bm.path_to_model,
|
@@ -327,7 +325,7 @@ def deep_learning(img_data, label_data=None, val_img_data=None, val_label_data=N
|
|
327
325
|
train=bm.train, predict=bm.predict, validation=validation)
|
328
326
|
|
329
327
|
# write in log file
|
330
|
-
path_to_time = BASE_DIR + '/log/time.txt'
|
328
|
+
path_to_time = biomedisa.BASE_DIR + '/log/time.txt'
|
331
329
|
with open(path_to_time, 'a') as timefile:
|
332
330
|
if predict:
|
333
331
|
message = 'Successfully segmented ' + bm.shortfilename
|
@@ -490,7 +488,7 @@ if __name__ == '__main__':
|
|
490
488
|
reference_image_path = bm.path_to_images
|
491
489
|
bm.username = os.path.basename(os.path.dirname(reference_image_path))
|
492
490
|
bm.shortfilename = os.path.basename(reference_image_path)
|
493
|
-
bm.path_to_logfile = BASE_DIR + '/log/logfile.txt'
|
491
|
+
bm.path_to_logfile = biomedisa.BASE_DIR + '/log/logfile.txt'
|
494
492
|
else:
|
495
493
|
bm.django_env = False
|
496
494
|
|
@@ -1,6 +1,6 @@
|
|
1
1
|
##########################################################################
|
2
2
|
## ##
|
3
|
-
## Copyright (c) 2024 Philipp Lösel. All rights reserved.
|
3
|
+
## Copyright (c) 2019-2024 Philipp Lösel. All rights reserved. ##
|
4
4
|
## ##
|
5
5
|
## This file is part of the open source project biomedisa. ##
|
6
6
|
## ##
|
@@ -1,6 +1,6 @@
|
|
1
1
|
##########################################################################
|
2
2
|
## ##
|
3
|
-
## Copyright (c) 2024 Philipp Lösel. All rights reserved.
|
3
|
+
## Copyright (c) 2019-2024 Philipp Lösel. All rights reserved. ##
|
4
4
|
## ##
|
5
5
|
## This file is part of the open source project biomedisa. ##
|
6
6
|
## ##
|
@@ -1,6 +1,6 @@
|
|
1
1
|
##########################################################################
|
2
2
|
## ##
|
3
|
-
## Copyright (c) 2024 Philipp Lösel. All rights reserved.
|
3
|
+
## Copyright (c) 2019-2024 Philipp Lösel. All rights reserved. ##
|
4
4
|
## ##
|
5
5
|
## This file is part of the open source project biomedisa. ##
|
6
6
|
## ##
|
@@ -1,6 +1,6 @@
|
|
1
1
|
##########################################################################
|
2
2
|
## ##
|
3
|
-
## Copyright (c)
|
3
|
+
## Copyright (c) 2019-2024 Philipp Lösel. All rights reserved. ##
|
4
4
|
## ##
|
5
5
|
## This file is part of the open source project biomedisa. ##
|
6
6
|
## ##
|
@@ -1,7 +1,7 @@
|
|
1
1
|
#!/usr/bin/python3
|
2
2
|
##########################################################################
|
3
3
|
## ##
|
4
|
-
## Copyright (c) 2024 Philipp Lösel. All rights reserved.
|
4
|
+
## Copyright (c) 2019-2024 Philipp Lösel. All rights reserved. ##
|
5
5
|
## ##
|
6
6
|
## This file is part of the open source project biomedisa. ##
|
7
7
|
## ##
|
@@ -27,13 +27,10 @@
|
|
27
27
|
## ##
|
28
28
|
##########################################################################
|
29
29
|
|
30
|
-
import
|
31
|
-
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
|
32
|
-
if not BASE_DIR in sys.path:
|
33
|
-
sys.path.append(BASE_DIR)
|
30
|
+
import os
|
34
31
|
import biomedisa
|
35
|
-
from
|
36
|
-
from
|
32
|
+
from biomedisa.features.curvop_numba import curvop, evolution
|
33
|
+
from biomedisa.features.biomedisa_helper import (unique_file_path, load_data, save_data,
|
37
34
|
pre_processing, img_to_uint8, silent_remove)
|
38
35
|
import numpy as np
|
39
36
|
import numba
|
@@ -143,7 +140,7 @@ def activeContour(data, labelData, alpha=1.0, smooth=1, steps=3,
|
|
143
140
|
if bm.django_env:
|
144
141
|
bm.username = os.path.basename(os.path.dirname(bm.path_to_data))
|
145
142
|
bm.shortfilename = os.path.basename(bm.path_to_data)
|
146
|
-
bm.path_to_logfile = BASE_DIR + '/log/logfile.txt'
|
143
|
+
bm.path_to_logfile = biomedisa.BASE_DIR + '/log/logfile.txt'
|
147
144
|
|
148
145
|
# pre-processing
|
149
146
|
bm = pre_processing(bm)
|
@@ -234,13 +231,13 @@ def refinement(bm):
|
|
234
231
|
|
235
232
|
def post_processing(path_to_acwe, image_id=None, friend_id=None, simple=False, remote=False):
|
236
233
|
if remote:
|
237
|
-
with open(BASE_DIR + '/log/config_4', 'w') as configfile:
|
234
|
+
with open(biomedisa.BASE_DIR + '/log/config_4', 'w') as configfile:
|
238
235
|
print(path_to_acwe, 'phantom', file=configfile)
|
239
236
|
else:
|
240
237
|
import django
|
241
238
|
django.setup()
|
242
239
|
from biomedisa_app.models import Upload
|
243
|
-
from
|
240
|
+
from biomedisa.features.create_slices import create_slices
|
244
241
|
from redis import Redis
|
245
242
|
from rq import Queue
|
246
243
|
|
@@ -300,7 +297,7 @@ def init_active_contour(image_id, friend_id, label_id, simple=False):
|
|
300
297
|
|
301
298
|
# get host information
|
302
299
|
host = ''
|
303
|
-
host_base = BASE_DIR
|
300
|
+
host_base = biomedisa.BASE_DIR
|
304
301
|
subhost, qsub_pid = None, None
|
305
302
|
if 'REMOTE_QUEUE_HOST' in config:
|
306
303
|
host = config['REMOTE_QUEUE_HOST']
|
@@ -313,8 +310,8 @@ def init_active_contour(image_id, friend_id, label_id, simple=False):
|
|
313
310
|
if host:
|
314
311
|
|
315
312
|
# command
|
316
|
-
cmd = ['python3', host_base+'/
|
317
|
-
cmd += [image.pic.path.replace(BASE_DIR,host_base), friend.pic.path.replace(BASE_DIR,host_base)]
|
313
|
+
cmd = ['python3', host_base+'/biomedisa/features/active_contour.py']
|
314
|
+
cmd += [image.pic.path.replace(biomedisa.BASE_DIR,host_base), friend.pic.path.replace(biomedisa.BASE_DIR,host_base)]
|
318
315
|
cmd += [f'-iid={image.id}', f'-fid={friend.id}', '-r']
|
319
316
|
|
320
317
|
# command (append only on demand)
|
@@ -338,8 +335,8 @@ def init_active_contour(image_id, friend_id, label_id, simple=False):
|
|
338
335
|
|
339
336
|
# send data to host
|
340
337
|
success=0
|
341
|
-
success+=send_data_to_host(image.pic.path, host+':'+image.pic.path.replace(BASE_DIR,host_base))
|
342
|
-
success+=send_data_to_host(friend.pic.path, host+':'+friend.pic.path.replace(BASE_DIR,host_base))
|
338
|
+
success+=send_data_to_host(image.pic.path, host+':'+image.pic.path.replace(biomedisa.BASE_DIR,host_base))
|
339
|
+
success+=send_data_to_host(friend.pic.path, host+':'+friend.pic.path.replace(biomedisa.BASE_DIR,host_base))
|
343
340
|
|
344
341
|
if success==0:
|
345
342
|
|
@@ -355,14 +352,14 @@ def init_active_contour(image_id, friend_id, label_id, simple=False):
|
|
355
352
|
subprocess.Popen(cmd).wait()
|
356
353
|
|
357
354
|
# config
|
358
|
-
success = subprocess.Popen(['scp', host+':'+host_base+'/log/config_4', BASE_DIR+'/log/config_4']).wait()
|
355
|
+
success = subprocess.Popen(['scp', host+':'+host_base+'/log/config_4', biomedisa.BASE_DIR+'/log/config_4']).wait()
|
359
356
|
|
360
357
|
if success==0:
|
361
|
-
with open(BASE_DIR + '/log/config_4', 'r') as configfile:
|
358
|
+
with open(biomedisa.BASE_DIR + '/log/config_4', 'r') as configfile:
|
362
359
|
acwe_on_host, _ = configfile.read().split()
|
363
360
|
|
364
361
|
# local file names
|
365
|
-
path_to_acwe = unique_file_path(acwe_on_host.replace(host_base,BASE_DIR))
|
362
|
+
path_to_acwe = unique_file_path(acwe_on_host.replace(host_base,biomedisa.BASE_DIR))
|
366
363
|
|
367
364
|
# get results
|
368
365
|
subprocess.Popen(['scp', host+':'+acwe_on_host, path_to_acwe]).wait()
|
@@ -1,6 +1,6 @@
|
|
1
1
|
##########################################################################
|
2
2
|
## ##
|
3
|
-
## Copyright (c) 2024 Philipp Lösel. All rights reserved.
|
3
|
+
## Copyright (c) 2019-2024 Philipp Lösel. All rights reserved. ##
|
4
4
|
## ##
|
5
5
|
## This file is part of the open source project biomedisa. ##
|
6
6
|
## ##
|