careamics 0.1.0rc4__py3-none-any.whl → 0.1.0rc6__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.
Potentially problematic release.
This version of careamics might be problematic. Click here for more details.
- careamics/callbacks/hyperparameters_callback.py +10 -3
- careamics/callbacks/progress_bar_callback.py +37 -4
- careamics/careamist.py +92 -55
- careamics/config/__init__.py +0 -1
- careamics/config/algorithm_model.py +5 -3
- careamics/config/architectures/architecture_model.py +7 -0
- careamics/config/architectures/custom_model.py +8 -1
- careamics/config/architectures/register_model.py +3 -1
- careamics/config/architectures/unet_model.py +3 -0
- careamics/config/architectures/vae_model.py +2 -0
- careamics/config/callback_model.py +4 -15
- careamics/config/configuration_example.py +4 -4
- careamics/config/configuration_factory.py +113 -55
- careamics/config/configuration_model.py +14 -16
- careamics/config/data_model.py +63 -165
- careamics/config/inference_model.py +9 -75
- careamics/config/optimizer_models.py +4 -4
- careamics/config/references/algorithm_descriptions.py +1 -0
- careamics/config/references/references.py +1 -0
- careamics/config/support/__init__.py +0 -2
- careamics/config/support/supported_activations.py +2 -0
- careamics/config/support/supported_algorithms.py +3 -1
- careamics/config/support/supported_architectures.py +2 -0
- careamics/config/support/supported_data.py +2 -0
- careamics/config/support/supported_loggers.py +2 -0
- careamics/config/support/supported_losses.py +2 -0
- careamics/config/support/supported_optimizers.py +2 -0
- careamics/config/support/supported_pixel_manipulations.py +3 -3
- careamics/config/support/supported_struct_axis.py +2 -0
- careamics/config/support/supported_transforms.py +4 -15
- careamics/config/tile_information.py +2 -0
- careamics/config/training_model.py +1 -0
- careamics/config/transformations/__init__.py +3 -2
- careamics/config/transformations/n2v_manipulate_model.py +1 -0
- careamics/config/transformations/normalize_model.py +1 -0
- careamics/config/transformations/transform_model.py +1 -0
- careamics/config/transformations/xy_flip_model.py +43 -0
- careamics/config/transformations/xy_random_rotate90_model.py +13 -7
- careamics/config/validators/validator_utils.py +1 -0
- careamics/conftest.py +13 -0
- careamics/dataset/dataset_utils/__init__.py +0 -1
- careamics/dataset/dataset_utils/dataset_utils.py +5 -4
- careamics/dataset/dataset_utils/file_utils.py +4 -3
- careamics/dataset/dataset_utils/read_tiff.py +6 -2
- careamics/dataset/dataset_utils/read_utils.py +2 -0
- careamics/dataset/dataset_utils/read_zarr.py +11 -7
- careamics/dataset/in_memory_dataset.py +84 -76
- careamics/dataset/iterable_dataset.py +166 -134
- careamics/dataset/patching/__init__.py +0 -7
- careamics/dataset/patching/patching.py +56 -14
- careamics/dataset/patching/random_patching.py +8 -2
- careamics/dataset/patching/sequential_patching.py +20 -14
- careamics/dataset/patching/tiled_patching.py +13 -7
- careamics/dataset/patching/validate_patch_dimension.py +2 -0
- careamics/dataset/zarr_dataset.py +2 -0
- careamics/lightning_datamodule.py +63 -41
- careamics/lightning_module.py +9 -3
- careamics/lightning_prediction_datamodule.py +15 -20
- careamics/lightning_prediction_loop.py +8 -6
- careamics/losses/__init__.py +1 -3
- careamics/losses/loss_factory.py +2 -1
- careamics/losses/losses.py +11 -7
- careamics/model_io/__init__.py +0 -1
- careamics/model_io/bioimage/_readme_factory.py +2 -1
- careamics/model_io/bioimage/bioimage_utils.py +1 -0
- careamics/model_io/bioimage/model_description.py +1 -0
- careamics/model_io/bmz_io.py +4 -3
- careamics/models/activation.py +2 -0
- careamics/models/layers.py +122 -25
- careamics/models/model_factory.py +2 -1
- careamics/models/unet.py +114 -19
- careamics/prediction/stitch_prediction.py +2 -5
- careamics/transforms/__init__.py +4 -25
- careamics/transforms/compose.py +124 -0
- careamics/transforms/n2v_manipulate.py +65 -34
- careamics/transforms/normalize.py +91 -28
- careamics/transforms/pixel_manipulation.py +7 -7
- careamics/transforms/struct_mask_parameters.py +3 -1
- careamics/transforms/transform.py +24 -0
- careamics/transforms/tta.py +2 -2
- careamics/transforms/xy_flip.py +123 -0
- careamics/transforms/xy_random_rotate90.py +66 -60
- careamics/utils/__init__.py +0 -1
- careamics/utils/base_enum.py +28 -0
- careamics/utils/context.py +1 -0
- careamics/utils/logging.py +1 -0
- careamics/utils/metrics.py +1 -0
- careamics/utils/path_utils.py +2 -0
- careamics/utils/ram.py +2 -0
- careamics/utils/receptive_field.py +93 -87
- careamics/utils/torch_utils.py +1 -0
- {careamics-0.1.0rc4.dist-info → careamics-0.1.0rc6.dist-info}/METADATA +17 -61
- careamics-0.1.0rc6.dist-info/RECORD +107 -0
- careamics/config/noise_models.py +0 -162
- careamics/config/support/supported_extraction_strategies.py +0 -24
- careamics/config/transformations/nd_flip_model.py +0 -32
- careamics/dataset/patching/patch_transform.py +0 -44
- careamics/losses/noise_model_factory.py +0 -40
- careamics/losses/noise_models.py +0 -524
- careamics/transforms/nd_flip.py +0 -93
- careamics-0.1.0rc4.dist-info/RECORD +0 -110
- {careamics-0.1.0rc4.dist-info → careamics-0.1.0rc6.dist-info}/WHEEL +0 -0
- {careamics-0.1.0rc4.dist-info → careamics-0.1.0rc6.dist-info}/licenses/LICENSE +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.3
|
|
2
2
|
Name: careamics
|
|
3
|
-
Version: 0.1.
|
|
3
|
+
Version: 0.1.0rc6
|
|
4
4
|
Summary: Toolbox for running N2V and friends.
|
|
5
5
|
Project-URL: homepage, https://careamics.github.io/
|
|
6
6
|
Project-URL: repository, https://github.com/CAREamics/careamics
|
|
@@ -14,9 +14,9 @@ Classifier: Programming Language :: Python :: 3.8
|
|
|
14
14
|
Classifier: Programming Language :: Python :: 3.9
|
|
15
15
|
Classifier: Programming Language :: Python :: 3.10
|
|
16
16
|
Classifier: Programming Language :: Python :: 3.11
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
17
18
|
Classifier: Typing :: Typed
|
|
18
19
|
Requires-Python: >=3.8
|
|
19
|
-
Requires-Dist: albumentations
|
|
20
20
|
Requires-Dist: bioimageio-core>=0.6.0
|
|
21
21
|
Requires-Dist: psutil
|
|
22
22
|
Requires-Dist: pydantic>=2.5
|
|
@@ -48,7 +48,7 @@ Description-Content-Type: text/markdown
|
|
|
48
48
|
</a>
|
|
49
49
|
</p>
|
|
50
50
|
|
|
51
|
-
# CAREamics
|
|
51
|
+
# CAREamics
|
|
52
52
|
|
|
53
53
|
[](https://github.com/CAREamics/careamics/blob/main/LICENSE)
|
|
54
54
|
[](https://pypi.org/project/careamics)
|
|
@@ -56,67 +56,23 @@ Description-Content-Type: text/markdown
|
|
|
56
56
|
[](https://github.com/CAREamics/careamics/actions/workflows/ci.yml)
|
|
57
57
|
[](https://codecov.io/gh/CAREamics/careamics)
|
|
58
58
|
|
|
59
|
-
## Installation
|
|
60
59
|
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
```
|
|
64
|
-
For more details on the options please follow the installation [guide](https://careamics.github.io/careamics/).
|
|
60
|
+
CAREamics is a PyTorch library aimed at simplifying the use of Noise2Void and its many
|
|
61
|
+
variants and cousins (CARE, Noise2Noise, N2V2, P(P)N2V, HDN, muSplit etc.).
|
|
65
62
|
|
|
66
|
-
##
|
|
63
|
+
## Why CAREamics?
|
|
67
64
|
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
1. Using the [yaml config](examples/n2v_2D_reference.yml) file
|
|
65
|
+
Noise2Void is a widely used denoising algorithm, and is readily available from the `n2v`
|
|
66
|
+
python package. However, n2v is based on TensorFlow and Keras and we found it
|
|
67
|
+
increasingly hard to maintain. In addition, more recent methods (PPN2V, DivNoising,
|
|
68
|
+
HDN) are all implemented in PyTorch, but are lacking the extra features that would make
|
|
69
|
+
them usable by the community.
|
|
74
70
|
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
71
|
+
The aim of CAREamics is to provide a PyTorch library reuniting all the latest methods
|
|
72
|
+
in one package, while providing a simple and consistent API. The library relies on
|
|
73
|
+
PyTorch Lightning as a back-end. In addition, we will provide extensive documentation and
|
|
74
|
+
tutorials on how to best apply these methods in a scientific context.
|
|
79
75
|
|
|
80
|
-
|
|
81
|
-
loss: type of loss function, e.g. n2v for Noise2Void
|
|
82
|
-
model: model architecture, e.g. UNet
|
|
83
|
-
is_3D: True if 3D data, False if 2D data
|
|
84
|
-
|
|
85
|
-
training:
|
|
86
|
-
num_epochs: Number of training epochs
|
|
87
|
-
patch_size: Size of the patches, List of 2 or 3 elements
|
|
88
|
-
batch_size: Batch size for training
|
|
89
|
-
|
|
90
|
-
extraction_strategy: Controls how the patches are extracted from the data
|
|
91
|
-
|
|
92
|
-
data:
|
|
93
|
-
data_format: File extension, e.g. tif
|
|
94
|
-
axes: Defines the shape of the input data
|
|
95
|
-
```
|
|
96
|
-
Full description of the configuration parameters is in the [documentation](https://careamics.github.io/careamics/).
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
```python
|
|
100
|
-
engine = Engine(config_path="config.yml")
|
|
101
|
-
|
|
102
|
-
```
|
|
103
|
-
2. Using the path to the pretrained model
|
|
104
|
-
It's also possible to initialize the Engine using the model checkpoint, saved during the training or downloaded from the [BioImage Model Zoo](https://bioimage.io/#/).
|
|
105
|
-
Checkpoint must contain model_state_dict.
|
|
106
|
-
Read more abount saving and loading models in the [documentation](https://careamics.github.io/careamics/).
|
|
107
|
-
|
|
108
|
-
Once Engine is initialized, we can start training, providing the relative paths to train and validation data
|
|
109
|
-
|
|
110
|
-
```python
|
|
111
|
-
engine.train(train_path=train_path, val_path=val_path)
|
|
112
|
-
```
|
|
113
|
-
Training will run for the specified number of epochs and save the model checkpoint in the working directory.
|
|
114
|
-
|
|
115
|
-
Prediction could be done directly after the training or by loading the pretrained model checkpoint.
|
|
116
|
-
|
|
117
|
-
```python
|
|
118
|
-
predictions = engine.predict(pred_path=predict_path)
|
|
119
|
-
```
|
|
120
|
-
|
|
121
|
-
For more examples please take a look at the [notebooks](examples).
|
|
76
|
+
## Installation and use
|
|
122
77
|
|
|
78
|
+
Check out the [documentation](https://careamics.github.io/) for installation instructions and guides!
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
careamics/__init__.py,sha256=DkMGt4t9ua0gCgvZFEtb6eydvoxG976T0KUro8KnDNA,760
|
|
2
|
+
careamics/careamist.py,sha256=vn-XiawERTTIKZqcfTg8leoVoLdBmHWIe9tkGrgkEGY,29719
|
|
3
|
+
careamics/conftest.py,sha256=Od4WcaaP0UP-XUMrFr_oo4e6c2hi_RvNbuaRTopwlmI,911
|
|
4
|
+
careamics/lightning_datamodule.py,sha256=TBKTpVfOvgsQg_8gwU68Au-aw_OXfUSsah7snXef43Y,32685
|
|
5
|
+
careamics/lightning_module.py,sha256=MSUxZfkhM1-D5AEZrkuNazOBbZCgbxCuuGtgYjhLEHU,10313
|
|
6
|
+
careamics/lightning_prediction_datamodule.py,sha256=4aTyMSbHiy1ebp6WSfDMDoYCJJU4qf4T5ShAjRNn_yM,15057
|
|
7
|
+
careamics/lightning_prediction_loop.py,sha256=qDfRVXPiCVyRz-P3l9tmlCfMT8mx9waKNfNrIMrjt3w,4599
|
|
8
|
+
careamics/py.typed,sha256=esB4cHc6c07uVkGtqf8at7ttEnprwRxwk8obY8Qumq4,187
|
|
9
|
+
careamics/callbacks/__init__.py,sha256=spxJlDByD-6QtMl9vcIty8Wb0tyHaSTKTItozHenI44,204
|
|
10
|
+
careamics/callbacks/hyperparameters_callback.py,sha256=ODJpwwdgc1-Py8yEUpXLar8_IOAcfR7lF3--6LfSiGc,1496
|
|
11
|
+
careamics/callbacks/progress_bar_callback.py,sha256=8HvNSWZldixd6pjz0dLDo0apIbzTovv5smKmZ6tZQ8U,2444
|
|
12
|
+
careamics/config/__init__.py,sha256=SP1oJKhK3VDN9ABwnpfR3H02qRprzymjRfNYeC7kHEo,1019
|
|
13
|
+
careamics/config/algorithm_model.py,sha256=2y4SWagzIyZH_WWYeZWLF-4SGcBk-g04QwKdSzmYTiM,5771
|
|
14
|
+
careamics/config/callback_model.py,sha256=CcamVhgRsVdskCe_9EtyWi1YbrNX5vKEplc97AYz1h8,3118
|
|
15
|
+
careamics/config/configuration_example.py,sha256=vxXYGB05cOqQwGGBuPN4kQ3uQJxRwzyFq5Tflk5HNvc,2575
|
|
16
|
+
careamics/config/configuration_factory.py,sha256=cnv6Qod5Wx1J0h951wgbayMO1KVUWxK0OmAIvscPzm8,21286
|
|
17
|
+
careamics/config/configuration_model.py,sha256=j7QryeMNQAsD_0byb81u99Oek2uyj3Syr0nUepFYTe8,18494
|
|
18
|
+
careamics/config/data_model.py,sha256=58cS8a1Tk4ZXMf8z4QA7NtJKi_EwlfGTsB0e59q9hhE,12741
|
|
19
|
+
careamics/config/inference_model.py,sha256=gbLV4B_7VRAc0QCa8r2EYk-YOdGuGswJIQGDFkj7XUM,5936
|
|
20
|
+
careamics/config/optimizer_models.py,sha256=eWCyH9rMTUl82ubqrHFHssQwVyTYNh9lRpVQGv96ppM,5336
|
|
21
|
+
careamics/config/tile_information.py,sha256=-k9hcJrL-QBp9n0Nf5qufEMcudnNNe8pWY37NtlWLxs,3009
|
|
22
|
+
careamics/config/training_model.py,sha256=oghv91J7xIdI69wpNJGmLUAwgM9l3VhMsbsOo4USqkU,1559
|
|
23
|
+
careamics/config/architectures/__init__.py,sha256=CdnViydyTdQixus3uWHBIgbgxmu9t1_ADehqpjN_57U,444
|
|
24
|
+
careamics/config/architectures/architecture_model.py,sha256=545hlbOZU9EJNGTcSpy7eXpfzCtvIm28dDJGMo36AfQ,886
|
|
25
|
+
careamics/config/architectures/custom_model.py,sha256=MxsFK4cvwjt59_-ZWeIFrlExQ9PpR5X0s9SqxN_B4YQ,4598
|
|
26
|
+
careamics/config/architectures/register_model.py,sha256=lHH0aUPmXtI3Bq_76zkhg07_Yb_nOJZkZJLCC_G-rZM,2434
|
|
27
|
+
careamics/config/architectures/unet_model.py,sha256=sQjfqTjh1kTNi369U3_94jroU6LyLlflaIe8FwdHQvo,2892
|
|
28
|
+
careamics/config/architectures/vae_model.py,sha256=Z0satmte4udManh_bxtl93ZmQlmo6JFE1NQIuZkTsQk,926
|
|
29
|
+
careamics/config/references/__init__.py,sha256=rZAQzmrciX5cNICcXaBH6sbE6N6L7_qYQUkasNy9y-c,763
|
|
30
|
+
careamics/config/references/algorithm_descriptions.py,sha256=wR3hIoeg5eiUEPbwTxMpQYLTKQyRl_5naSDbBZOZESU,3541
|
|
31
|
+
careamics/config/references/references.py,sha256=AXx08FJQxHb7SYOluCr_eQn_mbOris5dXqhKrCnhBTE,1573
|
|
32
|
+
careamics/config/support/__init__.py,sha256=pKqk76kyBraiSC1SQos-cyiQwsfOLLkLuWj6Hw60LZ4,1041
|
|
33
|
+
careamics/config/support/supported_activations.py,sha256=O27_dGDgw2P-DslKJsXGVAyS2NUQM6Ta4jeo2uTQlW0,519
|
|
34
|
+
careamics/config/support/supported_algorithms.py,sha256=GCkauFDlmb2hJwFSdoIpGmpLjPeYFHOGy2NweKdw8T4,358
|
|
35
|
+
careamics/config/support/supported_architectures.py,sha256=LLD6hyje9Q0BcvA7p2E8WW_cY5yEgMI_NAP4HBi27UU,540
|
|
36
|
+
careamics/config/support/supported_data.py,sha256=C0VcP1DkZqJ4MPn6UZcCZX8ZfVNdz0ZJk6y89fiim2I,2084
|
|
37
|
+
careamics/config/support/supported_loggers.py,sha256=ubSOkGoYabGbm_jmyc1R3eFcvcP-sHmuyiBi_d3_wLg,197
|
|
38
|
+
careamics/config/support/supported_losses.py,sha256=TPsMCuDdgb64TRyDwonnwHb1R-rkn3OzhtHimyVtrOY,540
|
|
39
|
+
careamics/config/support/supported_optimizers.py,sha256=xxbJsyohJTlHeUz2I4eRwcE3BeACs-6PH8cpX6w2wX8,1394
|
|
40
|
+
careamics/config/support/supported_pixel_manipulations.py,sha256=rFiktUlvoFU7s1NAKEMqsXOzLw5eaw9GtCKUznvq6xc,432
|
|
41
|
+
careamics/config/support/supported_struct_axis.py,sha256=alZMA5Y-BpDymLPUEd1zqVY0xMkgl9Rv1d4ujED6sco,424
|
|
42
|
+
careamics/config/support/supported_transforms.py,sha256=ylTiS8fUFKFwfn85gh7kKF4Trb9Q4ENPKm-XDWCe-SY,311
|
|
43
|
+
careamics/config/transformations/__init__.py,sha256=oqwBAL2XXbPRZZ5iOzNqalX6SyJ1M-S0lkfbDGZOzyE,378
|
|
44
|
+
careamics/config/transformations/n2v_manipulate_model.py,sha256=UTyfpm1mmMvYg_HoMzXilZhJGx_muiV-lLQ4UThCFJ0,1854
|
|
45
|
+
careamics/config/transformations/normalize_model.py,sha256=fua-JAcfNdTuikERreaR_0mz9ExsYSDJ7mUgIDl-U0M,804
|
|
46
|
+
careamics/config/transformations/transform_model.py,sha256=i7KAtSv4nah2H7uyJFKqg7RdKF68OHIPMNNvDo0HxGY,1000
|
|
47
|
+
careamics/config/transformations/xy_flip_model.py,sha256=zU-uZ1b1zNZWckbho3onN-B7BHKhN7jbgbNZyRQhv2s,1025
|
|
48
|
+
careamics/config/transformations/xy_random_rotate90_model.py,sha256=6sYKmtCLvz0SV1qZgBSHUTH-CUjwvHnohq1HyPntbyE,894
|
|
49
|
+
careamics/config/validators/__init__.py,sha256=iv0nVI0W7j9DxFPwh0DjRCzM9P8oLQn4Gwi5rfuFrrI,180
|
|
50
|
+
careamics/config/validators/validator_utils.py,sha256=H11pttfXFdnlUw9FFIgPWy3sxO1ks38dtmYAS6Kl9-c,2624
|
|
51
|
+
careamics/dataset/__init__.py,sha256=cUcqy1Nxa5WhDQim6948r3i1kGQ-HijUqAACyyM7cuU,174
|
|
52
|
+
careamics/dataset/in_memory_dataset.py,sha256=WcVfE7sdqac07dzmb4Wz2yML6t-0PmQaIfmvyv6uQQE,12567
|
|
53
|
+
careamics/dataset/iterable_dataset.py,sha256=aJKL3F6SesOy-WTRXarYDJjGh7RlxqmYDrYAv09J4I0,15070
|
|
54
|
+
careamics/dataset/zarr_dataset.py,sha256=lojnK5bhiF1vyjuPtWXBrZ9sy5fT_rBvZJbbbnE-H_I,5665
|
|
55
|
+
careamics/dataset/dataset_utils/__init__.py,sha256=5U_kavgh_QEvTiDuM-O4hsqmDOKh6_y6iDvZPE8Jtsc,446
|
|
56
|
+
careamics/dataset/dataset_utils/dataset_utils.py,sha256=zYNglet5lYKxIhTeOGG2K24oujC-m5zyYlwJcQcleVA,2662
|
|
57
|
+
careamics/dataset/dataset_utils/file_utils.py,sha256=hOCDYlVcoBCFR3B9Eh5nTYSiTW0wskAecUfykB1Mj_I,4047
|
|
58
|
+
careamics/dataset/dataset_utils/read_tiff.py,sha256=nbSAU11Tv-jViFHRAtrG8pGH09CG3IIdF2WF6duAxxQ,1729
|
|
59
|
+
careamics/dataset/dataset_utils/read_utils.py,sha256=0nsfzHq3zr9kjm2qZZrMRKI5LC5MiRSH35xPBCYyBrQ,579
|
|
60
|
+
careamics/dataset/dataset_utils/read_zarr.py,sha256=2jzREAnJDQSv0qmsL-v00BxmiZ_sp0ijq667LZSQ_hY,1685
|
|
61
|
+
careamics/dataset/patching/__init__.py,sha256=7-s12oUAZNlMOwSkxSwbD7vojQINWYFzn_4qIJ87WBg,37
|
|
62
|
+
careamics/dataset/patching/patching.py,sha256=vS7wQ1JdSNsFlqJi41Y_NupFIez2BXOO86r0UY1gDJA,7535
|
|
63
|
+
careamics/dataset/patching/random_patching.py,sha256=B1POeDApLyvcRRBpg0loLsOoUGWVkMojEzt4xD_WiaQ,6281
|
|
64
|
+
careamics/dataset/patching/sequential_patching.py,sha256=_l3Q2uYIhjMJMaxDdSbHC9_2kRF9eLz-Xs3r9i7j3Nc,5903
|
|
65
|
+
careamics/dataset/patching/tiled_patching.py,sha256=_IUl5zcBM-BMcRfQajDOQ7RIXmqympM3O75jRHqRi0M,5888
|
|
66
|
+
careamics/dataset/patching/validate_patch_dimension.py,sha256=Y7SWajYWtU7pdZpAI3t_H3Mxw5GMjd9hPpdRygORwK8,2036
|
|
67
|
+
careamics/losses/__init__.py,sha256=kVEwfZ2xXfd8x0n-VHGKm6qvzbto5pIIJYP_jN-bCtw,89
|
|
68
|
+
careamics/losses/loss_factory.py,sha256=vaMlxH5oescWTKlK1adWwbeD9tW4Ti-p7qKmc1iHCi0,1005
|
|
69
|
+
careamics/losses/losses.py,sha256=DKwHZ9ifVe6wMd3tBOiswLC-saU1bj1RCcXGOkREmKU,2328
|
|
70
|
+
careamics/model_io/__init__.py,sha256=HITzjiuZQwo-rQ2_Ma3bz9l7PDANv1_S489E-tffV9s,155
|
|
71
|
+
careamics/model_io/bmz_io.py,sha256=MGZklRek3WI8VqV0gt63hL-APDsMkYbDGdqkih_iWAY,7031
|
|
72
|
+
careamics/model_io/model_io_utils.py,sha256=x5u1HszZgRfvuku4eKQhmInyxRaEzkgNqAhGSyLS6e4,2116
|
|
73
|
+
careamics/model_io/bioimage/__init__.py,sha256=r94nu8WDAvj0Fbu4C-iJXdOhfSQXeZBvN3UKsLG0RNI,298
|
|
74
|
+
careamics/model_io/bioimage/_readme_factory.py,sha256=LZAuEiWNBTPaD8KrLPMq16yJuOPKDZiGQuTMHKLvoT4,3514
|
|
75
|
+
careamics/model_io/bioimage/bioimage_utils.py,sha256=nlW0J1daYyLbL6yVN3QSn3HhA2joMjIG-thK64lpVTY,1085
|
|
76
|
+
careamics/model_io/bioimage/model_description.py,sha256=wXGJBzGGSwEds-V0G4mgPvoi4dDXNn_7Tp6iPCsAeTY,9208
|
|
77
|
+
careamics/models/__init__.py,sha256=Wty5hwQb_As33pQOZqY5j-DpDOdh5ArBH4BhQDSuXTQ,133
|
|
78
|
+
careamics/models/activation.py,sha256=xdqz4-yKV7oElG_dDrYuibS8HOiYvKdV_r9FwWPvaDE,977
|
|
79
|
+
careamics/models/layers.py,sha256=oWzpq8OdHFEJqPWC9X8IRPNe0XqAnesSqwoT6V3t1Mw,13712
|
|
80
|
+
careamics/models/model_factory.py,sha256=5YRwRRUemxb-pTRL3VWn8N61tCGyhrurqPgcFaNETb0,1360
|
|
81
|
+
careamics/models/unet.py,sha256=3pXpiCIw7WUaDV0Jmczkxi99C5-Zu3NpQpWxgRkeGL8,14321
|
|
82
|
+
careamics/prediction/__init__.py,sha256=-Bfc7UqPSqpGx0NGvHMkE-bHOkZYMn7EaxQ9tO6A3uU,118
|
|
83
|
+
careamics/prediction/stitch_prediction.py,sha256=lC9qdcR4BTNezCxoTeombg6k8mmTmN45TZSbEHg13Mk,2163
|
|
84
|
+
careamics/transforms/__init__.py,sha256=VIHIsC8sMAh1TCm67ifB816Zp-LRo6rAONPuT2Qs3bs,483
|
|
85
|
+
careamics/transforms/compose.py,sha256=mTkhoxvgvsBqNoz9RWpJ_tqsDl1CDp0-UARTjUuBRf4,3477
|
|
86
|
+
careamics/transforms/n2v_manipulate.py,sha256=6O0RmL6zgBvZgbga6yyu1FwrxPlWXuviDoHzyxQQXfY,5404
|
|
87
|
+
careamics/transforms/normalize.py,sha256=Ts1gOuzWYPmjAlMf4OgN3y6bHVgvBaq91GdkKGWpTy4,4237
|
|
88
|
+
careamics/transforms/pixel_manipulation.py,sha256=qjTfgk86VkwVVu69E0sXQEfASi170IlzxorpAPmYOe0,12657
|
|
89
|
+
careamics/transforms/struct_mask_parameters.py,sha256=jE29Li9sx3olaRnqYfJsSlKi2t0WQzJmCm9aCbIQEsA,421
|
|
90
|
+
careamics/transforms/transform.py,sha256=cEqc4ci8na70i-HIGYC7udRfVa8D_8OjdRVrr3txLvQ,464
|
|
91
|
+
careamics/transforms/tta.py,sha256=6H0E0yxmZT_TEslenOIXqlEM-l_0oCtIk59gAGP0byM,1960
|
|
92
|
+
careamics/transforms/xy_flip.py,sha256=Q1kKTa2kE3W1P3dlpT4GAVSSHM3TebnrvIyWh75Fnko,3443
|
|
93
|
+
careamics/transforms/xy_random_rotate90.py,sha256=zWdBROLLjgxTMSQEQesJr17j84BmZhKWCMVVONHU8mw,2781
|
|
94
|
+
careamics/utils/__init__.py,sha256=tO1X5QTfnthepuW0uYagz5fWehtLtwK2gPmkUeqhdOw,334
|
|
95
|
+
careamics/utils/base_enum.py,sha256=bz1D8mDx5V5hdnJ3WAzJXWHJTbgwAky5FprUt9F5cMA,1387
|
|
96
|
+
careamics/utils/context.py,sha256=Ljf70OR1FcYpsVpxb5Sr2fzmPVIZgDS1uZob_3BcELg,1409
|
|
97
|
+
careamics/utils/logging.py,sha256=coIscjkDYpqcsGnsONuYOdIYd6_gHxdnYIZ-e9Y2Ybg,10322
|
|
98
|
+
careamics/utils/metrics.py,sha256=9YQe5Aj2Pv2h9jnRFeRbDQ_3qXAW0QHpucSqiUtwDcA,2382
|
|
99
|
+
careamics/utils/path_utils.py,sha256=8AugiG5DOmzgSnTCJI8vypXaPE0XhnR-9pzeiFUZ-0I,554
|
|
100
|
+
careamics/utils/ram.py,sha256=mhZVA_DsIlXMvABSxot4eBBxbvWx7JzfijC_cVBtF1s,239
|
|
101
|
+
careamics/utils/receptive_field.py,sha256=Y2h4c8S6glX3qcx5KHDmO17Kkuyey9voxfoXyqcAfiM,3296
|
|
102
|
+
careamics/utils/running_stats.py,sha256=GIPMPuH9EOUKD_cYBkJFPggXRKnQEiOXx68Pq9UCCVI,1384
|
|
103
|
+
careamics/utils/torch_utils.py,sha256=g1zxdlM7_BA7mMLcCzmrxZX4LmH__KXlJibC95muVaA,3014
|
|
104
|
+
careamics-0.1.0rc6.dist-info/METADATA,sha256=o_1ZDxRYCTLnSruXdXEHT8Y3qNiBW-fShITOyT_wO3E,3464
|
|
105
|
+
careamics-0.1.0rc6.dist-info/WHEEL,sha256=zEMcRr9Kr03x1ozGwg5v9NQBKn3kndp6LSoSlVg-jhU,87
|
|
106
|
+
careamics-0.1.0rc6.dist-info/licenses/LICENSE,sha256=6zdNW-k_xHRKYWUf9tDI_ZplUciFHyj0g16DYuZ2udw,1509
|
|
107
|
+
careamics-0.1.0rc6.dist-info/RECORD,,
|
careamics/config/noise_models.py
DELETED
|
@@ -1,162 +0,0 @@
|
|
|
1
|
-
from __future__ import annotations
|
|
2
|
-
|
|
3
|
-
from enum import Enum
|
|
4
|
-
from typing import Dict, Union
|
|
5
|
-
|
|
6
|
-
from pydantic import BaseModel, ConfigDict, Field, field_validator
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
class NoiseModelType(str, Enum):
|
|
10
|
-
"""
|
|
11
|
-
Available noise models.
|
|
12
|
-
|
|
13
|
-
Currently supported noise models:
|
|
14
|
-
|
|
15
|
-
- hist: Histogram noise model.
|
|
16
|
-
- gmm: Gaussian mixture model noise model.F
|
|
17
|
-
"""
|
|
18
|
-
|
|
19
|
-
NONE = "none"
|
|
20
|
-
HIST = "hist"
|
|
21
|
-
GMM = "gmm"
|
|
22
|
-
|
|
23
|
-
# TODO add validator decorator
|
|
24
|
-
@classmethod
|
|
25
|
-
def validate_noise_model_type(
|
|
26
|
-
cls, noise_model: Union[str, NoiseModel], parameters: dict
|
|
27
|
-
) -> None:
|
|
28
|
-
"""_summary_.
|
|
29
|
-
|
|
30
|
-
Parameters
|
|
31
|
-
----------
|
|
32
|
-
noise_model : Union[str, NoiseModel]
|
|
33
|
-
_description_
|
|
34
|
-
parameters : dict
|
|
35
|
-
_description_
|
|
36
|
-
|
|
37
|
-
Returns
|
|
38
|
-
-------
|
|
39
|
-
BaseModel
|
|
40
|
-
_description_
|
|
41
|
-
"""
|
|
42
|
-
if noise_model == NoiseModelType.HIST.value:
|
|
43
|
-
HistogramNoiseModel(**parameters)
|
|
44
|
-
return HistogramNoiseModel().model_dump() if not parameters else parameters
|
|
45
|
-
|
|
46
|
-
elif noise_model == NoiseModelType.GMM.value:
|
|
47
|
-
GaussianMixtureNoiseModel(**parameters)
|
|
48
|
-
return (
|
|
49
|
-
GaussianMixtureNoiseModel().model_dump()
|
|
50
|
-
if not parameters
|
|
51
|
-
else parameters
|
|
52
|
-
)
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
class NoiseModel(BaseModel):
|
|
56
|
-
"""_summary_.
|
|
57
|
-
|
|
58
|
-
Parameters
|
|
59
|
-
----------
|
|
60
|
-
BaseModel : _type_
|
|
61
|
-
_description_
|
|
62
|
-
|
|
63
|
-
Returns
|
|
64
|
-
-------
|
|
65
|
-
_type_
|
|
66
|
-
_description_
|
|
67
|
-
|
|
68
|
-
Raises
|
|
69
|
-
------
|
|
70
|
-
ValueError
|
|
71
|
-
_description_
|
|
72
|
-
"""
|
|
73
|
-
|
|
74
|
-
model_config = ConfigDict(
|
|
75
|
-
use_enum_values=True,
|
|
76
|
-
protected_namespaces=(), # allows to use model_* as a field name
|
|
77
|
-
validate_assignment=True,
|
|
78
|
-
)
|
|
79
|
-
|
|
80
|
-
model_type: NoiseModelType
|
|
81
|
-
parameters: Dict = Field(default_factory=dict, validate_default=True)
|
|
82
|
-
|
|
83
|
-
@field_validator("parameters")
|
|
84
|
-
@classmethod
|
|
85
|
-
def validate_parameters(cls, data, values) -> Dict:
|
|
86
|
-
"""_summary_.
|
|
87
|
-
|
|
88
|
-
Parameters
|
|
89
|
-
----------
|
|
90
|
-
parameters : Dict
|
|
91
|
-
_description_
|
|
92
|
-
|
|
93
|
-
Returns
|
|
94
|
-
-------
|
|
95
|
-
Dict
|
|
96
|
-
_description_
|
|
97
|
-
"""
|
|
98
|
-
if values.data["model_type"] not in [NoiseModelType.GMM, NoiseModelType.HIST]:
|
|
99
|
-
raise ValueError(
|
|
100
|
-
f"Incorrect noise model {values.data['model_type']}."
|
|
101
|
-
f"Please refer to the documentation" # TODO add link to documentation
|
|
102
|
-
)
|
|
103
|
-
|
|
104
|
-
parameters = NoiseModelType.validate_noise_model_type(
|
|
105
|
-
values.data["model_type"], data
|
|
106
|
-
)
|
|
107
|
-
return parameters
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
class HistogramNoiseModel(BaseModel):
|
|
111
|
-
"""
|
|
112
|
-
Histogram noise model.
|
|
113
|
-
|
|
114
|
-
Attributes
|
|
115
|
-
----------
|
|
116
|
-
min_value : float
|
|
117
|
-
Minimum value in the input.
|
|
118
|
-
max_value : float
|
|
119
|
-
Maximum value in the input.
|
|
120
|
-
bins : int
|
|
121
|
-
Number of bins of the histogram.
|
|
122
|
-
"""
|
|
123
|
-
|
|
124
|
-
min_value: float = Field(default=350.0, ge=0.0, le=65535.0)
|
|
125
|
-
max_value: float = Field(default=6500.0, ge=0.0, le=65535.0)
|
|
126
|
-
bins: int = Field(default=256, ge=1)
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
class GaussianMixtureNoiseModel(BaseModel):
|
|
130
|
-
"""
|
|
131
|
-
Gaussian mixture model noise model.
|
|
132
|
-
|
|
133
|
-
Attributes
|
|
134
|
-
----------
|
|
135
|
-
min_signal : float
|
|
136
|
-
Minimum signal intensity expected in the image.
|
|
137
|
-
max_signal : float
|
|
138
|
-
Maximum signal intensity expected in the image.
|
|
139
|
-
weight : array
|
|
140
|
-
A [3*n_gaussian, n_coeff] sized array containing the values of the weights
|
|
141
|
-
describing the noise model.
|
|
142
|
-
Each gaussian contributes three parameters (mean, standard deviation and weight),
|
|
143
|
-
hence the number of rows in `weight` are 3*n_gaussian.
|
|
144
|
-
If `weight = None`, the weight array is initialized using the `min_signal` and
|
|
145
|
-
`max_signal` parameters.
|
|
146
|
-
n_gaussian: int
|
|
147
|
-
Number of gaussians.
|
|
148
|
-
n_coeff: int
|
|
149
|
-
Number of coefficients to describe the functional relationship between gaussian
|
|
150
|
-
parameters and the signal.
|
|
151
|
-
2 implies a linear relationship, 3 implies a quadratic relationship and so on.
|
|
152
|
-
device: device
|
|
153
|
-
GPU device.
|
|
154
|
-
min_sigma: int
|
|
155
|
-
"""
|
|
156
|
-
|
|
157
|
-
num_components: int = Field(default=3, ge=1)
|
|
158
|
-
min_value: float = Field(default=350.0, ge=0.0, le=65535.0)
|
|
159
|
-
max_value: float = Field(default=6500.0, ge=0.0, le=65535.0)
|
|
160
|
-
n_gaussian: int = Field(default=3, ge=1)
|
|
161
|
-
n_coeff: int = Field(default=2, ge=1)
|
|
162
|
-
min_sigma: int = Field(default=50, ge=1)
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
"""
|
|
2
|
-
Extraction strategy module.
|
|
3
|
-
|
|
4
|
-
This module defines the various extraction strategies available in CAREamics.
|
|
5
|
-
"""
|
|
6
|
-
from careamics.utils import BaseEnum
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
class SupportedExtractionStrategy(str, BaseEnum):
|
|
10
|
-
"""
|
|
11
|
-
Available extraction strategies.
|
|
12
|
-
|
|
13
|
-
Currently supported:
|
|
14
|
-
- random: random extraction.
|
|
15
|
-
# TODO
|
|
16
|
-
- sequential: grid extraction, can miss edge values.
|
|
17
|
-
- tiled: tiled extraction, covers the whole image.
|
|
18
|
-
"""
|
|
19
|
-
|
|
20
|
-
RANDOM = "random"
|
|
21
|
-
RANDOM_ZARR = "random_zarr"
|
|
22
|
-
SEQUENTIAL = "sequential"
|
|
23
|
-
TILED = "tiled"
|
|
24
|
-
NONE = "none"
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
"""Pydantic model for the NDFlip transform."""
|
|
2
|
-
from typing import Literal
|
|
3
|
-
|
|
4
|
-
from pydantic import ConfigDict, Field
|
|
5
|
-
|
|
6
|
-
from .transform_model import TransformModel
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
class NDFlipModel(TransformModel):
|
|
10
|
-
"""
|
|
11
|
-
Pydantic model used to represent NDFlip transformation.
|
|
12
|
-
|
|
13
|
-
Attributes
|
|
14
|
-
----------
|
|
15
|
-
name : Literal["NDFlip"]
|
|
16
|
-
Name of the transformation.
|
|
17
|
-
p : float
|
|
18
|
-
Probability of applying the transformation, by default 0.5.
|
|
19
|
-
is_3D : bool
|
|
20
|
-
Whether the transformation should be applied in 3D, by default False.
|
|
21
|
-
flip_z : bool
|
|
22
|
-
Whether to flip the z axis, by default True.
|
|
23
|
-
"""
|
|
24
|
-
|
|
25
|
-
model_config = ConfigDict(
|
|
26
|
-
validate_assignment=True,
|
|
27
|
-
)
|
|
28
|
-
|
|
29
|
-
name: Literal["NDFlip"] = "NDFlip"
|
|
30
|
-
p: float = Field(default=0.5, ge=0.0, le=1.0)
|
|
31
|
-
is_3D: bool = Field(default=False)
|
|
32
|
-
flip_z: bool = Field(default=True)
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
from typing import List, Union
|
|
2
|
-
|
|
3
|
-
import albumentations as Aug
|
|
4
|
-
|
|
5
|
-
from careamics.config.data_model import TRANSFORMS_UNION
|
|
6
|
-
from careamics.transforms import get_all_transforms
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
# TODO add some explanations on how the additional_targets is used
|
|
10
|
-
def get_patch_transform(
|
|
11
|
-
patch_transforms: Union[List[TRANSFORMS_UNION], Aug.Compose],
|
|
12
|
-
with_target: bool,
|
|
13
|
-
normalize_mask: bool = True,
|
|
14
|
-
) -> Aug.Compose:
|
|
15
|
-
"""Return a pixel manipulation function."""
|
|
16
|
-
# if we passed a Compose, we just return it
|
|
17
|
-
if isinstance(patch_transforms, Aug.Compose):
|
|
18
|
-
return patch_transforms
|
|
19
|
-
|
|
20
|
-
# empty list of transforms is a NoOp
|
|
21
|
-
elif len(patch_transforms) == 0:
|
|
22
|
-
return Aug.Compose(
|
|
23
|
-
[Aug.NoOp()],
|
|
24
|
-
additional_targets={}, # TODO this part need be checked (wrt segmentation)
|
|
25
|
-
)
|
|
26
|
-
|
|
27
|
-
# else we have a list of transforms
|
|
28
|
-
else:
|
|
29
|
-
# retrieve all transforms
|
|
30
|
-
all_transforms = get_all_transforms()
|
|
31
|
-
|
|
32
|
-
# instantiate all transforms
|
|
33
|
-
transforms = [
|
|
34
|
-
all_transforms[transform.name](**transform.model_dump())
|
|
35
|
-
for transform in patch_transforms
|
|
36
|
-
]
|
|
37
|
-
|
|
38
|
-
return Aug.Compose(
|
|
39
|
-
transforms,
|
|
40
|
-
# apply image aug to "target"
|
|
41
|
-
additional_targets={"target": "image"}
|
|
42
|
-
if (with_target and normalize_mask) # TODO check this
|
|
43
|
-
else {},
|
|
44
|
-
)
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
from typing import Type, Union
|
|
2
|
-
|
|
3
|
-
from ..config.noise_models import NoiseModel, NoiseModelType
|
|
4
|
-
from .noise_models import GaussianMixtureNoiseModel, HistogramNoiseModel
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
def noise_model_factory(
|
|
8
|
-
noise_config: NoiseModel,
|
|
9
|
-
) -> Type[Union[HistogramNoiseModel, GaussianMixtureNoiseModel, None]]:
|
|
10
|
-
"""Create loss model based on Configuration.
|
|
11
|
-
|
|
12
|
-
Parameters
|
|
13
|
-
----------
|
|
14
|
-
config : Configuration
|
|
15
|
-
Configuration.
|
|
16
|
-
|
|
17
|
-
Returns
|
|
18
|
-
-------
|
|
19
|
-
Noise model
|
|
20
|
-
|
|
21
|
-
Raises
|
|
22
|
-
------
|
|
23
|
-
NotImplementedError
|
|
24
|
-
If the noise model is unknown.
|
|
25
|
-
"""
|
|
26
|
-
noise_model_type = noise_config.model_type if noise_config else None
|
|
27
|
-
|
|
28
|
-
if noise_model_type == NoiseModelType.HIST:
|
|
29
|
-
return HistogramNoiseModel
|
|
30
|
-
|
|
31
|
-
elif noise_model_type == NoiseModelType.GMM:
|
|
32
|
-
return GaussianMixtureNoiseModel
|
|
33
|
-
|
|
34
|
-
elif noise_model_type is None:
|
|
35
|
-
return None
|
|
36
|
-
|
|
37
|
-
else:
|
|
38
|
-
raise NotImplementedError(
|
|
39
|
-
f"Noise model {noise_model_type} is not yet supported."
|
|
40
|
-
)
|