-
-
Notifications
You must be signed in to change notification settings - Fork 381
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
Refactor antsTransformInfo to add some error handling and compute determinant #1712
Conversation
Once the transform is read, I think you can call |
The program as written is not restricted to affine transforms, it will read any supported transform file. Assuming affine transforms would actually restrict its functionality. Maybe the determinant computation would be better added to iMath or something? |
Can you give an example? I tried this on Warpfields and it falls over, I don't know of any other transform types which couldn't be cast to an affine... |
If you run |
2df3bf1
to
d259597
Compare
Got it. Looks like I need to read all transforms as composite transforms and then figure out how to unpack it back into a list and loop over the unpacked components, checking the type. |
From the discourse, seems like dynamic casting to MatrixOffsetTransformBase would be sufficient. If that's not null, you can call GetMatrix() on the result |
b8e9b5d
to
9d1a989
Compare
This now will unpack transform lists as well as CompositeTransforms and print the determinant in addition to the PrintSelf for every transform in the whole stack. |
9d1a989
to
2975216
Compare
Thanks - I'm going to be out of the office, so might be some time before I get to this |
Context of this work is I use affine determinants in steps of And currently I have to do this by using antsApplyTransforms to produce a warp field from the affine and then a Jacobian file from that. This will allow me to just compute the the jacobian determinant with antsTransformInfo and extract it from the text output. |
I didn't verify the determinant values but it appears to work with the supported transform types |
Thanks for this @gdevenyi |
I have tested the output values using MINC affine transforms, where the I can generate arbitrary transforms with |
I'd like to be able to easily extract the determinant of affine transforms and antsTransformInfo seems like the right place.
The function has been refactored to handle reading errors.
Based primarily off
https://github.com/InsightSoftwareConsortium/ITK/blob/master/Examples/IO/TransformReadWrite.cxx
Things that aren't done: