From 344b1ce4b53566e2466f5d532804349d470aef87 Mon Sep 17 00:00:00 2001 From: Chris Markiewicz Date: Fri, 20 Sep 2024 21:45:54 -0400 Subject: [PATCH 1/3] TEST: Verify that adding Transform arrays to a chain does not explode --- nitransforms/tests/test_linear.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/nitransforms/tests/test_linear.py b/nitransforms/tests/test_linear.py index 969b33ab..31627159 100644 --- a/nitransforms/tests/test_linear.py +++ b/nitransforms/tests/test_linear.py @@ -82,6 +82,20 @@ def test_loadsave_itk(tmp_path, data_path, testdata_path): ) +def test_mapping_chain(data_path): + xfm = nitl.load(data_path / "itktflist2.tfm", fmt="itk") + xfm = nitl.load(data_path / "itktflist2.tfm", fmt="itk") + assert len(xfm) == 9 + + # Addiition produces a chain + chain = xfm + xfm + # Length now means number of transforms, not number of affines in one transform + assert len(chain) == 2 + # Just because a LinearTransformsMapping is iterable does not mean we decompose it + chain += xfm + assert len(chain) == 3 + + @pytest.mark.parametrize( "image_orientation", [ From 7bc22c58c3bd8e319dccab53d187c832a680f236 Mon Sep 17 00:00:00 2001 From: Chris Markiewicz Date: Fri, 20 Sep 2024 21:47:34 -0400 Subject: [PATCH 2/3] FIX: Do not decompose LinearTransformsMappings when adding to a TransformChain --- nitransforms/manip.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/nitransforms/manip.py b/nitransforms/manip.py index b30fd646..9389197d 100644 --- a/nitransforms/manip.py +++ b/nitransforms/manip.py @@ -213,6 +213,8 @@ def _as_chain(x): """Convert a value into a transform chain.""" if isinstance(x, TransformChain): return x.transforms + if isinstance(x, TransformBase): + return [x] if isinstance(x, Iterable): return list(x) return [x] From e7757e2ecaa1fa1cd781c32d6a34a0b80684dfd7 Mon Sep 17 00:00:00 2001 From: Chris Markiewicz Date: Sat, 21 Sep 2024 09:31:11 -0400 Subject: [PATCH 3/3] rel(24.0.2): Update changes [skip ci] --- CHANGES.rst | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/CHANGES.rst b/CHANGES.rst index 7aa56a65..095c030a 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -1,3 +1,14 @@ +24.0.2 (September 21, 2024) +=========================== +Bug-fix release in the 24.0.x series. + +CHANGES +------- + +* FIX: Add per-volume transforms as single transform in chain by @effigies in https://github.com/nipy/nitransforms/pull/226 + +**Full Changelog**: https://github.com/nipy/nitransforms/compare/24.0.1...24.0.2 + 24.0.1 (September 17, 2024) =========================== Bug-fix release in the 24.0.x series.