Skip to content

Commit

Permalink
ENH: allow setting of fixed_parameters when creating a transform
Browse files Browse the repository at this point in the history
Also point users to create_transform method
  • Loading branch information
cookpa committed Jan 19, 2024
1 parent aa29ee8 commit 5d11e24
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions ants/core/ants_transform_io.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,16 @@


def new_ants_transform(
precision="float", dimension=3, transform_type="AffineTransform", parameters=None
precision="float", dimension=3, transform_type="AffineTransform", parameters=None, fixed_parameters=None
):
"""
Create a new ANTsTransform
ANTsR function: None
This is a simplified method for creating an ANTsTransform, mostly used internally.
See create_ants_transform for more options.
Example
-------
>>> import ants
Expand All @@ -42,6 +45,9 @@ def new_ants_transform(
if parameters is not None:
ants_tx.set_parameters(parameters)

if fixed_parameters is not None:
ants_tx.set_fixed_parameters(fixed_parameters)

return ants_tx


Expand Down Expand Up @@ -268,7 +274,7 @@ def transform_to_displacement_field(xfrm, ref):
displacement field ANTsTransform
ref : ANTs Image
Returns
-------
ANTsVectorImage
Expand All @@ -285,7 +291,7 @@ def transform_to_displacement_field(xfrm, ref):
>>> atx = ants.transform_from_displacement_field( vec )
>>> field = ants.transform_to_displacement_field( atx, fi )
"""

if not xfrm.type == 'DisplacementFieldTransform':
raise ValueError("Transform must be of DisplacementFieldTransform type")
libfn = utils.get_lib_fn("antsTransformToDisplacementFieldF%i" % xfrm.dimension)
Expand Down

0 comments on commit 5d11e24

Please sign in to comment.