From ab9ccb18d509fbfd4f56d9c489d09fbaad3c0486 Mon Sep 17 00:00:00 2001 From: Andreas M Arnold Date: Tue, 24 Oct 2023 19:55:38 -0400 Subject: [PATCH] Add test for copy_tf --- src/affinder/_tests/test_affinder.py | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/affinder/_tests/test_affinder.py b/src/affinder/_tests/test_affinder.py index a09eb59..b6e3a33 100644 --- a/src/affinder/_tests/test_affinder.py +++ b/src/affinder/_tests/test_affinder.py @@ -1,4 +1,4 @@ -from affinder import start_affinder +from affinder import start_affinder, copy_affine from affinder.affinder import AffineTransformChoices from skimage import data, transform import numpy as np @@ -7,6 +7,7 @@ import napari import pytest + layer0_pts = np.array([[140.38371886, 322.5390704], [181.91866481, 319.65803368], [176.15659138, 259.1562627], @@ -98,3 +99,13 @@ def test_ensure_different_layers(make_napari_viewer): assert widget.reference.value != widget.moving.value widget.reference.value = widget.moving.value assert widget.reference.value != widget.moving.value + + +def test_copy_affine(): + layer0 = napari.layers.Image(np.random.random((5, 5))) + layer1 = napari.layers.Image(np.random.random((5, 5))) + layer0.affine = np.array([[0.9, 0.1, 5], [0.4, 0.2, 9], [0, 0, 1]]) + + widget = copy_affine() + widget(layer0, layer1) + np.testing.assert_allclose(layer0.affine, layer1.affine)