8000 Set _num_frames based on load_func instead of load_pattern · scikit-image/scikit-image@5899e76 · GitHub
[go: up one dir, main page]

Skip to content

Commit 5899e76

Browse files
committed
Set _num_frames based on load_func instead of load_pattern
1 parent 8fccc96 commit 5899e76

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

skimage/io/collection.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -162,12 +162,20 @@ def __init__(self, load_pattern, conserve_memory=True, load_func=None,
162162
for pattern in load_pattern:
163163
self._files.extend(glob(pattern))
164164
self._files = sorted(self._files, key=alphanumeric_key)
165-
self._numframes = self._find_images()
166165
else:
167166
self._files = load_pattern
167+
168+
if load_func is None:
169+
from ._io import imread
170+
self.load_func = imread
171+
self._numframes = self._find_images()
172+
else:
173+
self.load_func = load_func
168174
self._numframes = len(self._files)
169175
self._frame_index = None
170176

177+
self.load_func_kwargs = load_func_kwargs
178+
171179
if conserve_memory:
172180
memory_slots = 1
173181
else:
@@ -176,14 +184,6 @@ def __init__(self, load_pattern, conserve_memory=True, load_func=None,
176184
self._conserve_memory = conserve_memory
177185
self._cached = None
178186

179-
if load_func is None:
180-
from ._io import imread
181-
self.load_func = imread
182-
else:
183-
self.load_func = load_func
184-
185-
self.load_func_kwargs = load_func_kwargs
186-
187187
self.data = np.empty(memory_slots, dtype=object)
188188

189189
@property

0 commit comments

Comments
 (0)
0