Code Duplication    Length = 15-15 lines in 2 locations

tests/transforms/augmentation/test_random_affine_elastic_deformation.py 1 location

@@ 290-304 (lines=15) @@
287
        transformed = aff(image)
288
        assert all(n in (0, 1) for n in transformed.data.flatten())
289
290
    def test_no_inverse(self):
291
        tensor = torch.zeros((1, 2, 2, 2))
292
        tensor[0, 1, 1, 1] = 1  # most RAS voxel
293
        expected = torch.zeros((1, 2, 2, 2))
294
        expected[0, 0, 1, 1] = 1
295
        scales = 1, 1, 1
296
        degrees = 0, 0, 90  # anterior should go left
297
        translation = 0, 0, 0
298
        apply_affine = tio.Affine(
299
            scales,
300
            degrees,
301
            translation,
302
        )
303
        transformed = apply_affine(tensor)
304
        self.assert_tensor_almost_equal(transformed, expected)
305
306
    def test_different_spaces(self):
307
        t1 = self.sample_subject.t1

tests/transforms/augmentation/test_random_affine.py 1 location

@@ 210-224 (lines=15) @@
207
        with pytest.raises(ValueError):
208
            tio.RandomAffine(default_pad_label='minimum')
209
210
    def test_no_inverse(self):
211
        tensor = torch.zeros((1, 2, 2, 2))
212
        tensor[0, 1, 1, 1] = 1  # most RAS voxel
213
        expected = torch.zeros((1, 2, 2, 2))
214
        expected[0, 0, 1, 1] = 1
215
        scales = 1, 1, 1
216
        degrees = 0, 0, 90  # anterior should go left
217
        translation = 0, 0, 0
218
        apply_affine = tio.Affine(
219
            scales,
220
            degrees,
221
            translation,
222
        )
223
        transformed = apply_affine(tensor)
224
        self.assert_tensor_almost_equal(transformed, expected)
225
226
    def test_different_spaces(self):
227
        t1 = self.sample_subject.t1