File tree Expand file tree Collapse file tree 2 files changed +18
-4
lines changed Expand file tree Collapse file tree 2 files changed +18
-4
lines changed Original file line number Diff line number Diff line change @@ -45,23 +45,30 @@ def _check_single_page_tiff(src: Path):
45
45
if src .is_file ():
46
46
src = src .parent
47
47
files = src .glob ("*.tif" )
48
- if len (files ) == 0 :
48
+ try :
49
+ next (files )
50
+ except StopIteration :
49
51
sub_dirs = _get_sub_dirs (src )
50
52
if sub_dirs :
51
53
files = (src / sub_dirs [0 ]).glob ("*.tif" )
52
- if len ( files ) > 0 :
54
+ try :
53
55
with tiff .TiffFile (next (files )) as tf :
54
56
if (
55
57
len (tf .pages ) == 1
56
58
): # and tf.pages[0].is_multipage is False:
57
59
return True
60
+ except StopIteration :
61
+ pass
58
62
return False
59
63
60
64
61
65
def _check_multipage_tiff (src : Path ):
62
66
if src .is_file ():
63
67
src = src .parent
64
- file = next (src .glob ("*.tif" ))
68
+ try :
69
+ file = next (src .glob ("*.tif" ))
70
+ except StopIteration :
71
+ return False
65
72
with tiff .TiffFile (file ) as tf :
66
73
if len (tf .pages ) > 1 :
67
74
return True
Original file line number Diff line number Diff line change 1
1
import pytest
2
2
3
+ from iohub ._deprecated .singlepagetiff import MicromanagerSequenceReader
3
4
from iohub .mmstack import MMStack
4
5
from iohub .ndtiff import NDTiffDataset
5
6
from iohub .reader import read_images
6
-
7
7
from tests .conftest import (
8
8
mm2gamma_ome_tiffs ,
9
+ mm2gamma_singlepage_tiffs ,
9
10
mm1422_ome_tiffs ,
10
11
ndtiff_v2_datasets ,
11
12
ndtiff_v3_labeled_positions ,
@@ -29,3 +30,9 @@ def test_detect_ome_tiff(data_path):
29
30
def test_detect_ndtiff (data_path ):
30
31
reader = read_images (data_path )
31
32
assert isinstance (reader , NDTiffDataset )
33
+
34
+
35
+ @pytest .mark .parametrize ("data_path" , mm2gamma_singlepage_tiffs )
36
+ def test_detect_single_page_tiff (data_path ):
37
+ reader = read_images (data_path )
38
+ assert isinstance (reader , MicromanagerSequenceReader )
You can’t perform that action at this time.
0 commit comments