micro-reader 0.0.2__tar.gz → 0.0.4__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.
- {micro_reader-0.0.2 → micro_reader-0.0.4}/PKG-INFO +120 -4
- {micro_reader-0.0.2 → micro_reader-0.0.4}/README.md +119 -3
- {micro_reader-0.0.2 → micro_reader-0.0.4}/pyproject.toml +1 -1
- {micro_reader-0.0.2 → micro_reader-0.0.4}/src/micro_reader/__init__.py +9 -5
- {micro_reader-0.0.2 → micro_reader-0.0.4}/src/micro_reader/_base.py +156 -13
- micro_reader-0.0.4/src/micro_reader/_cfb.py +200 -0
- micro_reader-0.0.4/src/micro_reader/_errors.py +31 -0
- micro_reader-0.0.4/src/micro_reader/_fileset.py +406 -0
- micro_reader-0.0.4/src/micro_reader/_groups.py +216 -0
- micro_reader-0.0.4/src/micro_reader/_outline.py +71 -0
- micro_reader-0.0.4/src/micro_reader/_parts.py +188 -0
- micro_reader-0.0.4/src/micro_reader/_plate.py +150 -0
- {micro_reader-0.0.2 → micro_reader-0.0.4}/src/micro_reader/_registry.py +50 -13
- {micro_reader-0.0.2 → micro_reader-0.0.4}/src/micro_reader/backends/_czi_metadata.py +45 -0
- micro_reader-0.0.4/src/micro_reader/backends/_ets.py +149 -0
- micro_reader-0.0.4/src/micro_reader/backends/_tiff_metadata.py +564 -0
- micro_reader-0.0.4/src/micro_reader/backends/_tiff_variants.py +239 -0
- micro_reader-0.0.4/src/micro_reader/backends/_vsi_tree.py +154 -0
- micro_reader-0.0.4/src/micro_reader/backends/companion.py +697 -0
- micro_reader-0.0.4/src/micro_reader/backends/cv7000.py +332 -0
- {micro_reader-0.0.2 → micro_reader-0.0.4}/src/micro_reader/backends/czi.py +55 -7
- micro_reader-0.0.4/src/micro_reader/backends/dv.py +372 -0
- micro_reader-0.0.4/src/micro_reader/backends/harmony.py +255 -0
- micro_reader-0.0.4/src/micro_reader/backends/incell.py +180 -0
- {micro_reader-0.0.2 → micro_reader-0.0.4}/src/micro_reader/backends/lif.py +19 -25
- micro_reader-0.0.4/src/micro_reader/backends/metaxpress.py +246 -0
- micro_reader-0.0.4/src/micro_reader/backends/oif.py +479 -0
- {micro_reader-0.0.2 → micro_reader-0.0.4}/src/micro_reader/backends/oir.py +57 -7
- {micro_reader-0.0.2 → micro_reader-0.0.4}/src/micro_reader/backends/tiff.py +327 -31
- micro_reader-0.0.4/src/micro_reader/backends/vsi.py +448 -0
- micro_reader-0.0.2/src/micro_reader/_errors.py +0 -14
- micro_reader-0.0.2/src/micro_reader/backends/_tiff_metadata.py +0 -287
- {micro_reader-0.0.2 → micro_reader-0.0.4}/.gitignore +0 -0
- {micro_reader-0.0.2 → micro_reader-0.0.4}/LICENSE +0 -0
- {micro_reader-0.0.2 → micro_reader-0.0.4}/src/micro_reader/_axes.py +0 -0
- {micro_reader-0.0.2 → micro_reader-0.0.4}/src/micro_reader/_codecs.py +0 -0
- {micro_reader-0.0.2 → micro_reader-0.0.4}/src/micro_reader/_index.py +0 -0
- {micro_reader-0.0.2 → micro_reader-0.0.4}/src/micro_reader/_io.py +0 -0
- {micro_reader-0.0.2 → micro_reader-0.0.4}/src/micro_reader/_jpeg_restarts.py +0 -0
- {micro_reader-0.0.2 → micro_reader-0.0.4}/src/micro_reader/_memory.py +0 -0
- {micro_reader-0.0.2 → micro_reader-0.0.4}/src/micro_reader/_metadata.py +0 -0
- {micro_reader-0.0.2 → micro_reader-0.0.4}/src/micro_reader/_pool.py +0 -0
- {micro_reader-0.0.2 → micro_reader-0.0.4}/src/micro_reader/_stream.py +0 -0
- {micro_reader-0.0.2 → micro_reader-0.0.4}/src/micro_reader/backends/__init__.py +0 -0
- {micro_reader-0.0.2 → micro_reader-0.0.4}/src/micro_reader/backends/_lif_metadata.py +0 -0
- {micro_reader-0.0.2 → micro_reader-0.0.4}/src/micro_reader/backends/_nd2_legacy.py +0 -0
- {micro_reader-0.0.2 → micro_reader-0.0.4}/src/micro_reader/backends/_nd2_metadata.py +0 -0
- {micro_reader-0.0.2 → micro_reader-0.0.4}/src/micro_reader/backends/_nd2_structure.py +0 -0
- {micro_reader-0.0.2 → micro_reader-0.0.4}/src/micro_reader/backends/ims.py +0 -0
- {micro_reader-0.0.2 → micro_reader-0.0.4}/src/micro_reader/backends/mrc.py +0 -0
- {micro_reader-0.0.2 → micro_reader-0.0.4}/src/micro_reader/backends/nd2.py +0 -0
- {micro_reader-0.0.2 → micro_reader-0.0.4}/src/micro_reader/backends/raster.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.5
|
|
2
2
|
Name: micro-reader
|
|
3
|
-
Version: 0.0.
|
|
3
|
+
Version: 0.0.4
|
|
4
4
|
Summary: Low-level, memory-bounded pixel reading for microscopy formats: read exactly the rectangle you ask for.
|
|
5
5
|
Project-URL: Homepage, https://github.com/bugraoezdemir/micro-reader
|
|
6
6
|
Project-URL: Source, https://github.com/bugraoezdemir/micro-reader
|
|
@@ -54,7 +54,7 @@ Description-Content-Type: text/markdown
|
|
|
54
54
|
|
|
55
55
|
**Memory-bounded pixel reader for microscopy images.**
|
|
56
56
|
|
|
57
|
-
`micro-reader` reads regions of large microscopy files without loading the entire image into memory. It provides a common interface across TIFF, CZI, ND2, Leica, OIR, Imaris, MRC,
|
|
57
|
+
`micro-reader` reads regions of large microscopy files without loading the entire image into memory. It provides a common interface across TIFF, CZI, ND2, Leica, OIR, OIB / OIF, Olympus VSI, Imaris, DeltaVision, MRC, common raster formats, OME companion file sets, and high-content screening plates (Harmony, MetaXpress, IN Cell, CellVoyager).
|
|
58
58
|
|
|
59
59
|
> **Status: pre-alpha (0.0.x)**
|
|
60
60
|
>
|
|
@@ -192,6 +192,10 @@ This returns the images matching the requested indices. For example, if a file c
|
|
|
192
192
|
`micro-reader` uses these index names when a format provides the corresponding dimensions:
|
|
193
193
|
|
|
194
194
|
```text
|
|
195
|
+
plate
|
|
196
|
+
acquisition
|
|
197
|
+
well
|
|
198
|
+
field
|
|
195
199
|
scene
|
|
196
200
|
tile
|
|
197
201
|
rotation
|
|
@@ -203,11 +207,37 @@ emission
|
|
|
203
207
|
excitation
|
|
204
208
|
lifetime
|
|
205
209
|
sequence
|
|
210
|
+
part
|
|
206
211
|
resolution
|
|
207
212
|
```
|
|
208
213
|
|
|
209
214
|
Only dimensions actually present in a file appear in an image's index.
|
|
210
215
|
|
|
216
|
+
### Files made of several files
|
|
217
|
+
|
|
218
|
+
Some formats always come as several files: an OIR file with its continuation files (`name_00001`), a Micro-Manager stack split over `..._MMStack_Pos0.ome.tif`, `..._MMStack_Pos0_1.ome.tif`, an NDTiff folder, an Olympus OIF with its `.oif.files` folder, an Olympus VSI with its `_name_` folder, a DeltaVision image with its softWoRx `.log`, a plate's side files (Harmony `Assaylayout/` and `FFC_Profile/`, CellVoyager settings files, MetaXpress `_thumb` previews). Opening any of these files opens the whole image:
|
|
219
|
+
|
|
220
|
+
```python
|
|
221
|
+
f = micro_reader.open("cells_R3D.dv.log")
|
|
222
|
+
f.path # the main file: "cells_R3D.dv"
|
|
223
|
+
f.opened # what was opened: "cells_R3D.dv.log"
|
|
224
|
+
```
|
|
225
|
+
|
|
226
|
+
You can also open the folder. A folder opens the image it belongs to (an NDTiff dataset folder, a Harmony or CellVoyager measurement folder), or the one image it holds. A folder with several images raises an error that lists them.
|
|
227
|
+
|
|
228
|
+
To sort many files at once, for example everything under a folder you want to convert, `group_files` says which files make one image:
|
|
229
|
+
|
|
230
|
+
```python
|
|
231
|
+
g = micro_reader.group_files("experiment/")
|
|
232
|
+
for group in g.groups:
|
|
233
|
+
group.main # the file to open: "slide.vsi", "plate/Index.idx.xml"
|
|
234
|
+
group.parts # the other files of a multi-file image
|
|
235
|
+
group.members # for a plate or companion index: the files its images come from
|
|
236
|
+
g.singles # every other file, as given
|
|
237
|
+
```
|
|
238
|
+
|
|
239
|
+
A file that a plate or companion index names is listed only in that index's group. When the main file of a multi-file image is missing, its group has `main=None`.
|
|
240
|
+
|
|
211
241
|
## Axes
|
|
212
242
|
|
|
213
243
|
An image array uses these axes:
|
|
@@ -401,7 +431,7 @@ img_scene0_level2 = f.select(scene=0, resolution=2)[0]
|
|
|
401
431
|
Supported pyramids include:
|
|
402
432
|
|
|
403
433
|
* **Imaris**: all stored levels
|
|
404
|
-
* **TIFF**: OME-TIFF and
|
|
434
|
+
* **TIFF**: OME-TIFF and whole-slide pyramids (SVS, NDPI, SCN, BIF, QPTIFF, Philips)
|
|
405
435
|
* **CZI**: stored pyramids of whole scenes
|
|
406
436
|
|
|
407
437
|
Other formats expose a single resolution level.
|
|
@@ -425,6 +455,43 @@ The tiles are composed according to the format's stitching information.
|
|
|
425
455
|
|
|
426
456
|
Currently, stitching is supported for **CZI only**.
|
|
427
457
|
|
|
458
|
+
## Plates
|
|
459
|
+
|
|
460
|
+
High-content screening plates are opened through their index file, for example `Index.idx.xml` for Harmony. Each field is one image, indexed by `plate`, `acquisition`, `well` and `field`.
|
|
461
|
+
|
|
462
|
+
The plate layout is available through:
|
|
463
|
+
|
|
464
|
+
```python
|
|
465
|
+
plate = f.plates[0]
|
|
466
|
+
plate.wells[0].name
|
|
467
|
+
# "B2"
|
|
468
|
+
```
|
|
469
|
+
|
|
470
|
+
Images can be reached through the wells, or selected by well:
|
|
471
|
+
|
|
472
|
+
```python
|
|
473
|
+
image = plate.wells[0].fields[0].image
|
|
474
|
+
f.select(well=plate.well_index("B2"))
|
|
475
|
+
```
|
|
476
|
+
|
|
477
|
+
`f.outline()` shows the plates, wells and fields of a file.
|
|
478
|
+
|
|
479
|
+
Zeiss CZI plates are read as plates with `plates=True`, and as scenes otherwise:
|
|
480
|
+
|
|
481
|
+
```python
|
|
482
|
+
f = micro_reader.open("plate.czi", plates=True)
|
|
483
|
+
```
|
|
484
|
+
|
|
485
|
+
Missing plane files are read as zeros, with a `MissingImagesWarning`. A field without any of its files is left out.
|
|
486
|
+
|
|
487
|
+
A plane file whose size or pixel type differs from what the index describes raises an error when it is read. To find such files before reading anything, check them all at once:
|
|
488
|
+
|
|
489
|
+
```python
|
|
490
|
+
f.check_members() # opens every plane file once; returns how many were checked
|
|
491
|
+
```
|
|
492
|
+
|
|
493
|
+
When the channels of a field have different z sampling, `image.parts` gives one image per group of channels that share it.
|
|
494
|
+
|
|
428
495
|
## Metadata
|
|
429
496
|
|
|
430
497
|
Pixel and channel metadata are available through:
|
|
@@ -488,13 +555,18 @@ The position is omitted when it cannot be determined reliably.
|
|
|
488
555
|
|
|
489
556
|
| Format | Notes |
|
|
490
557
|
| -------------------- | ----------------------------------------------------- |
|
|
491
|
-
| **TIFF / BigTIFF** | TIFF, OME-TIFF, ImageJ, LSM, STK
|
|
558
|
+
| **TIFF / BigTIFF** | TIFF, OME-TIFF, ImageJ, LSM, STK, Micro-Manager, whole-slide TIFFs |
|
|
559
|
+
| **OME companion** | `.companion.ome` sets of OME-TIFF files |
|
|
492
560
|
| **CZI** | Zeiss CZI, including mosaic tiles and stitched scenes |
|
|
493
561
|
| **ND2** | Nikon ND2, including legacy JPEG 2000 ND2 |
|
|
494
562
|
| **Leica** | LIF, LOF, LIFEXT, XLIF, XLEF, XLCF |
|
|
495
563
|
| **OIR** | Olympus / Evident FluoView |
|
|
564
|
+
| **OIB / OIF** | Olympus FluoView FV1000 / FV1200 / FV3000 |
|
|
565
|
+
| **VSI** | Olympus / Evident cellSens and VS120 / VS200 slide scanners |
|
|
496
566
|
| **Imaris** | `.ims`, with the `[ims]` extra |
|
|
567
|
+
| **DeltaVision** | `.dv`, `.r3d` (softWoRx, OMX, Priism) |
|
|
497
568
|
| **MRC** | Common MRC modes and extended headers |
|
|
569
|
+
| **Plates (HCS)** | Harmony, MetaXpress, IN Cell and CellVoyager plates |
|
|
498
570
|
| **JPEG / PNG / BMP** | Common raster image formats |
|
|
499
571
|
|
|
500
572
|
All formats use the same `File`, `Image`, axes, indexing, metadata, and reading interface wherever possible.
|
|
@@ -511,6 +583,14 @@ Supported TIFF formats include:
|
|
|
511
583
|
* ImageJ
|
|
512
584
|
* Zeiss LSM
|
|
513
585
|
* MetaMorph STK
|
|
586
|
+
* Micro-Manager stacks (MMStack and NDTiff), also when one acquisition is spread over several files
|
|
587
|
+
* Whole-slide TIFFs: Aperio SVS, Hamamatsu NDPI, Leica SCN, Ventana BIF, PerkinElmer / Akoya QPTIFF and Philips
|
|
588
|
+
|
|
589
|
+
Micro-Manager stage positions are scenes. NDTiff channel names and pixel sizes come from the dataset's index and frame metadata.
|
|
590
|
+
|
|
591
|
+
A whole-slide file gives the slide first, then the other pictures it stores as further scenes, as Bio-Formats lists them: `label` and `macro` (overview), and for some formats `thumbnail` (QPTIFF) or `probability` (BIF tissue map). Pixel sizes, positions and channel names come from each vendor's own metadata.
|
|
592
|
+
|
|
593
|
+
Ventana BIF scans store overlapping tiles. They are composed as Roche's description of the format places them. Files from scanners other than the VENTANA DP 200 are not supported.
|
|
514
594
|
|
|
515
595
|
Compressed TIFF data is decoded only for the strips or tiles needed by the requested region.
|
|
516
596
|
|
|
@@ -534,6 +614,24 @@ Additional codecs such as JPEG XR and LERC are available with:
|
|
|
534
614
|
pip install "micro-reader[codecs]"
|
|
535
615
|
```
|
|
536
616
|
|
|
617
|
+
### OME companion files
|
|
618
|
+
|
|
619
|
+
An OME companion file (`.companion.ome`) describes images stored in separate TIFF files. Opening the companion reads all those images and groups them together as one `t c z y x` image:
|
|
620
|
+
|
|
621
|
+
```python
|
|
622
|
+
f = micro_reader.open("data.companion.ome")
|
|
623
|
+
```
|
|
624
|
+
|
|
625
|
+
Opening one of the TIFF files on its own reads only that file, with its pixel sizes, channels and position taken from the companion. If the companion is missing, the file is read without pixel sizes, with a `CompanionWarning`. A TIFF whose metadata lives in another OME-TIFF (instead of a `.companion.ome`) takes it from that file in the same way.
|
|
626
|
+
|
|
627
|
+
Some OME-TIFF sets keep the full OME-XML in their TIFF files instead of a companion. Opening one of those files reads the whole set. To read only the planes stored in that file, with the set's metadata:
|
|
628
|
+
|
|
629
|
+
```python
|
|
630
|
+
f = micro_reader.open("set_t001.ome.tif", multifile=False)
|
|
631
|
+
```
|
|
632
|
+
|
|
633
|
+
Micro-Manager stacks always open whole, also with `multifile=False`: they split their files by size, so one file does not hold a complete part of the image.
|
|
634
|
+
|
|
537
635
|
### CZI
|
|
538
636
|
|
|
539
637
|
CZI files support:
|
|
@@ -595,6 +693,18 @@ These are represented using the common image/index model.
|
|
|
595
693
|
|
|
596
694
|
Olympus / Evident FluoView OIR files are supported, including companion files and spectral scans.
|
|
597
695
|
|
|
696
|
+
### Olympus OIB and OIF
|
|
697
|
+
|
|
698
|
+
Older FluoView files come in two forms with the same content: an OIB is one file, an OIF is a `.oif` settings file plus a `.oif.files` folder with one TIFF per plane. Both open as one `t c z y x` image, with pixel sizes, z and time steps, channel names, colours and wavelengths. Opening any file in the `.oif.files` folder opens the OIF.
|
|
699
|
+
|
|
700
|
+
### Olympus VSI
|
|
701
|
+
|
|
702
|
+
A cellSens VSI is a `.vsi` file plus a `_<name>_` folder that holds the pixels (`stack1/frame_t.ets`, `stack10000/frame_t.ets`, ...). The images are listed as Bio-Formats lists them: one per scanned area, named as in cellSens, with the slide label (`label`) and overview (`overview`) when the scanner took them, and the slide photo (`macro`) last. Each scanned area keeps its resolution levels.
|
|
703
|
+
|
|
704
|
+
Images are `t c z y x` (`t c z y x s` for brightfield RGB scans), with pixel sizes, z and time steps, and each channel's name, colour and emission wavelength. Stage positions are not read.
|
|
705
|
+
|
|
706
|
+
Opening the `_<name>_` folder, a `stack` folder or a file in it opens the `.vsi`. An `.ets` file whose `.vsi` is missing is read alone, with a warning, when it is a plain 2-D image; its size is then rounded up to whole tiles.
|
|
707
|
+
|
|
598
708
|
### Imaris
|
|
599
709
|
|
|
600
710
|
Install Imaris support with:
|
|
@@ -607,6 +717,12 @@ Imaris resolution level 0 is exposed at the actual image size, with Imaris chunk
|
|
|
607
717
|
|
|
608
718
|
Chunked compression is decoded in parallel.
|
|
609
719
|
|
|
720
|
+
### DeltaVision
|
|
721
|
+
|
|
722
|
+
DeltaVision files (`.dv`, `.r3d`, `.r3d_d3d`, also deconvolved and projected ones) are recognised by their content, whatever their extension. The image keeps the file's own order of time, waves and z (for example `ctzyx`).
|
|
723
|
+
|
|
724
|
+
Pixel sizes, and each channel's emission and excitation wavelengths, are read from the file. Channel names come from the softWoRx acquisition log next to it (`<file>.log`); a deconvolved or projected file takes the names from the log of the raw file it was made from. Stage positions are not read.
|
|
725
|
+
|
|
610
726
|
### MRC
|
|
611
727
|
|
|
612
728
|
Supported MRC modes include:
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
**Memory-bounded pixel reader for microscopy images.**
|
|
4
4
|
|
|
5
|
-
`micro-reader` reads regions of large microscopy files without loading the entire image into memory. It provides a common interface across TIFF, CZI, ND2, Leica, OIR, Imaris, MRC,
|
|
5
|
+
`micro-reader` reads regions of large microscopy files without loading the entire image into memory. It provides a common interface across TIFF, CZI, ND2, Leica, OIR, OIB / OIF, Olympus VSI, Imaris, DeltaVision, MRC, common raster formats, OME companion file sets, and high-content screening plates (Harmony, MetaXpress, IN Cell, CellVoyager).
|
|
6
6
|
|
|
7
7
|
> **Status: pre-alpha (0.0.x)**
|
|
8
8
|
>
|
|
@@ -140,6 +140,10 @@ This returns the images matching the requested indices. For example, if a file c
|
|
|
140
140
|
`micro-reader` uses these index names when a format provides the corresponding dimensions:
|
|
141
141
|
|
|
142
142
|
```text
|
|
143
|
+
plate
|
|
144
|
+
acquisition
|
|
145
|
+
well
|
|
146
|
+
field
|
|
143
147
|
scene
|
|
144
148
|
tile
|
|
145
149
|
rotation
|
|
@@ -151,11 +155,37 @@ emission
|
|
|
151
155
|
excitation
|
|
152
156
|
lifetime
|
|
153
157
|
sequence
|
|
158
|
+
part
|
|
154
159
|
resolution
|
|
155
160
|
```
|
|
156
161
|
|
|
157
162
|
Only dimensions actually present in a file appear in an image's index.
|
|
158
163
|
|
|
164
|
+
### Files made of several files
|
|
165
|
+
|
|
166
|
+
Some formats always come as several files: an OIR file with its continuation files (`name_00001`), a Micro-Manager stack split over `..._MMStack_Pos0.ome.tif`, `..._MMStack_Pos0_1.ome.tif`, an NDTiff folder, an Olympus OIF with its `.oif.files` folder, an Olympus VSI with its `_name_` folder, a DeltaVision image with its softWoRx `.log`, a plate's side files (Harmony `Assaylayout/` and `FFC_Profile/`, CellVoyager settings files, MetaXpress `_thumb` previews). Opening any of these files opens the whole image:
|
|
167
|
+
|
|
168
|
+
```python
|
|
169
|
+
f = micro_reader.open("cells_R3D.dv.log")
|
|
170
|
+
f.path # the main file: "cells_R3D.dv"
|
|
171
|
+
f.opened # what was opened: "cells_R3D.dv.log"
|
|
172
|
+
```
|
|
173
|
+
|
|
174
|
+
You can also open the folder. A folder opens the image it belongs to (an NDTiff dataset folder, a Harmony or CellVoyager measurement folder), or the one image it holds. A folder with several images raises an error that lists them.
|
|
175
|
+
|
|
176
|
+
To sort many files at once, for example everything under a folder you want to convert, `group_files` says which files make one image:
|
|
177
|
+
|
|
178
|
+
```python
|
|
179
|
+
g = micro_reader.group_files("experiment/")
|
|
180
|
+
for group in g.groups:
|
|
181
|
+
group.main # the file to open: "slide.vsi", "plate/Index.idx.xml"
|
|
182
|
+
group.parts # the other files of a multi-file image
|
|
183
|
+
group.members # for a plate or companion index: the files its images come from
|
|
184
|
+
g.singles # every other file, as given
|
|
185
|
+
```
|
|
186
|
+
|
|
187
|
+
A file that a plate or companion index names is listed only in that index's group. When the main file of a multi-file image is missing, its group has `main=None`.
|
|
188
|
+
|
|
159
189
|
## Axes
|
|
160
190
|
|
|
161
191
|
An image array uses these axes:
|
|
@@ -349,7 +379,7 @@ img_scene0_level2 = f.select(scene=0, resolution=2)[0]
|
|
|
349
379
|
Supported pyramids include:
|
|
350
380
|
|
|
351
381
|
* **Imaris**: all stored levels
|
|
352
|
-
* **TIFF**: OME-TIFF and
|
|
382
|
+
* **TIFF**: OME-TIFF and whole-slide pyramids (SVS, NDPI, SCN, BIF, QPTIFF, Philips)
|
|
353
383
|
* **CZI**: stored pyramids of whole scenes
|
|
354
384
|
|
|
355
385
|
Other formats expose a single resolution level.
|
|
@@ -373,6 +403,43 @@ The tiles are composed according to the format's stitching information.
|
|
|
373
403
|
|
|
374
404
|
Currently, stitching is supported for **CZI only**.
|
|
375
405
|
|
|
406
|
+
## Plates
|
|
407
|
+
|
|
408
|
+
High-content screening plates are opened through their index file, for example `Index.idx.xml` for Harmony. Each field is one image, indexed by `plate`, `acquisition`, `well` and `field`.
|
|
409
|
+
|
|
410
|
+
The plate layout is available through:
|
|
411
|
+
|
|
412
|
+
```python
|
|
413
|
+
plate = f.plates[0]
|
|
414
|
+
plate.wells[0].name
|
|
415
|
+
# "B2"
|
|
416
|
+
```
|
|
417
|
+
|
|
418
|
+
Images can be reached through the wells, or selected by well:
|
|
419
|
+
|
|
420
|
+
```python
|
|
421
|
+
image = plate.wells[0].fields[0].image
|
|
422
|
+
f.select(well=plate.well_index("B2"))
|
|
423
|
+
```
|
|
424
|
+
|
|
425
|
+
`f.outline()` shows the plates, wells and fields of a file.
|
|
426
|
+
|
|
427
|
+
Zeiss CZI plates are read as plates with `plates=True`, and as scenes otherwise:
|
|
428
|
+
|
|
429
|
+
```python
|
|
430
|
+
f = micro_reader.open("plate.czi", plates=True)
|
|
431
|
+
```
|
|
432
|
+
|
|
433
|
+
Missing plane files are read as zeros, with a `MissingImagesWarning`. A field without any of its files is left out.
|
|
434
|
+
|
|
435
|
+
A plane file whose size or pixel type differs from what the index describes raises an error when it is read. To find such files before reading anything, check them all at once:
|
|
436
|
+
|
|
437
|
+
```python
|
|
438
|
+
f.check_members() # opens every plane file once; returns how many were checked
|
|
439
|
+
```
|
|
440
|
+
|
|
441
|
+
When the channels of a field have different z sampling, `image.parts` gives one image per group of channels that share it.
|
|
442
|
+
|
|
376
443
|
## Metadata
|
|
377
444
|
|
|
378
445
|
Pixel and channel metadata are available through:
|
|
@@ -436,13 +503,18 @@ The position is omitted when it cannot be determined reliably.
|
|
|
436
503
|
|
|
437
504
|
| Format | Notes |
|
|
438
505
|
| -------------------- | ----------------------------------------------------- |
|
|
439
|
-
| **TIFF / BigTIFF** | TIFF, OME-TIFF, ImageJ, LSM, STK
|
|
506
|
+
| **TIFF / BigTIFF** | TIFF, OME-TIFF, ImageJ, LSM, STK, Micro-Manager, whole-slide TIFFs |
|
|
507
|
+
| **OME companion** | `.companion.ome` sets of OME-TIFF files |
|
|
440
508
|
| **CZI** | Zeiss CZI, including mosaic tiles and stitched scenes |
|
|
441
509
|
| **ND2** | Nikon ND2, including legacy JPEG 2000 ND2 |
|
|
442
510
|
| **Leica** | LIF, LOF, LIFEXT, XLIF, XLEF, XLCF |
|
|
443
511
|
| **OIR** | Olympus / Evident FluoView |
|
|
512
|
+
| **OIB / OIF** | Olympus FluoView FV1000 / FV1200 / FV3000 |
|
|
513
|
+
| **VSI** | Olympus / Evident cellSens and VS120 / VS200 slide scanners |
|
|
444
514
|
| **Imaris** | `.ims`, with the `[ims]` extra |
|
|
515
|
+
| **DeltaVision** | `.dv`, `.r3d` (softWoRx, OMX, Priism) |
|
|
445
516
|
| **MRC** | Common MRC modes and extended headers |
|
|
517
|
+
| **Plates (HCS)** | Harmony, MetaXpress, IN Cell and CellVoyager plates |
|
|
446
518
|
| **JPEG / PNG / BMP** | Common raster image formats |
|
|
447
519
|
|
|
448
520
|
All formats use the same `File`, `Image`, axes, indexing, metadata, and reading interface wherever possible.
|
|
@@ -459,6 +531,14 @@ Supported TIFF formats include:
|
|
|
459
531
|
* ImageJ
|
|
460
532
|
* Zeiss LSM
|
|
461
533
|
* MetaMorph STK
|
|
534
|
+
* Micro-Manager stacks (MMStack and NDTiff), also when one acquisition is spread over several files
|
|
535
|
+
* Whole-slide TIFFs: Aperio SVS, Hamamatsu NDPI, Leica SCN, Ventana BIF, PerkinElmer / Akoya QPTIFF and Philips
|
|
536
|
+
|
|
537
|
+
Micro-Manager stage positions are scenes. NDTiff channel names and pixel sizes come from the dataset's index and frame metadata.
|
|
538
|
+
|
|
539
|
+
A whole-slide file gives the slide first, then the other pictures it stores as further scenes, as Bio-Formats lists them: `label` and `macro` (overview), and for some formats `thumbnail` (QPTIFF) or `probability` (BIF tissue map). Pixel sizes, positions and channel names come from each vendor's own metadata.
|
|
540
|
+
|
|
541
|
+
Ventana BIF scans store overlapping tiles. They are composed as Roche's description of the format places them. Files from scanners other than the VENTANA DP 200 are not supported.
|
|
462
542
|
|
|
463
543
|
Compressed TIFF data is decoded only for the strips or tiles needed by the requested region.
|
|
464
544
|
|
|
@@ -482,6 +562,24 @@ Additional codecs such as JPEG XR and LERC are available with:
|
|
|
482
562
|
pip install "micro-reader[codecs]"
|
|
483
563
|
```
|
|
484
564
|
|
|
565
|
+
### OME companion files
|
|
566
|
+
|
|
567
|
+
An OME companion file (`.companion.ome`) describes images stored in separate TIFF files. Opening the companion reads all those images and groups them together as one `t c z y x` image:
|
|
568
|
+
|
|
569
|
+
```python
|
|
570
|
+
f = micro_reader.open("data.companion.ome")
|
|
571
|
+
```
|
|
572
|
+
|
|
573
|
+
Opening one of the TIFF files on its own reads only that file, with its pixel sizes, channels and position taken from the companion. If the companion is missing, the file is read without pixel sizes, with a `CompanionWarning`. A TIFF whose metadata lives in another OME-TIFF (instead of a `.companion.ome`) takes it from that file in the same way.
|
|
574
|
+
|
|
575
|
+
Some OME-TIFF sets keep the full OME-XML in their TIFF files instead of a companion. Opening one of those files reads the whole set. To read only the planes stored in that file, with the set's metadata:
|
|
576
|
+
|
|
577
|
+
```python
|
|
578
|
+
f = micro_reader.open("set_t001.ome.tif", multifile=False)
|
|
579
|
+
```
|
|
580
|
+
|
|
581
|
+
Micro-Manager stacks always open whole, also with `multifile=False`: they split their files by size, so one file does not hold a complete part of the image.
|
|
582
|
+
|
|
485
583
|
### CZI
|
|
486
584
|
|
|
487
585
|
CZI files support:
|
|
@@ -543,6 +641,18 @@ These are represented using the common image/index model.
|
|
|
543
641
|
|
|
544
642
|
Olympus / Evident FluoView OIR files are supported, including companion files and spectral scans.
|
|
545
643
|
|
|
644
|
+
### Olympus OIB and OIF
|
|
645
|
+
|
|
646
|
+
Older FluoView files come in two forms with the same content: an OIB is one file, an OIF is a `.oif` settings file plus a `.oif.files` folder with one TIFF per plane. Both open as one `t c z y x` image, with pixel sizes, z and time steps, channel names, colours and wavelengths. Opening any file in the `.oif.files` folder opens the OIF.
|
|
647
|
+
|
|
648
|
+
### Olympus VSI
|
|
649
|
+
|
|
650
|
+
A cellSens VSI is a `.vsi` file plus a `_<name>_` folder that holds the pixels (`stack1/frame_t.ets`, `stack10000/frame_t.ets`, ...). The images are listed as Bio-Formats lists them: one per scanned area, named as in cellSens, with the slide label (`label`) and overview (`overview`) when the scanner took them, and the slide photo (`macro`) last. Each scanned area keeps its resolution levels.
|
|
651
|
+
|
|
652
|
+
Images are `t c z y x` (`t c z y x s` for brightfield RGB scans), with pixel sizes, z and time steps, and each channel's name, colour and emission wavelength. Stage positions are not read.
|
|
653
|
+
|
|
654
|
+
Opening the `_<name>_` folder, a `stack` folder or a file in it opens the `.vsi`. An `.ets` file whose `.vsi` is missing is read alone, with a warning, when it is a plain 2-D image; its size is then rounded up to whole tiles.
|
|
655
|
+
|
|
546
656
|
### Imaris
|
|
547
657
|
|
|
548
658
|
Install Imaris support with:
|
|
@@ -555,6 +665,12 @@ Imaris resolution level 0 is exposed at the actual image size, with Imaris chunk
|
|
|
555
665
|
|
|
556
666
|
Chunked compression is decoded in parallel.
|
|
557
667
|
|
|
668
|
+
### DeltaVision
|
|
669
|
+
|
|
670
|
+
DeltaVision files (`.dv`, `.r3d`, `.r3d_d3d`, also deconvolved and projected ones) are recognised by their content, whatever their extension. The image keeps the file's own order of time, waves and z (for example `ctzyx`).
|
|
671
|
+
|
|
672
|
+
Pixel sizes, and each channel's emission and excitation wavelengths, are read from the file. Channel names come from the softWoRx acquisition log next to it (`<file>.log`); a deconvolved or projected file takes the names from the log of the raw file it was made from. Stage positions are not read.
|
|
673
|
+
|
|
558
674
|
### MRC
|
|
559
675
|
|
|
560
676
|
Supported MRC modes include:
|
|
@@ -6,7 +6,7 @@ build-backend = "hatchling.build"
|
|
|
6
6
|
|
|
7
7
|
[project]
|
|
8
8
|
name = "micro-reader"
|
|
9
|
-
version = "0.0.
|
|
9
|
+
version = "0.0.4"
|
|
10
10
|
description = "Low-level, memory-bounded pixel reading for microscopy formats: read exactly the rectangle you ask for."
|
|
11
11
|
readme = "README.md"
|
|
12
12
|
requires-python = ">=3.11"
|
|
@@ -4,22 +4,26 @@
|
|
|
4
4
|
>>> with micro_reader.open("image.mrc") as f:
|
|
5
5
|
... block = f.images[0].read(z=0, y=slice(0, 512))
|
|
6
6
|
"""
|
|
7
|
-
from ._base import INDEX_NAMES, SAMPLED_INDICES, File, Image, ReadStats
|
|
7
|
+
from ._base import INDEX_NAMES, PLATE_INDICES, SAMPLED_INDICES, File, Image, ReadStats
|
|
8
8
|
from ._metadata import Channel, Metadata, Quantity
|
|
9
|
-
from .
|
|
9
|
+
from ._plate import Acquisition, Field, Plate, Well
|
|
10
|
+
from ._errors import (CompanionWarning, CompositeWarning, CorruptFileError, MicroReaderError,
|
|
11
|
+
MissingImagesWarning, UnsupportedFormatError)
|
|
10
12
|
from ._memory import MemoryLimitError, memory_limit, set_memory_limit
|
|
11
13
|
from ._io import cache_limit, cached_bytes, set_cache_limit
|
|
12
14
|
from ._pool import decode_threads, set_decode_threads
|
|
13
15
|
from ._registry import BACKENDS, open # noqa: A004 - the public entry point
|
|
16
|
+
from ._groups import FileGroup, Grouping, group_files
|
|
14
17
|
from .backends.czi import DamagedFileWarning
|
|
15
18
|
|
|
16
|
-
__version__ = "0.0.
|
|
19
|
+
__version__ = "0.0.4"
|
|
17
20
|
|
|
18
21
|
__all__ = [
|
|
19
|
-
"open", "File", "Image", "INDEX_NAMES", "
|
|
20
|
-
"Metadata", "Channel", "Quantity",
|
|
22
|
+
"open", "group_files", "FileGroup", "Grouping", "File", "Image", "INDEX_NAMES", "PLATE_INDICES", "SAMPLED_INDICES", "ReadStats",
|
|
23
|
+
"BACKENDS", "Metadata", "Channel", "Quantity", "Plate", "Well", "Field", "Acquisition",
|
|
21
24
|
"decode_threads", "set_decode_threads", "memory_limit", "set_memory_limit",
|
|
22
25
|
"cache_limit", "set_cache_limit", "cached_bytes",
|
|
23
26
|
"MicroReaderError", "UnsupportedFormatError", "CorruptFileError", "MemoryLimitError", "DamagedFileWarning",
|
|
27
|
+
"MissingImagesWarning", "CompanionWarning", "CompositeWarning",
|
|
24
28
|
"__version__",
|
|
25
29
|
]
|