| Total Complexity | 2 |
| Total Lines | 17 |
| Duplicated Lines | 0 % |
| Changes | 0 | ||
| 1 | from typing import Union, Sequence |
||
| 2 | import torch |
||
| 3 | from .weighted import WeightedSampler |
||
| 4 | |||
| 5 | |||
| 6 | class UniformSampler(WeightedSampler): |
||
| 7 | """Randomly extract patches from a volume with uniform probability. |
||
| 8 | |||
| 9 | Args: |
||
| 10 | patch_size: See :py:class:`~torchio.data.PatchSampler`. |
||
| 11 | """ |
||
| 12 | def __init__(self, patch_size: Union[int, Sequence[int]]): |
||
| 13 | super().__init__(patch_size) |
||
| 14 | |||
| 15 | def get_probability_map(self, sample): |
||
| 16 | return torch.ones(sample.shape) |
||
| 17 |