Skip to content

Commit

Permalink
added function for generic 3D affine xform
Browse files Browse the repository at this point in the history
  • Loading branch information
seogier committed Aug 22, 2023
1 parent 9a492bb commit fd963f5
Showing 1 changed file with 3 additions and 10 deletions.
13 changes: 3 additions & 10 deletions ants/contrib/sampling/affine3d.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,16 +81,8 @@ def transform(self, X=None, y=None):
--------
>>> import ants
>>> img = ants.image_read(ants.get_data('ch2'))
>>> tx = ants.contrib.Translate3D(translation=(10,0,0))
>>> img2_x = tx.transform(img)# x axis stays same
>>> tx = ants.contrib.Translate3D(translation=(-10,0,0)) # other direction
>>> img2_x = tx.transform(img)# x axis stays same
>>> tx = ants.contrib.Translate3D(translation=(0,10,0))
>>> img2_y = tx.transform(img) # y axis stays same
>>> tx = ants.contrib.Translate3D(translation=(0,0,10))
>>> img2_z = tx.transform(img) # z axis stays same
>>> tx = ants.contrib.Translate3D(translation=(10,10,10))
>>> img2 = tx.transform(img)
>>> tx = ants.contrib.Affine3D(transformation=np.array([[1, 0, 0, dx], [0, 1, 0, dy],[0, 0, 1, dz]])
>>> img2_x = tx.transform(img)# image translated by (dx, dy, dz)
"""
# unpack

Expand All @@ -109,6 +101,7 @@ def transform(self, X=None, y=None):
self.tx.apply_to_image(y, reference=self.reference),
)


class Translate3D(object):
"""
Create an ANTs Affine Transform with a specified translation.
Expand Down

0 comments on commit fd963f5

Please sign in to comment.