Skip to content

Commit 85d03b4

Browse files
committed
fix: clarify what is a 3D transform chain and a 4D transform
3D transform chains resulting of composing several transformations (e.g., affine and deformation fields in spatial normalization) should not be split into its components. This is in contrast to lists of 3D transforms such as head-motion correcting affines, where each applies to one timepoint. These should be considered 4D and in some future they may integrate slice timing correction in them.
1 parent 0153472 commit 85d03b4

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

nitransforms/resampling.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -98,9 +98,10 @@ def apply(
9898
# Avoid opening the data array just yet
9999
input_dtype = get_obj_dtype(spatialimage.dataobj)
100100

101-
# Number of transformations
101+
# Number of data volumes
102102
data_nvols = 1 if spatialimage.ndim < 4 else spatialimage.shape[-1]
103-
xfm_nvols = len(transform)
103+
# Number of transforms: transforms chains (e.g., affine + field, are a single transform)
104+
xfm_nvols = 1 if transform.ndim < 4 else len(transform)
104105

105106
if data_nvols != xfm_nvols and min(data_nvols, xfm_nvols) > 1:
106107
raise ValueError(

0 commit comments

Comments
 (0)