Skip to content

Commit

Permalink
BUG: First set fixed parameters then parameters
Browse files Browse the repository at this point in the history
First fixed parameters should be set and then parameters as
based on fixed parameters additional calculations are done.
  • Loading branch information
PranjalSahu authored and hjmjohnson committed May 4, 2022
1 parent 963d0a8 commit 3e6352c
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions Wrapping/Generators/Python/itk/support/extras.py
Original file line number Diff line number Diff line change
Expand Up @@ -1083,17 +1083,18 @@ def transform_from_dict(transform_dict: Dict)-> "itkt.TransformBase":
import itk

def set_parameters(transform, transform_parameters, transform_fixed_parameters):
o1 = transform.GetParameters()
o1.SetSize(transform_parameters.shape[0])
for j, v in enumerate(transform_parameters):
# First set fixed parameters then parameters
o1 = transform.GetFixedParameters()
o1.SetSize(transform_fixed_parameters.shape[0])
for j, v in enumerate(transform_fixed_parameters):
o1.SetElement(j, v)
transform.SetParameters(o1)
transform.SetFixedParameters(o1)

o2 = transform.GetFixedParameters()
o2.SetSize(transform_fixed_parameters.shape[0])
for j, v in enumerate(transform_fixed_parameters):
o2 = transform.GetParameters()
o2.SetSize(transform_parameters.shape[0])
for j, v in enumerate(transform_parameters):
o2.SetElement(j, v)
transform.SetFixedParameters(o2)
transform.SetParameters(o2)


# For checking transforms which don't take additional parameters while instantiation
Expand Down

0 comments on commit 3e6352c

Please sign in to comment.