Passed
Pull Request — master (#175)
by Fernando
01:24
created

UniformSampler.get_probability_map()   A

Complexity

Conditions 1

Size

Total Lines 2
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 2
nop 2
dl 0
loc 2
rs 10
c 0
b 0
f 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