Motion correction: improve output
See original GitHub issueIssue Description
Is your feature request related to a problem? Please describe.
Currently, ants.motion_correction
outputs motion_parameters
as a list of MAT files that are saved to a temporary folder. This makes it so that if the user wants to save these transformations (to my understanding), he has to move these outputs somewhere else, manually, and write a mapping.txt file that specifies which file belongs to each volume, given that names are random.
It’s also cumbersome to extract common motion parameter regressors from these MAT files from within python. My knowledge is that this requires calling in scipy or hdf5 to load the MAT files, extracting the affine from the dict, parsing it and storing the translation and rotation parameters manually. This also means that the end user has to know what the ANTs internal representation of an affine transformation looks like, which is well documented, but outside of ANTsPy.
Describe the solution you’d like
-
have the user be able to specify where to save the transformation matrices, and have their filenames sorted by index. This would ease storing files and allow easy identification of which affine belongs to which volume. If the folder already contains files with the same name, either throw an error before starting the motion correction, have a parameter to toggle overwrite (could default to True I guess), or add a suffix (the FSL solution).
-
output an extra
motion_parameter_estimates
np.array or dictionary containing translation and rotation estimates for better interop with other software packages.
Describe alternatives you’ve considered Open to suggestions.
Issue Analytics
- State:
- Created 4 years ago
- Reactions:1
- Comments:13 (12 by maintainers)
We have both a transform to point Operation and transform classes to do all of this in a ©lean way and consistently with other ants tools … under some of this: https://github.com/stnava/structuralFunctionalJointRegistration/blob/master/src/Default Mode Connectivity in ANTsPy.ipynb
@wangyibin0011 please open a different issue for this question