Skip to content

Commit

Permalink
Accept iterable as type of input subjects
Browse files Browse the repository at this point in the history
  • Loading branch information
fepegar committed Dec 27, 2020
1 parent 3ad5f91 commit b9ac52d
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions torchio/data/dataset.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import copy
import collections
from typing import Sequence, Optional, Callable
from typing import Sequence, Optional, Callable, Iterable

from torch.utils.data import Dataset

Expand All @@ -17,8 +16,7 @@ class SubjectsDataset(Dataset):
and an optional transform applied to the volumes after loading.
Args:
subjects: List of instances of
:class:`~torchio.Subject`.
subjects: List of instances of :class:`~torchio.Subject`.
transform: An instance of :class:`~torchio.transforms.Transform`
that will be applied to each subject.
load_getitem: Load all subject images before returning it in
Expand Down Expand Up @@ -96,7 +94,7 @@ def set_transform(self, transform: Optional[Callable]) -> None:
self._transform = transform

@staticmethod
def _parse_subjects_list(subjects_list: Sequence[Subject]) -> None:
def _parse_subjects_list(subjects_list: Iterable[Subject]) -> None:
# Check that it's an iterable
try:
iter(subjects_list)
Expand Down

0 comments on commit b9ac52d

Please sign in to comment.