|
6 | 6 | Public API: |
7 | 7 | BIOIO_PLUGINS - Dict of all bioio plugins and their file extensions |
8 | 8 | suggest_plugins_for_path() - Get list of suggested plugins by file extension |
| 9 | + get_reader_priority() - Get reader priority list from BIOIO_PLUGINS order |
9 | 10 |
|
10 | 11 | Internal API (used by ReaderPluginManager): |
11 | 12 | format_plugin_installation_message() - Generate installation message |
|
35 | 36 |
|
36 | 37 | # Bioio plugins and their supported extensions |
37 | 38 | # Source: https://github.com/bioio-devs/bioio |
| 39 | +# |
| 40 | +# ORDERING MATTERS: Plugins are listed in priority order (highest priority first). |
| 41 | +# This order is used by ReaderPluginManager when selecting readers. |
| 42 | +# Priority is based on: |
| 43 | +# 1. Metadata preservation quality (OME formats preserve most metadata) |
| 44 | +# 2. Reliability and performance for specific formats |
| 45 | +# 3. Known issues or limitations |
38 | 46 | BIOIO_PLUGINS = { |
39 | | - "bioio-czi": { |
40 | | - "extensions": [".czi"], |
41 | | - "description": "Zeiss CZI files", |
42 | | - "repository": "https://github.com/bioio-devs/bioio-czi", |
43 | | - }, |
44 | | - "bioio-dv": { |
45 | | - "extensions": [".dv", ".r3d"], |
46 | | - "description": "DeltaVision files", |
47 | | - "repository": "https://github.com/bioio-devs/bioio-dv", |
48 | | - }, |
49 | | - "bioio-imageio": { |
50 | | - "extensions": [".bmp", ".gif", ".jpg", ".jpeg", ".png"], |
51 | | - "description": "Generic image formats (PNG, JPG, etc.)", |
52 | | - "repository": "https://github.com/bioio-devs/bioio-imageio", |
| 47 | + # Highest priority: OME formats with excellent metadata preservation |
| 48 | + "bioio-ome-zarr": { |
| 49 | + "extensions": [".zarr"], |
| 50 | + "description": "OME-Zarr files", |
| 51 | + "repository": "https://github.com/bioio-devs/bioio-ome-zarr", |
53 | 52 | "core": True, |
54 | 53 | }, |
55 | | - "bioio-lif": { |
56 | | - "extensions": [".lif"], |
57 | | - "description": "Leica LIF files", |
58 | | - "repository": "https://github.com/bioio-devs/bioio-lif", |
59 | | - }, |
60 | | - "bioio-nd2": { |
61 | | - "extensions": [".nd2"], |
62 | | - "description": "Nikon ND2 files", |
63 | | - "repository": "https://github.com/bioio-devs/bioio-nd2", |
64 | | - }, |
65 | 54 | "bioio-ome-tiff": { |
66 | 55 | "extensions": [".ome.tif", ".ome.tiff", ".tif", ".tiff"], |
67 | 56 | "description": "OME-TIFF files with valid OME-XML metadata", |
|
73 | 62 | "description": "Tiled OME-TIFF files", |
74 | 63 | "repository": "https://github.com/bioio-devs/bioio-ome-tiled-tiff", |
75 | 64 | }, |
76 | | - "bioio-ome-zarr": { |
77 | | - "extensions": [".zarr"], |
78 | | - "description": "OME-Zarr files", |
79 | | - "repository": "https://github.com/bioio-devs/bioio-ome-zarr", |
| 65 | + # High priority: Format-specific readers with good metadata support |
| 66 | + "bioio-tifffile": { |
| 67 | + "extensions": [".tif", ".tiff"], |
| 68 | + "description": "TIFF files (including those without OME metadata)", |
| 69 | + "repository": "https://github.com/bioio-devs/bioio-tifffile", |
80 | 70 | "core": True, |
81 | 71 | }, |
| 72 | + "bioio-nd2": { |
| 73 | + "extensions": [".nd2"], |
| 74 | + "description": "Nikon ND2 files", |
| 75 | + "repository": "https://github.com/bioio-devs/bioio-nd2", |
| 76 | + }, |
| 77 | + "bioio-czi": { |
| 78 | + "extensions": [".czi"], |
| 79 | + "description": "Zeiss CZI files", |
| 80 | + "repository": "https://github.com/bioio-devs/bioio-czi", |
| 81 | + }, |
| 82 | + "bioio-lif": { |
| 83 | + "extensions": [".lif"], |
| 84 | + "description": "Leica LIF files", |
| 85 | + "repository": "https://github.com/bioio-devs/bioio-lif", |
| 86 | + }, |
| 87 | + "bioio-dv": { |
| 88 | + "extensions": [".dv", ".r3d"], |
| 89 | + "description": "DeltaVision files", |
| 90 | + "repository": "https://github.com/bioio-devs/bioio-dv", |
| 91 | + }, |
82 | 92 | "bioio-sldy": { |
83 | 93 | "extensions": [".sldy", ".dir"], |
84 | 94 | "description": "3i SlideBook files", |
85 | 95 | "repository": "https://github.com/bioio-devs/bioio-sldy", |
86 | 96 | }, |
87 | | - "bioio-tifffile": { |
88 | | - "extensions": [".tif", ".tiff"], |
89 | | - "description": "TIFF files (including those without OME metadata)", |
90 | | - "repository": "https://github.com/bioio-devs/bioio-tifffile", |
| 97 | + # Lower priority: Generic/fallback readers |
| 98 | + "bioio-imageio": { |
| 99 | + "extensions": [".bmp", ".gif", ".jpg", ".jpeg", ".png"], |
| 100 | + "description": "Generic image formats (PNG, JPG, etc.)", |
| 101 | + "repository": "https://github.com/bioio-devs/bioio-imageio", |
| 102 | + "core": True, |
91 | 103 | }, |
92 | 104 | "bioio-tiff-glob": { |
93 | 105 | "extensions": [".tiff"], |
94 | 106 | "description": "TIFF sequences (glob patterns)", |
95 | 107 | "repository": "https://github.com/bioio-devs/bioio-tiff-glob", |
96 | 108 | }, |
| 109 | + # Lowest priority: Requires external dependencies (Java) |
97 | 110 | "bioio-bioformats": { |
98 | 111 | "extensions": [".oib", ".oif", ".vsi", ".ims", ".lsm", ".stk"], |
99 | 112 | "description": "Proprietary microscopy formats (requires Java)", |
|
111 | 124 | _EXTENSION_TO_PLUGIN[ext].append(plugin_name) |
112 | 125 |
|
113 | 126 |
|
| 127 | +def get_reader_priority() -> list[str]: |
| 128 | + """Get reader priority list from BIOIO_PLUGINS dictionary order. |
| 129 | +
|
| 130 | + Returns plugin names in priority order (highest priority first). |
| 131 | + This order is used by ReaderPluginManager when selecting readers. |
| 132 | +
|
| 133 | + Returns |
| 134 | + ------- |
| 135 | + list of str |
| 136 | + Plugin names in priority order |
| 137 | +
|
| 138 | + Examples |
| 139 | + -------- |
| 140 | + >>> from ndevio._bioio_plugin_utils import get_reader_priority |
| 141 | + >>> priority = get_reader_priority() |
| 142 | + >>> print(priority[0]) # Highest priority reader |
| 143 | + 'bioio-ome-zarr' |
| 144 | + """ |
| 145 | + return list(BIOIO_PLUGINS.keys()) |
| 146 | + |
| 147 | + |
114 | 148 | def format_plugin_installation_message( |
115 | 149 | filename: str, |
116 | 150 | suggested_plugins: list[str], |
|
0 commit comments