Passed
Pull Request — master (#175)
by Fernando
59s
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
import torch
2
from ...data.subject import Subject
3
from ...torchio import TypePatchSize
4
from .weighted import WeightedSampler
5
6
7
class UniformSampler(WeightedSampler):
8
    """Randomly extract patches from a volume with uniform probability.
9
10
    Args:
11
        patch_size: See :py:class:`~torchio.data.PatchSampler`.
12
    """
13
    def __init__(self, patch_size: TypePatchSize):
14
        super().__init__(patch_size)
15
16
    def get_probability_map(self, sample: Subject) -> torch.Tensor:
17
        return torch.ones(sample.shape)
18