-
-
Notifications
You must be signed in to change notification settings - Fork 663
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
BUG: Make dict_from_transform more consistent with other dict representations #4635
BUG: Make dict_from_transform more consistent with other dict representations #4635
Conversation
Is it possible to share a sample json output (dict representation for a transform) for a single and composite transform? Something similar to #3470 |
I only have a question regarding the need to support a list of transforms in the dict_from_transform method. Since it already handles multiple transform use cases under the CompositeTransform Object. Also supporting a list of transforms will make this different compared to Image and Mesh methods which only work on one Image/Mesh Object. |
Yes, added to the PR description and commit. |
Yes, it is a bit different from Image/Mesh since we have a chain of transforms. Support for this use case came up in the test for working with the result of
I added docstrings to help clarify. |
5bb32f4
to
cc16148
Compare
…ntations Encapsulate the "transformParameterization", "parametersValueType", "inputDimension", "outputDimension", which are static, into a "transformType" member, similar to "imageType", "meshType" for Images, Meshes. "transformParameterization" is the string name of the ITK transform class, less the trailing "Transform". Example serializations: Translation: ```py { 'transformType': {'transformParameterization': 'Translation', 'parametersValueType': 'float64', 'inputDimension': 3, 'outputDimension': 3}, 'name': '', 'inputSpaceName': '', 'outputSpaceName': '', 'parameters': array([3., 2., 8.]), 'fixedParameters': array([], dtype=float64), 'numberOfParameters': 3, 'numberOfFixedParameters': 0 } ``` Composite: ```py [ { 'transformType': {'transformParameterization': 'Translation', 'parametersValueType': 'float64', 'inputDimension': 3, 'outputDimension': 3}, 'name': '', 'inputSpaceName': '', 'outputSpaceName': '', 'parameters': array([3., 2., 8.]), 'fixedParameters': array([], dtype=float64), 'numberOfParameters': 3, 'numberOfFixedParameters': 0 }, { 'transformType': {'transformParameterization': 'Affine', 'parametersValueType': 'float64', 'inputDimension': 3, 'outputDimension': 3}, 'name': '', 'inputSpaceName': '', 'outputSpaceName': '', 'parameters': array([ 0.6563149 , 0.58065837, -0.48175367, -0.74079868, 0.37486398, -0.55739959, -0.14306664, 0.72271215, 0.67617978, -66. , 69. , 32. ]), 'fixedParameters': array([0., 0., 0.]), 'numberOfParameters': 12, 'numberOfFixedParameters': 3 } ] ``` Remove unused numpy import in __setstate__. Support both a list of transforms and a single transform in dict_from_transform. Add more smoke tests in extras.py.
cc16148
to
5397f81
Compare
LGTM |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Encapsulate the "transformParameterization", "parametersValueType",
"inputDimension", "outputDimension", which are static, into a
"transformType" member, similar to "imageType", "meshType" for Images,
Meshes. "transformParameterization" is the string name of the ITK transform
class, less the trailing "Transform".
Example serialization:
Remove unused numpy import in setstate.
Support both a list of transforms and a single transform in
dict_from_transform.
Add more smoke tests in extras.py.