Skip to content

Commit

Permalink
Merge pull request #526 from ANTsX/new_transform_usage
Browse files Browse the repository at this point in the history
ENH: allow setting of fixed_parameters when creating a transform
  • Loading branch information
cookpa authored Jan 22, 2024
2 parents 1c3fd3d + 76d8a28 commit d50fa91
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions ants/core/ants_transform_io.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,17 @@


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 +46,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 +275,7 @@ def transform_to_displacement_field(xfrm, ref):
displacement field ANTsTransform
ref : ANTs Image
Returns
-------
ANTsVectorImage
Expand All @@ -285,7 +292,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 d50fa91

Please sign in to comment.