for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
import torch
import torchio
import numpy as np
from torchio.data import PatchSampler
from ...utils import TorchioTestCase
class TestPatchSampler(TorchioTestCase):
"""Tests for `PatchSampler` class."""
def test_bad_patch_size(self):
with self.assertRaises(ValueError):
PatchSampler(0)
PatchSampler(-1)
PatchSampler(1.5)
def test_extract_patch(self):
PatchSampler(1).extract_patch(self.sample, (3, 4, 5))