vlab4mic 0.0.12__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 (103) hide show
  1. vlab4mic-0.0.12/LICENSE.txt +21 -0
  2. vlab4mic-0.0.12/PKG-INFO +211 -0
  3. vlab4mic-0.0.12/README.md +168 -0
  4. vlab4mic-0.0.12/pyproject.toml +75 -0
  5. vlab4mic-0.0.12/setup.cfg +4 -0
  6. vlab4mic-0.0.12/src/vlab4mic/__init__.py +1 -0
  7. vlab4mic-0.0.12/src/vlab4mic/analysis/__init__.py +0 -0
  8. vlab4mic-0.0.12/src/vlab4mic/analysis/_plots.py +108 -0
  9. vlab4mic-0.0.12/src/vlab4mic/analysis/metrics.py +350 -0
  10. vlab4mic-0.0.12/src/vlab4mic/analysis/sweep.py +1075 -0
  11. vlab4mic-0.0.12/src/vlab4mic/configs/__init__.py +0 -0
  12. vlab4mic-0.0.12/src/vlab4mic/configs/acquisition/__init__.py +0 -0
  13. vlab4mic-0.0.12/src/vlab4mic/configs/acquisition/_template_.yaml +6 -0
  14. vlab4mic-0.0.12/src/vlab4mic/configs/fluorophores/AF488.yaml +10 -0
  15. vlab4mic-0.0.12/src/vlab4mic/configs/fluorophores/AF647.yaml +10 -0
  16. vlab4mic-0.0.12/src/vlab4mic/configs/fluorophores/__init__.py +0 -0
  17. vlab4mic-0.0.12/src/vlab4mic/configs/fluorophores/_template_.yaml +10 -0
  18. vlab4mic-0.0.12/src/vlab4mic/configs/modalities/AiryScan.yaml +29 -0
  19. vlab4mic-0.0.12/src/vlab4mic/configs/modalities/AiryScan_Thev2016.yaml +29 -0
  20. vlab4mic-0.0.12/src/vlab4mic/configs/modalities/Confocal.yaml +29 -0
  21. vlab4mic-0.0.12/src/vlab4mic/configs/modalities/Confocal_Thev2016.yaml +29 -0
  22. vlab4mic-0.0.12/src/vlab4mic/configs/modalities/Reference.yaml +29 -0
  23. vlab4mic-0.0.12/src/vlab4mic/configs/modalities/SMLM.yaml +29 -0
  24. vlab4mic-0.0.12/src/vlab4mic/configs/modalities/STED.yaml +29 -0
  25. vlab4mic-0.0.12/src/vlab4mic/configs/modalities/STED_Thev2016.yaml +29 -0
  26. vlab4mic-0.0.12/src/vlab4mic/configs/modalities/STORM_Thev2016.yaml +29 -0
  27. vlab4mic-0.0.12/src/vlab4mic/configs/modalities/Widefield.yaml +29 -0
  28. vlab4mic-0.0.12/src/vlab4mic/configs/modalities/Widefield_Thev2016.yaml +29 -0
  29. vlab4mic-0.0.12/src/vlab4mic/configs/modalities/__init__.py +0 -0
  30. vlab4mic-0.0.12/src/vlab4mic/configs/modalities/_template_.yaml +15 -0
  31. vlab4mic-0.0.12/src/vlab4mic/configs/parameter_settings.yaml +40 -0
  32. vlab4mic-0.0.12/src/vlab4mic/configs/probes/Antibody.yaml +34 -0
  33. vlab4mic-0.0.12/src/vlab4mic/configs/probes/CCP_heavy_chain_Cterminal.yaml +26 -0
  34. vlab4mic-0.0.12/src/vlab4mic/configs/probes/GFP.yaml +34 -0
  35. vlab4mic-0.0.12/src/vlab4mic/configs/probes/GFP_w_nanobody.yaml +36 -0
  36. vlab4mic-0.0.12/src/vlab4mic/configs/probes/HIV_capsid_p24_direct.yaml +26 -0
  37. vlab4mic-0.0.12/src/vlab4mic/configs/probes/Linker.yaml +26 -0
  38. vlab4mic-0.0.12/src/vlab4mic/configs/probes/NHS_ester.yaml +30 -0
  39. vlab4mic-0.0.12/src/vlab4mic/configs/probes/NPC_Nup96_Cterminal_direct.yaml +26 -0
  40. vlab4mic-0.0.12/src/vlab4mic/configs/probes/Nanobody.yaml +34 -0
  41. vlab4mic-0.0.12/src/vlab4mic/configs/probes/SNAP-tag.yaml +34 -0
  42. vlab4mic-0.0.12/src/vlab4mic/configs/probes/__init__.py +0 -0
  43. vlab4mic-0.0.12/src/vlab4mic/configs/probes/_template_.yaml +30 -0
  44. vlab4mic-0.0.12/src/vlab4mic/configs/probes/anti-p24_primary_antibody_HIV.yaml +30 -0
  45. vlab4mic-0.0.12/src/vlab4mic/configs/probes/mMaple.yaml +34 -0
  46. vlab4mic-0.0.12/src/vlab4mic/configs/structures/1HZH.yaml +8 -0
  47. vlab4mic-0.0.12/src/vlab4mic/configs/structures/1XI5.yaml +9 -0
  48. vlab4mic-0.0.12/src/vlab4mic/configs/structures/2RCJ.yaml +8 -0
  49. vlab4mic-0.0.12/src/vlab4mic/configs/structures/3J3Y.yaml +9 -0
  50. vlab4mic-0.0.12/src/vlab4mic/configs/structures/7R5K.yaml +9 -0
  51. vlab4mic-0.0.12/src/vlab4mic/configs/structures/8GMO.yaml +9 -0
  52. vlab4mic-0.0.12/src/vlab4mic/configs/structures/__init__.py +0 -0
  53. vlab4mic-0.0.12/src/vlab4mic/configs/structures/_template_.yaml +8 -0
  54. vlab4mic-0.0.12/src/vlab4mic/configs/virtualsample/__init__.py +0 -0
  55. vlab4mic-0.0.12/src/vlab4mic/configs/virtualsample/_template_.yaml +15 -0
  56. vlab4mic-0.0.12/src/vlab4mic/configs/virtualsample/square1x1um_randomised.yaml +15 -0
  57. vlab4mic-0.0.12/src/vlab4mic/download.py +118 -0
  58. vlab4mic-0.0.12/src/vlab4mic/experiments.py +1784 -0
  59. vlab4mic-0.0.12/src/vlab4mic/generate/__init__.py +0 -0
  60. vlab4mic-0.0.12/src/vlab4mic/generate/coordinates_field.py +1015 -0
  61. vlab4mic-0.0.12/src/vlab4mic/generate/imaging.py +1259 -0
  62. vlab4mic-0.0.12/src/vlab4mic/generate/labelled_instance.py +1384 -0
  63. vlab4mic-0.0.12/src/vlab4mic/generate/labels.py +339 -0
  64. vlab4mic-0.0.12/src/vlab4mic/generate/molecular_structure.py +1050 -0
  65. vlab4mic-0.0.12/src/vlab4mic/generate/psfs.py +25 -0
  66. vlab4mic-0.0.12/src/vlab4mic/sweep_generator.py +1431 -0
  67. vlab4mic-0.0.12/src/vlab4mic/utils/__init__.py +0 -0
  68. vlab4mic-0.0.12/src/vlab4mic/utils/data_format/__init__.py +1 -0
  69. vlab4mic-0.0.12/src/vlab4mic/utils/data_format/configuration_format.py +158 -0
  70. vlab4mic-0.0.12/src/vlab4mic/utils/data_format/structural_format.py +60 -0
  71. vlab4mic-0.0.12/src/vlab4mic/utils/data_format/visualisation.py +43 -0
  72. vlab4mic-0.0.12/src/vlab4mic/utils/io/__init__.py +0 -0
  73. vlab4mic-0.0.12/src/vlab4mic/utils/io/text.py +14 -0
  74. vlab4mic-0.0.12/src/vlab4mic/utils/io/tiff.py +16 -0
  75. vlab4mic-0.0.12/src/vlab4mic/utils/io/yaml_functions.py +24 -0
  76. vlab4mic-0.0.12/src/vlab4mic/utils/sample/__init__.py +0 -0
  77. vlab4mic-0.0.12/src/vlab4mic/utils/sample/arrays.py +91 -0
  78. vlab4mic-0.0.12/src/vlab4mic/utils/transform/__init__.py +0 -0
  79. vlab4mic-0.0.12/src/vlab4mic/utils/transform/cif_builder.py +187 -0
  80. vlab4mic-0.0.12/src/vlab4mic/utils/transform/datatype.py +48 -0
  81. vlab4mic-0.0.12/src/vlab4mic/utils/transform/defects.py +211 -0
  82. vlab4mic-0.0.12/src/vlab4mic/utils/transform/image_convolution.py +469 -0
  83. vlab4mic-0.0.12/src/vlab4mic/utils/transform/noise.py +70 -0
  84. vlab4mic-0.0.12/src/vlab4mic/utils/transform/normals.py +96 -0
  85. vlab4mic-0.0.12/src/vlab4mic/utils/transform/points_transforms.py +171 -0
  86. vlab4mic-0.0.12/src/vlab4mic/utils/visualisation/__init__.py +0 -0
  87. vlab4mic-0.0.12/src/vlab4mic/utils/visualisation/matplotlib_plots.py +114 -0
  88. vlab4mic-0.0.12/src/vlab4mic/workflows.py +448 -0
  89. vlab4mic-0.0.12/src/vlab4mic.egg-info/PKG-INFO +211 -0
  90. vlab4mic-0.0.12/src/vlab4mic.egg-info/SOURCES.txt +101 -0
  91. vlab4mic-0.0.12/src/vlab4mic.egg-info/dependency_links.txt +1 -0
  92. vlab4mic-0.0.12/src/vlab4mic.egg-info/entry_points.txt +2 -0
  93. vlab4mic-0.0.12/src/vlab4mic.egg-info/requires.txt +32 -0
  94. vlab4mic-0.0.12/src/vlab4mic.egg-info/top_level.txt +2 -0
  95. vlab4mic-0.0.12/tests/test_coordinate_field.py +46 -0
  96. vlab4mic-0.0.12/tests/test_experiment.py +98 -0
  97. vlab4mic-0.0.12/tests/test_feature_defects.py +20 -0
  98. vlab4mic-0.0.12/tests/test_image_generation.py +51 -0
  99. vlab4mic-0.0.12/tests/test_labelledparticles.py +57 -0
  100. vlab4mic-0.0.12/tests/test_labels.py +29 -0
  101. vlab4mic-0.0.12/tests/test_load_pdbcif.py +25 -0
  102. vlab4mic-0.0.12/tests/test_sequential_labelling.py +52 -0
  103. vlab4mic-0.0.12/tests/test_sweeps.py +78 -0
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2024 [Ricardo Henriques <ricardo@henriqueslab.org>]
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,211 @@
1
+ Metadata-Version: 2.4
2
+ Name: vlab4mic
3
+ Version: 0.0.12
4
+ Summary: VLab4Mic: A virtual laboratory for microscopy simulation and validation
5
+ Author-email: Damián Martinez <jdmartinezigc@gmail.com>, Bruno Saraiva <bruno.msaraiva2@gmail.com>, Mario del Rosario <mario.delrosario@itqb.unl.pt>, Ricardo Henriques <ricardo@henriqueslab.org>
6
+ License: MIT
7
+ Classifier: Programming Language :: Python :: 3.11
8
+ Classifier: License :: OSI Approved :: MIT License
9
+ Classifier: Operating System :: OS Independent
10
+ Requires-Python: >=3.9
11
+ Description-Content-Type: text/markdown
12
+ License-File: LICENSE.txt
13
+ Requires-Dist: numpy>=1.26.4
14
+ Requires-Dist: matplotlib>=3.9.0
15
+ Requires-Dist: scipy>=1.13.1
16
+ Requires-Dist: biopython>=1.83
17
+ Requires-Dist: plotly>=5.22.0
18
+ Requires-Dist: trimesh>=4.4.0
19
+ Requires-Dist: pyyaml>=6.0.1
20
+ Requires-Dist: tifffile>=2024.5.22
21
+ Requires-Dist: tqdm>=4.66.4
22
+ Requires-Dist: scikit-image>=0.23.2
23
+ Requires-Dist: requests>=2.32.3
24
+ Requires-Dist: scikit-learn>=1.5.0
25
+ Requires-Dist: pandas>=2.2.3
26
+ Requires-Dist: seaborn>=0.13.2
27
+ Requires-Dist: opencv-python>=4.11
28
+ Provides-Extra: all
29
+ Requires-Dist: vlab4mic[dev,test]; extra == "all"
30
+ Provides-Extra: dev
31
+ Requires-Dist: pre-commit>=3.7.0; extra == "dev"
32
+ Requires-Dist: ruff>=0.4.3; extra == "dev"
33
+ Requires-Dist: gptrepo>=1.0.3; extra == "dev"
34
+ Requires-Dist: pdoc>=12.3.1; extra == "dev"
35
+ Requires-Dist: build; extra == "dev"
36
+ Provides-Extra: test
37
+ Requires-Dist: pytest>=8.2.0; extra == "test"
38
+ Requires-Dist: pytest-xdist>=3.6.1; extra == "test"
39
+ Requires-Dist: pytest-cov>=5.0.0; extra == "test"
40
+ Requires-Dist: nbmake>=1.5.3; extra == "test"
41
+ Requires-Dist: mypy>=1.10.0; extra == "test"
42
+ Dynamic: license-file
43
+
44
+ # VLab4Mic: A Virtual Laboratory for Microscopy
45
+ *A friendly toolkit to help researchers simulate fluorescence microscopy images, no coding required.*
46
+
47
+ <img src="src/logo/logo.png" align="right" width="180" style="margin-left: 20px;"/>
48
+
49
+ VLab4Mic lets you explore, test, and validate imaging experiments **before stepping into the microscope room**.
50
+ Whether you are new to Python or an experienced bioimage researcher, VLab4Mic provides a safe sandbox to:
51
+
52
+ - Build **virtual samples** from PDB/CIF structures
53
+ - Apply **direct or indirect fluorescent labeling**
54
+ - Introduce **defects**, crowding, and structural variation
55
+ - Simulate image acquisition across modalities
56
+ - Run **parameter sweeps** to explore experimental conditions
57
+ - Compare **noiseless vs. realistic** acquisitions
58
+
59
+ This README is written to be friendly for beginners while maintaining the technical depth experienced users expect.
60
+
61
+ <img src="examples/Tutorial1.gif"/>
62
+
63
+
64
+ # Who Is This Tool For?
65
+
66
+ - **New microscopy users:** to gain intuitive understanding without coding
67
+ - **Researchers designing experiments:** testing probes, PSFs, exposure times
68
+ - **Microscopy experts:** benchmarking reconstruction methods or PSFs
69
+
70
+ ---
71
+
72
+ # 🚀 Quick Start Options
73
+
74
+ | Option | Skills Needed | Best For |
75
+ |-------|----------------|----------|
76
+ | **1. Google Colab** | None | Beginners, teaching, quick experiments |
77
+ | **2. Local Jupyter Notebooks** | Basic installation | Smooth widget-based use |
78
+ | **3. Python Scripts** | Comfortable with code | Full flexibility & automation |
79
+
80
+ ---
81
+
82
+ # 🟢 Option 1 — Google Colab (No Installation Needed)
83
+
84
+ The easiest way to start.
85
+
86
+ ✔ No installation
87
+ ✔ No configuration
88
+ ✔ Works in browser
89
+ ✔ Always up to date
90
+
91
+ ### 👉 Click to open the main notebook:
92
+ | Category | Description | Notebook | Colab |
93
+ |---------|-------------|----------|-------|
94
+ | **Main Interface** | Create virtual samples & simulate imaging | [Notebook](https://github.com/HenriquesLab/VLab4Mic/blob/main/notebooks/VLab4Mic_main.ipynb) | [Open in Colab](https://githubtocolab.com/HenriquesLab/VLab4Mic/blob/main/notebooks/VLab4Mic_main.ipynb) |
95
+ | **Parameter Sweeps** | Configure & run simulation sweeps | [Notebook](https://github.com/HenriquesLab/VLab4Mic/blob/main/notebooks/VLab4Mic_parameter_sweeps.ipynb) | [Open in Colab](https://githubtocolab.com/HenriquesLab/VLab4Mic/blob/main/notebooks/VLab4Mic_parameter_sweeps.ipynb) |
96
+
97
+ ### If the Colab link fails:
98
+ 1. Click the **Jupyter** badge (opens the raw notebook)
99
+ 2. Download the `.ipynb` file
100
+ 3. Open Google Colab → **File → Upload notebook**
101
+
102
+ ---
103
+
104
+ # 🔵 Option 2 — Local Installation (Beginner-Friendly)
105
+
106
+ ### 1️⃣ Create a virtual environment
107
+ You may use Conda or similar.
108
+
109
+ #### Using Conda:
110
+ Run the following command (replace `MYENV` with your desired environment name):
111
+
112
+ ```bash
113
+ conda create --name MYENV python=3.11
114
+ ```
115
+
116
+ Then activate it:
117
+ ```bash
118
+ conda activate MYENV
119
+ ```
120
+
121
+ ---
122
+
123
+ ### 2️⃣ Install VLab4Mic and its associated library to use the codeless jupyter notebooks
124
+ ```bash
125
+ pip install --index-url https://test.pypi.org/simple/ --extra-index-url https://pypi.org/simple vlab4mic vlab4micjupyter
126
+ ```
127
+
128
+ ---
129
+
130
+ ### 3️⃣ Launch Jupyter Lab
131
+ ```bash
132
+ jupyter lab
133
+ ```
134
+
135
+ ---
136
+
137
+ ### 4️⃣ Download and open notebooks
138
+ From:
139
+ https://github.com/HenriquesLab/VLab4Mic/tree/main/notebooks
140
+
141
+ ---
142
+
143
+ # 🔴 Option 3 — Use VLab4Mic as a Python Library (Advanced)
144
+
145
+ Example script:
146
+
147
+ ```python
148
+ from vlab4mic.experiments import image_vsample
149
+ import matplotlib.pyplot as plt
150
+
151
+ modalities = ["Widefield", "Confocal", "STED"]
152
+
153
+ images, noiseless, experiment = image_vsample(
154
+ structure="7R5K",
155
+ probe_template="Antibody",
156
+ probe_target_type="Sequence",
157
+ probe_target_value="ELAVGSL",
158
+ multimodal=modalities,
159
+ number_of_particles=10,
160
+ run_simulation=True,
161
+ )
162
+
163
+ fig, axs = plt.subplots(1, len(modalities))
164
+ for i, mod in enumerate(modalities):
165
+ axs[i].imshow(images[mod][0], cmap="magma")
166
+ axs[i].set_title(mod)
167
+ plt.show()
168
+ ```
169
+
170
+ For more examples see `/examples`.
171
+
172
+ ---
173
+
174
+ # Documentation & Manual
175
+
176
+ - Full Manual: https://github.com/HenriquesLab/VLab4Mic/blob/main/manual.md
177
+ - Wiki Tutorials: https://github.com/HenriquesLab/VLab4Mic/wiki
178
+
179
+ ---
180
+
181
+ # Core Features
182
+
183
+ ### ✔ Structural modelling
184
+ ### ✔ Virtual sample creation
185
+ ### ✔ Imaging simulations
186
+ ### ✔ Parameter sweeps
187
+ ### ✔ Widget-based GUI
188
+ ### ✔ Flexible Python API
189
+
190
+ ---
191
+
192
+ # Troubleshooting
193
+
194
+ **Jupyter won't open →** Environment not activated.
195
+ **ImportError →** Install VLab4Mic inside the active environment.
196
+ **Colab won't load →** Upload notebook manually.
197
+
198
+ If issues persist, open an issue!
199
+
200
+ ---
201
+
202
+ # Contributing
203
+ Contributions welcome!
204
+ See: https://github.com/HenriquesLab/VLab4Mic/blob/main/CONTRIBUTING.md
205
+
206
+ # Support
207
+ - Discussions: https://github.com/HenriquesLab/VLab4Mic/discussions
208
+ - Issues: https://github.com/HenriquesLab/VLab4Mic/issues
209
+
210
+
211
+
@@ -0,0 +1,168 @@
1
+ # VLab4Mic: A Virtual Laboratory for Microscopy
2
+ *A friendly toolkit to help researchers simulate fluorescence microscopy images, no coding required.*
3
+
4
+ <img src="src/logo/logo.png" align="right" width="180" style="margin-left: 20px;"/>
5
+
6
+ VLab4Mic lets you explore, test, and validate imaging experiments **before stepping into the microscope room**.
7
+ Whether you are new to Python or an experienced bioimage researcher, VLab4Mic provides a safe sandbox to:
8
+
9
+ - Build **virtual samples** from PDB/CIF structures
10
+ - Apply **direct or indirect fluorescent labeling**
11
+ - Introduce **defects**, crowding, and structural variation
12
+ - Simulate image acquisition across modalities
13
+ - Run **parameter sweeps** to explore experimental conditions
14
+ - Compare **noiseless vs. realistic** acquisitions
15
+
16
+ This README is written to be friendly for beginners while maintaining the technical depth experienced users expect.
17
+
18
+ <img src="examples/Tutorial1.gif"/>
19
+
20
+
21
+ # Who Is This Tool For?
22
+
23
+ - **New microscopy users:** to gain intuitive understanding without coding
24
+ - **Researchers designing experiments:** testing probes, PSFs, exposure times
25
+ - **Microscopy experts:** benchmarking reconstruction methods or PSFs
26
+
27
+ ---
28
+
29
+ # 🚀 Quick Start Options
30
+
31
+ | Option | Skills Needed | Best For |
32
+ |-------|----------------|----------|
33
+ | **1. Google Colab** | None | Beginners, teaching, quick experiments |
34
+ | **2. Local Jupyter Notebooks** | Basic installation | Smooth widget-based use |
35
+ | **3. Python Scripts** | Comfortable with code | Full flexibility & automation |
36
+
37
+ ---
38
+
39
+ # 🟢 Option 1 — Google Colab (No Installation Needed)
40
+
41
+ The easiest way to start.
42
+
43
+ ✔ No installation
44
+ ✔ No configuration
45
+ ✔ Works in browser
46
+ ✔ Always up to date
47
+
48
+ ### 👉 Click to open the main notebook:
49
+ | Category | Description | Notebook | Colab |
50
+ |---------|-------------|----------|-------|
51
+ | **Main Interface** | Create virtual samples & simulate imaging | [Notebook](https://github.com/HenriquesLab/VLab4Mic/blob/main/notebooks/VLab4Mic_main.ipynb) | [Open in Colab](https://githubtocolab.com/HenriquesLab/VLab4Mic/blob/main/notebooks/VLab4Mic_main.ipynb) |
52
+ | **Parameter Sweeps** | Configure & run simulation sweeps | [Notebook](https://github.com/HenriquesLab/VLab4Mic/blob/main/notebooks/VLab4Mic_parameter_sweeps.ipynb) | [Open in Colab](https://githubtocolab.com/HenriquesLab/VLab4Mic/blob/main/notebooks/VLab4Mic_parameter_sweeps.ipynb) |
53
+
54
+ ### If the Colab link fails:
55
+ 1. Click the **Jupyter** badge (opens the raw notebook)
56
+ 2. Download the `.ipynb` file
57
+ 3. Open Google Colab → **File → Upload notebook**
58
+
59
+ ---
60
+
61
+ # 🔵 Option 2 — Local Installation (Beginner-Friendly)
62
+
63
+ ### 1️⃣ Create a virtual environment
64
+ You may use Conda or similar.
65
+
66
+ #### Using Conda:
67
+ Run the following command (replace `MYENV` with your desired environment name):
68
+
69
+ ```bash
70
+ conda create --name MYENV python=3.11
71
+ ```
72
+
73
+ Then activate it:
74
+ ```bash
75
+ conda activate MYENV
76
+ ```
77
+
78
+ ---
79
+
80
+ ### 2️⃣ Install VLab4Mic and its associated library to use the codeless jupyter notebooks
81
+ ```bash
82
+ pip install --index-url https://test.pypi.org/simple/ --extra-index-url https://pypi.org/simple vlab4mic vlab4micjupyter
83
+ ```
84
+
85
+ ---
86
+
87
+ ### 3️⃣ Launch Jupyter Lab
88
+ ```bash
89
+ jupyter lab
90
+ ```
91
+
92
+ ---
93
+
94
+ ### 4️⃣ Download and open notebooks
95
+ From:
96
+ https://github.com/HenriquesLab/VLab4Mic/tree/main/notebooks
97
+
98
+ ---
99
+
100
+ # 🔴 Option 3 — Use VLab4Mic as a Python Library (Advanced)
101
+
102
+ Example script:
103
+
104
+ ```python
105
+ from vlab4mic.experiments import image_vsample
106
+ import matplotlib.pyplot as plt
107
+
108
+ modalities = ["Widefield", "Confocal", "STED"]
109
+
110
+ images, noiseless, experiment = image_vsample(
111
+ structure="7R5K",
112
+ probe_template="Antibody",
113
+ probe_target_type="Sequence",
114
+ probe_target_value="ELAVGSL",
115
+ multimodal=modalities,
116
+ number_of_particles=10,
117
+ run_simulation=True,
118
+ )
119
+
120
+ fig, axs = plt.subplots(1, len(modalities))
121
+ for i, mod in enumerate(modalities):
122
+ axs[i].imshow(images[mod][0], cmap="magma")
123
+ axs[i].set_title(mod)
124
+ plt.show()
125
+ ```
126
+
127
+ For more examples see `/examples`.
128
+
129
+ ---
130
+
131
+ # Documentation & Manual
132
+
133
+ - Full Manual: https://github.com/HenriquesLab/VLab4Mic/blob/main/manual.md
134
+ - Wiki Tutorials: https://github.com/HenriquesLab/VLab4Mic/wiki
135
+
136
+ ---
137
+
138
+ # Core Features
139
+
140
+ ### ✔ Structural modelling
141
+ ### ✔ Virtual sample creation
142
+ ### ✔ Imaging simulations
143
+ ### ✔ Parameter sweeps
144
+ ### ✔ Widget-based GUI
145
+ ### ✔ Flexible Python API
146
+
147
+ ---
148
+
149
+ # Troubleshooting
150
+
151
+ **Jupyter won't open →** Environment not activated.
152
+ **ImportError →** Install VLab4Mic inside the active environment.
153
+ **Colab won't load →** Upload notebook manually.
154
+
155
+ If issues persist, open an issue!
156
+
157
+ ---
158
+
159
+ # Contributing
160
+ Contributions welcome!
161
+ See: https://github.com/HenriquesLab/VLab4Mic/blob/main/CONTRIBUTING.md
162
+
163
+ # Support
164
+ - Discussions: https://github.com/HenriquesLab/VLab4Mic/discussions
165
+ - Issues: https://github.com/HenriquesLab/VLab4Mic/issues
166
+
167
+
168
+
@@ -0,0 +1,75 @@
1
+ [build-system]
2
+ requires = ["setuptools>=42", "wheel"]
3
+ build-backend = "setuptools.build_meta"
4
+
5
+ [project]
6
+ name = "vlab4mic"
7
+ version = "0.0.12"
8
+ description = "VLab4Mic: A virtual laboratory for microscopy simulation and validation"
9
+ authors = [
10
+ { name = "Damián Martinez", email = "jdmartinezigc@gmail.com" },
11
+ { name = "Bruno Saraiva", email = "bruno.msaraiva2@gmail.com" },
12
+ { name = "Mario del Rosario", email = "mario.delrosario@itqb.unl.pt" },
13
+ { name = "Ricardo Henriques", email = "ricardo@henriqueslab.org" }
14
+ ]
15
+ readme = { file = "README.md", content-type = "text/markdown" }
16
+ license = { text = "MIT" }
17
+ requires-python = ">=3.9"
18
+ classifiers = [
19
+ "Programming Language :: Python :: 3.11",
20
+ "License :: OSI Approved :: MIT License",
21
+ "Operating System :: OS Independent"
22
+ ]
23
+ dependencies = [
24
+ "numpy>=1.26.4",
25
+ "matplotlib>=3.9.0",
26
+ "scipy>=1.13.1",
27
+ "biopython>=1.83",
28
+ "plotly>=5.22.0",
29
+ "trimesh>=4.4.0",
30
+ "pyyaml>=6.0.1",
31
+ "tifffile>=2024.5.22",
32
+ "tqdm>=4.66.4",
33
+ "scikit-image>=0.23.2",
34
+ "requests>=2.32.3",
35
+ "scikit-learn>=1.5.0",
36
+ "pandas>=2.2.3",
37
+ "seaborn>=0.13.2",
38
+ "opencv-python>=4.11"
39
+ ]
40
+
41
+ [project.optional-dependencies]
42
+ all = ["vlab4mic[dev,test]"]
43
+ dev = [
44
+ "pre-commit>=3.7.0",
45
+ "ruff>=0.4.3",
46
+ "gptrepo>=1.0.3",
47
+ "pdoc>=12.3.1",
48
+ "build"
49
+ ]
50
+ test = [
51
+ "pytest>=8.2.0",
52
+ "pytest-xdist>=3.6.1",
53
+ "pytest-cov>=5.0.0",
54
+ "nbmake>=1.5.3",
55
+ "mypy>=1.10.0"
56
+ ]
57
+
58
+ [tool.setuptools]
59
+ package-dir = { "" = "src" }
60
+
61
+ [tool.setuptools.packages.find]
62
+ where = ["src"]
63
+
64
+ [tool.setuptools.package-data]
65
+ "*" = ["*.yaml"]
66
+
67
+ [tool.coverage.run]
68
+ source = ["src/vlab4mic"]
69
+ omit = [
70
+ "*__init__.py",
71
+ "*__*.py"
72
+ ]
73
+
74
+ [project.scripts]
75
+ download-structures = "vlab4mic.download:download_suggested_structures"
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+
@@ -0,0 +1 @@
1
+ from .utils.io.yaml_functions import load_yaml
File without changes
@@ -0,0 +1,108 @@
1
+ import matplotlib.pyplot as plt
2
+ import seaborn as sns
3
+ from ..utils.transform.datatype import truncate
4
+ from matplotlib.ticker import FormatStrFormatter
5
+
6
+
7
+ def sns_heatmap_pivots(
8
+ df_pivots,
9
+ titles=None,
10
+ conditions_cmaps=None,
11
+ annotations=False,
12
+ cmaps_range="same",
13
+ figsize=[12, 10],
14
+ return_figure=False,
15
+ metric_name=None,
16
+ decimals="%.4f",
17
+ fillna = True,
18
+ **kwargs,
19
+ ):
20
+ conditions = list(df_pivots.keys())
21
+ nconditions = len(conditions)
22
+ if "annot_kws" not in kwargs.keys():
23
+ annot_kws = {"size": 10, "rotation": 45}
24
+ else:
25
+ annot_kws = kwargs["annot_kws"]
26
+ f, axes = plt.subplots(nconditions, 2, figsize=figsize)
27
+ plot_num = 0
28
+ if cmaps_range == "same":
29
+ # min and max here correspond to SSIM
30
+ hist_params = dict(vmin=0, vmax=1)
31
+ elif cmaps_range == "each":
32
+ hist_params = dict()
33
+ if conditions_cmaps is None:
34
+ conditions_cmaps = ["mako"] * nconditions
35
+ if metric_name is not None:
36
+ metric_n = metric_name
37
+ else:
38
+ metric_n = "Metric"
39
+ for n, cond in enumerate(conditions):
40
+ if fillna:
41
+ mask = df_pivots[cond][0].isna()
42
+ df_pivots[cond][0][mask] = 0.0
43
+ mask2 = df_pivots[cond][1].isna()
44
+ df_pivots[cond][1][mask2] = 0.0
45
+ #print("Na as 0")
46
+ #print(df_pivots[cond][0])
47
+ # mean
48
+ sns.heatmap(
49
+ df_pivots[cond][0],
50
+ annot=annotations,
51
+ annot_kws=annot_kws,
52
+ ax=axes[n, 0],
53
+ cmap=conditions_cmaps[n],
54
+ # xticklabels=df_pivots[cond][0].columns.values.round(3),
55
+ # yticklabels=df_pivots[cond][0].index.values.round(3),
56
+ **hist_params,
57
+ **kwargs
58
+ )
59
+ axes[n, 0].set_title(titles["category"] + ": " + cond + ". Mean " + metric_n)
60
+ #axes[n, 0].yaxis.set_major_formatter(FormatStrFormatter(decimals))
61
+ #axes[n, 0].xaxis.set_major_formatter(FormatStrFormatter(decimals))
62
+ # std
63
+ sns.heatmap(
64
+ df_pivots[cond][1],
65
+ annot=annotations,
66
+ annot_kws=annot_kws,
67
+ ax=axes[n, 1],
68
+ cmap=conditions_cmaps[n],
69
+ # xticklabels=df_pivots[cond][1].columns.values.round(3),
70
+ # yticklabels=df_pivots[cond][1].index.values.round(3),
71
+ **kwargs
72
+ )
73
+ axes[n, 1].set_title(
74
+ titles["category"] + ": " + cond + ". Std Dev " + metric_n
75
+ )
76
+ #axes[n, 1].yaxis.set_major_formatter(FormatStrFormatter(decimals))
77
+ #axes[n, 1].xaxis.set_major_formatter(FormatStrFormatter(decimals))
78
+
79
+ f.tight_layout()
80
+
81
+ if return_figure:
82
+ plt.close()
83
+ return f
84
+
85
+
86
+ def show_references(references):
87
+ n_conditions = len(list(references.keys()))
88
+ f, axes = plt.subplots(1, n_conditions, figsize=(12, 10))
89
+ i = 0
90
+ for cond, img in references.items():
91
+ axes[i].imshow(img, cmap="grey")
92
+ axes[i].set_title(f"Reference for: {cond}")
93
+ i = i + 1
94
+
95
+
96
+ def show_example_test(
97
+ queries, params, condition="STED_demo", replica_number=1, query_variant=0
98
+ ): #
99
+ param_values = [truncate(p, 6) for p in params]
100
+ print(param_values)
101
+ combination_pars = [str(val) for val in param_values]
102
+ print(combination_pars)
103
+ combination_name = ",".join(combination_pars)
104
+ print(combination_name)
105
+ plt.imshow(
106
+ queries[combination_name][replica_number][condition][query_variant], cmap="grey"
107
+ )
108
+ plt.title(combination_name)