| Total Complexity | 5 |
| Total Lines | 20 |
| Duplicated Lines | 0 % |
| Changes | 0 | ||
| 1 | import torch |
||
| 2 | import torchio |
||
| 3 | import numpy as np |
||
| 4 | from torchio.data import PatchSampler |
||
| 5 | from ...utils import TorchioTestCase |
||
| 6 | |||
| 7 | |||
| 8 | class TestPatchSampler(TorchioTestCase): |
||
| 9 | """Tests for `PatchSampler` class.""" |
||
| 10 | def test_bad_patch_size(self): |
||
| 11 | with self.assertRaises(ValueError): |
||
| 12 | PatchSampler(0) |
||
| 13 | with self.assertRaises(ValueError): |
||
| 14 | PatchSampler(-1) |
||
| 15 | with self.assertRaises(ValueError): |
||
| 16 | PatchSampler(1.5) |
||
| 17 | |||
| 18 | def test_extract_patch(self): |
||
| 19 | PatchSampler(1).extract_patch(self.sample, (3, 4, 5)) |
||
| 20 |