Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ENH: allow setting of fixed_parameters when creating a transform #526

Merged
merged 2 commits into from
Jan 22, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading