Closed devDonnn closed 6 months ago
We won’t change the interface but but you can pass in the warp image itself for the domain.
On Fri, Jun 9, 2023 at 7:01 AM Don @.***> wrote:
Hi, ANTsPy create_jacobian_determinant_image(domain_image, tx, do_log=False, geom=False) function requires a domain image. However, ANTs command line tool CreateJacobianDeterminantImage does not require the domain image and is able to compute the jacobian using the provided warp image only. Can the create_jacobian_determinant_image function be made without requiring a domain image so the necessary info is retrieved from the warp image? The domain image appears to be redundant.
— Reply to this email directly, view it on GitHub https://github.com/ANTsX/ANTsPy/issues/472, or unsubscribe https://github.com/notifications/unsubscribe-auth/AACPE7VTNEGNBTQEOOYKUGDXKL7A7ANCNFSM6AAAAAAZAPWDWI . You are receiving this because you are subscribed to this thread.Message ID: @.***>
Attempting to use the warp as the domain image fails for me because it attempts to clone as double, but double is not supported for multi-channel images.
This also prevents warps written from CLI antsRegistration
using default params. Could I fix this by adding double types here?
yes - I think that would work
OK cool. I think it would be nice to be able to read warps from ANTs into ANTsPy.
For the Jacobian use case, the image would additionally need to be split into components, so that a single-component image can be passed to the library function to store the result.
I think there must be some confusion here .... we can already read warps:
>>> i1=ants.image_read(ants.get_data("r16"))
>>> i2=ants.image_read(ants.get_data("r64"))
>>> reg=ants.registration(i1,i2,'SyN')
>>> ants.image_read( reg['fwdtransforms'][0] )
ANTsImage
Pixel Type : float (float32)
Components : 2
Dimensions : (256, 256)
Spacing : (1.0, 1.0)
Origin : (0.0, 0.0)
Direction : [1. 0. 0. 1.]
this is how one would do it
dimg=ants.image_read( reg['fwdtransforms'][0] ).split_channels()[0]
ants.create_jacobian_determinant_image( dimg, reg['fwdtransforms'][0] )
this is how one would do it
dimg=ants.image_read( reg['fwdtransforms'][0] ).split_channels()[0] ants.create_jacobian_determinant_image( dimg, reg['fwdtransforms'][0] )
Thanks, @stnava. This works well.
I guess I took the earlier comment too literally, you can't use the warp field itself as a domain image. This fails
warp = ants.image_read(mytx['fwdtransforms'][0])
jac = ants.create_jacobian_determinant_image(warp, warp)
But you can split it yourself and use the first channel. I'll update the docs to make note of this
Hi, ANTsPy
create_jacobian_determinant_image(domain_image, tx, do_log=False, geom=False)
function requires a domain image. However, ANTs command line toolCreateJacobianDeterminantImage
does not require the domain image and is able to compute the jacobian using the provided warp image only. Can thecreate_jacobian_determinant_image
function be made without requiring a domain image so the necessary info is retrieved from the warp image? The domain image appears to be redundant.