Passed
Pull Request — master (#533)
by Fernando
01:23
created

tests.transforms.preprocessing.test_contour   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 16
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 3
eloc 12
dl 0
loc 16
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A TestContour.test_multichannel() 0 4 2
A TestContour.test_one_hot() 0 3 1
1
import torch
2
import torchio as tio
3
from ...utils import TorchioTestCase
4
5
6
class TestContour(TorchioTestCase):
7
    """Tests for `Contour`."""
8
    def test_one_hot(self):
9
        image = self.sample_subject.label
10
        tio.Contour()(image)
11
12
    def test_multichannel(self):
13
        label_map = tio.LabelMap(tensor=torch.rand(2, 3, 3, 3) > 1)
14
        with self.assertRaises(RuntimeError):
15
            tio.Contour()(label_map)
16