|
5 | 5 | "id": "d778aece-5867-49b6-8890-f5a387f22c44", |
6 | 6 | "metadata": {}, |
7 | 7 | "source": [ |
8 | | - "# Learning to fly with OME-Arrow\n" |
| 8 | + "# Learning to fly with OME-Arrow\n", |
| 9 | + "\n", |
| 10 | + "This notebook provides a quick demonstration of what you can do with OME Arrow." |
9 | 11 | ] |
10 | 12 | }, |
11 | 13 | { |
|
15 | 17 | "metadata": {}, |
16 | 18 | "outputs": [], |
17 | 19 | "source": [ |
| 20 | + "# we import a single class, OMEArrow\n", |
| 21 | + "# which handles all data I/O and manipulation\n", |
18 | 22 | "from ome_arrow import OMEArrow" |
19 | 23 | ] |
20 | 24 | }, |
|
30 | 34 | "2D image, single-channel - shape (T=1, C=1, Z=1, Y=512, X=512)" |
31 | 35 | ], |
32 | 36 | "text/plain": [ |
33 | | - "<ome_arrow.core.OMEArrow at 0x169de7d90>" |
| 37 | + "<ome_arrow.core.OMEArrow at 0x162d227d0>" |
34 | 38 | ] |
35 | 39 | }, |
36 | 40 | "execution_count": 2, |
|
49 | 53 | } |
50 | 54 | ], |
51 | 55 | "source": [ |
| 56 | + "# read a TIFF file and convert it to OME-Arrow\n", |
52 | 57 | "oa_image = OMEArrow(\n", |
53 | 58 | " data=\"../../../tests/data/examplehuman/AS_09125_050116030001_D03f00d0.tif\"\n", |
54 | 59 | ")\n", |
| 60 | + "# by default, the image and metadata are shown\n", |
55 | 61 | "oa_image" |
56 | 62 | ] |
57 | 63 | }, |
|
77 | 83 | } |
78 | 84 | ], |
79 | 85 | "source": [ |
| 86 | + "# we can also get a summary of the OME-Arrow object\n", |
80 | 87 | "oa_image.info()" |
81 | 88 | ] |
82 | 89 | }, |
|
105 | 112 | } |
106 | 113 | ], |
107 | 114 | "source": [ |
| 115 | + "# we can export the data into a number\n", |
| 116 | + "# of different formats, e.g. numpy\n", |
108 | 117 | "oa_image.export(how=\"numpy\")" |
109 | 118 | ] |
110 | 119 | }, |
|
120 | 129 | "3D image (z-stack), multi-channel (2 channels) - shape (T=1, C=2, Z=22, Y=128, X=128)" |
121 | 130 | ], |
122 | 131 | "text/plain": [ |
123 | | - "<ome_arrow.core.OMEArrow at 0x31d2e8550>" |
| 132 | + "<ome_arrow.core.OMEArrow at 0x1662b2810>" |
124 | 133 | ] |
125 | 134 | }, |
126 | 135 | "execution_count": 5, |
|
139 | 148 | } |
140 | 149 | ], |
141 | 150 | "source": [ |
| 151 | + "# We can also read in TIFF stacks following OME bfconvert API conventions\n", |
142 | 152 | "stack = OMEArrow(\n", |
143 | 153 | " data=\"../../../tests/data/nviz-artificial-4d-dataset/E99_C<111,222>_ZS<000-021>.tif\",\n", |
| 154 | + " # this is an optional for which\n", |
| 155 | + " # timepoint, channel, and z-slice to show by default\n", |
144 | 156 | " tcz=(0, 0, 20),\n", |
145 | 157 | ")\n", |
146 | 158 | "stack" |
147 | 159 | ] |
148 | 160 | }, |
149 | 161 | { |
150 | 162 | "cell_type": "code", |
151 | | - "execution_count": 10, |
| 163 | + "execution_count": 6, |
152 | 164 | "id": "383e1f10-b32f-47cb-9906-15dd9947b09a", |
153 | 165 | "metadata": {}, |
154 | 166 | "outputs": [ |
155 | 167 | { |
156 | 168 | "data": { |
157 | 169 | "application/vnd.jupyter.widget-view+json": { |
158 | | - "model_id": "cf00f3c09cc340f792d8811b76cc739b", |
| 170 | + "model_id": "e644f91c4e3843c39f130f05b628277e", |
159 | 171 | "version_major": 2, |
160 | 172 | "version_minor": 0 |
161 | 173 | }, |
162 | 174 | "text/plain": [ |
163 | | - "Widget(value='<iframe src=\"http://localhost:65381/index.html?ui=P_0x3620ef510_0&reconnect=auto\" class=\"pyvista…" |
| 175 | + "Widget(value='<iframe src=\"http://localhost:55867/index.html?ui=P_0x1663cf990_0&reconnect=auto\" class=\"pyvista…" |
164 | 176 | ] |
165 | 177 | }, |
166 | 178 | "metadata": {}, |
|
186 | 198 | { |
187 | 199 | "data": { |
188 | 200 | "text/plain": [ |
189 | | - "<pyvista.plotting.plotter.Plotter at 0x3620ef510>" |
| 201 | + "<pyvista.plotting.plotter.Plotter at 0x1663cf990>" |
190 | 202 | ] |
191 | 203 | }, |
192 | | - "execution_count": 10, |
| 204 | + "execution_count": 6, |
193 | 205 | "metadata": {}, |
194 | 206 | "output_type": "execute_result" |
195 | 207 | } |
196 | 208 | ], |
197 | 209 | "source": [ |
| 210 | + "# we can visualize the stack using pyvista for 3D rendering\n", |
198 | 211 | "stack.view(how=\"pyvista\")" |
199 | 212 | ] |
200 | 213 | }, |
201 | 214 | { |
202 | 215 | "cell_type": "code", |
203 | | - "execution_count": 6, |
| 216 | + "execution_count": 7, |
204 | 217 | "id": "d041ba28-bb16-4833-9661-9c9da2ff3a9c", |
205 | 218 | "metadata": {}, |
206 | 219 | "outputs": [ |
|
210 | 223 | "3D image (z-stack), multi-channel (2 channels) - shape (T=1, C=2, Z=22, Y=128, X=128)" |
211 | 224 | ], |
212 | 225 | "text/plain": [ |
213 | | - "<ome_arrow.core.OMEArrow at 0x31d3a9790>" |
| 226 | + "<ome_arrow.core.OMEArrow at 0x10aae1ad0>" |
214 | 227 | ] |
215 | 228 | }, |
216 | | - "execution_count": 6, |
| 229 | + "execution_count": 7, |
217 | 230 | "metadata": {}, |
218 | 231 | "output_type": "execute_result" |
219 | 232 | }, |
|
229 | 242 | } |
230 | 243 | ], |
231 | 244 | "source": [ |
| 245 | + "# here we demonstrate that the data can be exported again\n", |
| 246 | + "# into numpy format and re-imported\n", |
| 247 | + "# into a new OME-Arrow object (from numpy data).\n", |
232 | 248 | "stack_np = stack.export(how=\"numpy\")\n", |
233 | 249 | "OMEArrow(data=stack_np, tcz=(0, 0, 20))" |
234 | 250 | ] |
235 | 251 | }, |
236 | 252 | { |
237 | 253 | "cell_type": "code", |
238 | | - "execution_count": 7, |
| 254 | + "execution_count": 8, |
239 | 255 | "id": "013baec4-0fed-452c-b200-cfd3b5f04d3e", |
240 | 256 | "metadata": {}, |
241 | 257 | "outputs": [ |
|
245 | 261 | "3D image (z-stack), multi-channel (2 channels) - shape (T=1, C=2, Z=22, Y=128, X=128)" |
246 | 262 | ], |
247 | 263 | "text/plain": [ |
248 | | - "<ome_arrow.core.OMEArrow at 0x31d3e1710>" |
| 264 | + "<ome_arrow.core.OMEArrow at 0x1662019d0>" |
249 | 265 | ] |
250 | 266 | }, |
251 | | - "execution_count": 7, |
| 267 | + "execution_count": 8, |
252 | 268 | "metadata": {}, |
253 | 269 | "output_type": "execute_result" |
254 | 270 | }, |
|
264 | 280 | } |
265 | 281 | ], |
266 | 282 | "source": [ |
| 283 | + "# here we demonstrate that the data can be exported again\n", |
| 284 | + "# into OME-TIFF format and re-imported\n", |
| 285 | + "# into a new OME-Arrow object (from OME-TIFF data).\n", |
267 | 286 | "stack.export(how=\"ome-tiff\", out=\"example.ome.tiff\")\n", |
268 | 287 | "OMEArrow(data=\"example.ome.tiff\", tcz=(0, 0, 20))" |
269 | 288 | ] |
270 | 289 | }, |
271 | 290 | { |
272 | 291 | "cell_type": "code", |
273 | | - "execution_count": 8, |
| 292 | + "execution_count": 9, |
274 | 293 | "id": "ebaab572-f820-4402-9dd7-2ad5ce657e05", |
275 | 294 | "metadata": {}, |
276 | 295 | "outputs": [ |
|
280 | 299 | "3D image (z-stack), multi-channel (2 channels) - shape (T=1, C=2, Z=22, Y=128, X=128)" |
281 | 300 | ], |
282 | 301 | "text/plain": [ |
283 | | - "<ome_arrow.core.OMEArrow at 0x31d3521d0>" |
| 302 | + "<ome_arrow.core.OMEArrow at 0x1663adad0>" |
284 | 303 | ] |
285 | 304 | }, |
286 | | - "execution_count": 8, |
| 305 | + "execution_count": 9, |
287 | 306 | "metadata": {}, |
288 | 307 | "output_type": "execute_result" |
289 | 308 | }, |
|
299 | 318 | } |
300 | 319 | ], |
301 | 320 | "source": [ |
| 321 | + "# here we demonstrate that the data can be exported again\n", |
| 322 | + "# into OME-ZARR format and re-imported\n", |
| 323 | + "# into a new OME-Arrow object (from OME-ZARR data).\n", |
302 | 324 | "stack.export(how=\"ome-zarr\", out=\"example.ome.zarr\")\n", |
303 | 325 | "OMEArrow(data=\"example.ome.zarr\", tcz=(0, 0, 20))" |
304 | 326 | ] |
305 | 327 | }, |
306 | 328 | { |
307 | 329 | "cell_type": "code", |
308 | | - "execution_count": 9, |
| 330 | + "execution_count": 10, |
309 | 331 | "id": "11b5c23c-d4b1-4170-ad0c-64c358b0cfe6", |
310 | 332 | "metadata": {}, |
311 | 333 | "outputs": [ |
|
315 | 337 | "3D image (z-stack), multi-channel (2 channels) - shape (T=1, C=2, Z=22, Y=128, X=128)" |
316 | 338 | ], |
317 | 339 | "text/plain": [ |
318 | | - "<ome_arrow.core.OMEArrow at 0x31d349d50>" |
| 340 | + "<ome_arrow.core.OMEArrow at 0x38064c810>" |
319 | 341 | ] |
320 | 342 | }, |
321 | | - "execution_count": 9, |
| 343 | + "execution_count": 10, |
322 | 344 | "metadata": {}, |
323 | 345 | "output_type": "execute_result" |
324 | 346 | }, |
|
334 | 356 | } |
335 | 357 | ], |
336 | 358 | "source": [ |
| 359 | + "# here we demonstrate that the data can be exported again\n", |
| 360 | + "# into OME-Parquet format and re-imported\n", |
| 361 | + "# into a new OME-Arrow object (from OME-Parquet data).\n", |
337 | 362 | "stack.export(how=\"ome-parquet\", out=\"example.ome.parquet\")\n", |
338 | 363 | "OMEArrow(data=\"example.ome.parquet\", tcz=(0, 0, 20))" |
339 | 364 | ] |
|
350 | 375 | "2D image, single-channel - shape (T=1, C=1, Z=1, Y=30, X=30)" |
351 | 376 | ], |
352 | 377 | "text/plain": [ |
353 | | - "<ome_arrow.core.OMEArrow at 0x31d385f10>" |
| 378 | + "<ome_arrow.core.OMEArrow at 0x167243690>" |
354 | 379 | ] |
355 | 380 | }, |
356 | 381 | "execution_count": 11, |
|
369 | 394 | } |
370 | 395 | ], |
371 | 396 | "source": [ |
| 397 | + "# we can also slice the data to get a smaller region of interest\n", |
372 | 398 | "stack.slice(\n", |
373 | 399 | " x_min=40,\n", |
374 | 400 | " y_min=80,\n", |
|
0 commit comments