Skip to content

Commit

Permalink
enh: one less iterated operation (transpose)
Browse files Browse the repository at this point in the history
  • Loading branch information
oesteban authored Nov 16, 2023
1 parent 3ec84d2 commit 8b21efa
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions nitransforms/linear.py
Original file line number Diff line number Diff line change
Expand Up @@ -458,7 +458,7 @@ def apply(
output_dtype = output_dtype or input_dtype

# Prepare physical coordinates of input (grid, points)
xcoords = _ref.ndcoords.astype("f4")
xcoords = _ref.ndcoords.astype("f4").T

# Invert target's (moving) affine once
ras2vox = ~Affine(spatialimage.affine)
Expand All @@ -483,7 +483,7 @@ def apply(

for t, xfm_t in enumerate(self):
# Map the input coordinates on to timepoint t of the target (moving)
ycoords = xfm_t.map(xcoords.T)[..., : _ref.ndim]
ycoords = xfm_t.map(xcoords)[..., : _ref.ndim]

# Calculate corresponding voxel coordinates
yvoxels = ras2vox.map(ycoords)[..., : _ref.ndim]
Expand Down

0 comments on commit 8b21efa

Please sign in to comment.