|
24 | 24 | Memoizer, |
25 | 25 | MetadataTools, |
26 | 26 | ZeissCZIReader, |
| 27 | + Region, |
27 | 28 | ) |
28 | 29 |
|
29 | 30 |
|
@@ -186,6 +187,7 @@ def import_image( |
186 | 187 | t_start=None, |
187 | 188 | t_end=None, |
188 | 189 | t_interval=None, |
| 190 | + region=None, |
189 | 191 | ): |
190 | 192 | """Open an image file using the Bio-Formats importer. |
191 | 193 |
|
@@ -229,8 +231,11 @@ def import_image( |
229 | 231 | only import a subset of time points ending with this one. Requires to |
230 | 232 | set t_start and t_interval. |
231 | 233 | t_interval : int, optional |
232 | | - only import a subset of time points with thsi interval. Requires to set |
| 234 | + only import a subset of time points with this interval. Requires to set |
233 | 235 | t_start and t_end. |
| 236 | + region : list, optional |
| 237 | + Bio-Formats crop region, by default None. |
| 238 | + Format = [start_x, start_y, width in px, height in px] |
234 | 239 |
|
235 | 240 | Returns |
236 | 241 | ------- |
@@ -276,6 +281,12 @@ def import_image( |
276 | 281 | options.setTEnd(series_number, t_end) |
277 | 282 | options.setTStep(series_number, t_interval) |
278 | 283 |
|
| 284 | + if region is not None: |
| 285 | + options.setCrop(True) |
| 286 | + options.setCropRegion( |
| 287 | + series_number, Region(region[0], region[1], region[2], region[3]) |
| 288 | + ) |
| 289 | + |
279 | 290 | log.info("Reading [%s]", filename) |
280 | 291 | orig_imps = BF.openImagePlus(options) |
281 | 292 | log.debug("Opened [%s] %s", filename, type(orig_imps)) |
|
0 commit comments