Skip to content

Commit

Permalink
for backward compatibility, add points as a named argument with def…
Browse files Browse the repository at this point in the history
…ault value None

to Affine.transform. Issue deprecated warning if it is not None.
  • Loading branch information
yhuang43 committed Feb 9, 2024
1 parent 53894ab commit 9cfee81
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion surfa/transform/affine.py
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ def __call__(self, *args, **kwargs):
"""
return self.transform(*args, **kwargs)

def transform(self, data, method='linear', rotation='corner', resample=True, fill=0):
def transform(self, data, method='linear', rotation='corner', resample=True, fill=0, points=None):
"""
Apply the affine transform matrix to the input data.
Expand All @@ -228,6 +228,12 @@ def transform(self, data, method='linear', rotation='corner', resample=True, fil
transformed : Volume
Transformed image if (input data is an image Volume)
"""
if points is not None:
data = points
warnings.warn('The \'points\' argument to transform() is deprecated. Just use '
'the first positional argument to specify set of points or an image to transform.',
DeprecationWarning, stacklevel=2)

# a common mistake is to use this function for transforming a mesh,
# so run this check to help the user out a bit
if ismesh(data):
Expand Down

0 comments on commit 9cfee81

Please sign in to comment.