From 9eea4e7b90de089cb9d8ad529435bd94049aab65 Mon Sep 17 00:00:00 2001 From: Juan Nunez-Iglesias Date: Mon, 27 Nov 2023 09:19:46 +0100 Subject: [PATCH 1/2] add pre commit (#86) - Add .pre-commit config file - Add formatting to test_affinder --- .pre-commit-config.yaml | 6 ++++++ src/affinder/_tests/test_affinder.py | 6 +----- 2 files changed, 7 insertions(+), 5 deletions(-) create mode 100644 .pre-commit-config.yaml diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml new file mode 100644 index 0000000..9aefa25 --- /dev/null +++ b/.pre-commit-config.yaml @@ -0,0 +1,6 @@ +repos: +- repo: https://github.com/google/yapf + rev: 'v0.40.2' # Use the sha / tag you want to point at + hooks: + - id: yapf + exclude: docs/conf.py diff --git a/src/affinder/_tests/test_affinder.py b/src/affinder/_tests/test_affinder.py index 3e042b0..bd7ab72 100644 --- a/src/affinder/_tests/test_affinder.py +++ b/src/affinder/_tests/test_affinder.py @@ -9,7 +9,6 @@ from scipy import ndimage as ndi from pathlib import Path - layer0_pts = np.array([[140.38371886, 322.5390704], [181.91866481, 319.65803368], [176.15659138, 259.1562627], @@ -165,7 +164,4 @@ def test_load_affine(tmp_path): widget = load_affine() widget(layer, affile) - np.testing.assert_allclose( - layer.affine, affine - ) - + np.testing.assert_allclose(layer.affine, affine) From 927b50f50b8ca3decef5c5f6c3afc196199133ed Mon Sep 17 00:00:00 2001 From: Andreas M Arnold Date: Tue, 28 Nov 2023 01:37:45 -0500 Subject: [PATCH 2/2] Fix metadata of new layer after applying transform (#87) The new layer was still being displayed with the moving layer's affine. Corrected this to the reference layer's affine to fix the display problem. I had some confusions getting my original apply_transform branch up to date. In the end I created a new branch for this ... --- src/affinder/apply_tf.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/affinder/apply_tf.py b/src/affinder/apply_tf.py index 3d4f3ad..0217efe 100644 --- a/src/affinder/apply_tf.py +++ b/src/affinder/apply_tf.py @@ -91,7 +91,7 @@ def apply_affine( layertype = 'image' ref_metadata = { n: getattr(reference_layer, n) - for n in ['scale', 'translate', 'rotate', 'shear'] + for n in ['scale', 'translate', 'rotate', 'shear', 'affine'] } mov_metadata = moving_layer.as_layer_data_tuple()[1] name = {'name': moving_layer.name + '_transformed'}