Closed TeddyTuresky closed 5 months ago
Hello Teddy! I think you are doing everything correctly. I have noticed that the ItkMap does not work for all ANTs transforms, and I have been meaning to fix it. My guess is this code (lines 263 and on) needs to be changed for your specific h5 file: https://github.com/yeatmanlab/pyAFQ/blob/7bf8b2527441262aee4b26a7eeac6798a021c9b2/AFQ/definitions/mapping.py#L263
I am going to try switching over to using read_transform
and transform_to_displacement_field
from ANTsPy ( https://github.com/ANTsX/ANTsPy ). I will bump this to the top of my TODO list and let you know when this is done, so you can try it out for your case. Thank you for your patience!
Thank you, John! Much appreciated. And please let me know if you need/want me to test anything on my end in the interim. t
Sorry for the late update, I couldnt figure out how to get this to work so I ended up removing support for ITK files. It seems to work with old qsiprep versions (when I first wrote the code) but not the new ones.
The default pyAFQ behavior is to just find a new mapping using SyN. This can take like 20 minutes to run per subject, which can be a pain. However, it should work, we use it all the time for neonatal template! Let me know if you have any further questions.
Good to know! Thank you, John.
Hello,
Many thanks for putting out this wonderful toolkit. I was hoping to modify the default GroupAFQ object to incorporate transforms from ANTs. My understanding (which may be wrong) from looking through the mapping.py code is that pyAFQ will look for a composite transform *.h5 file, so I used an antsRegistration call to generate an inverse composite transform for mapping an individual participant b0 to the UNC neonate template (infant study).
[ Side note, I'm not sure if it's a problem with the h5py library or something else, but the h5 file keys ended up with misspellings; e.g., please see "Transform" versus "Tranform" below:
The most expedient solution seemed to be to change the mapping.py code, but maybe I should reach out to the h5py folks at some point...? ]
I then tried to incorporate the transform into the GroupAFQ object...
itk_map = ItkMap( warp_suffix="xfm", warp_filters={"scope": "ants"}) # derivatives folder name containing transform
my_afq = GroupAFQ( mapping_definition=itk_map,