Open gdevenyi opened 7 years ago
Same problem here https://github.com/ANTsX/ANTs/issues/700
I am looking for a solution to the same problem. I have high spatial resolution MR BOLD data and wish to interpolate as little as possible. Ideally, the antsApplyTransforms function would also accept the 'MOCO_params.csv' file generated by antsMotionCorr.
Additionally, the example mentioned in the first post doesn't seem to be adjusting the original BOLD timeseries as the comments say happens. Am I missing something? Is this currently the only way to apply motion and registration transforms simultaneously? Thanks for your time!
for the most part, we use ANTsR or ANTsPy for such things as they both allow easy split/combine functionality which will let you perform whatever transformation combination(s) that you want.
brian
On Fri, Mar 8, 2019 at 11:53 AM wschelle notifications@github.com wrote:
I am looking for a solution to the same problem. I have high spatial resolution MR BOLD data and wish to interpolate as little as possible. Ideally, the antsApplyTransforms function would also accept the 'MOCO_params.csv' file generated by antsMotionCorr.
Additionally, the example mentioned in the first post doesn't seem to be adjusting the original BOLD timeseries as the comments say happens. Am I missing something? Is this currently the only way to apply motion and registration transforms simultaneously? Thanks for time!
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/ANTsX/ANTs/issues/465#issuecomment-470997835, or mute the thread https://github.com/notifications/unsubscribe-auth/AATyfup91AcP0BrbEZQB9e4dqQMXbXERks5vUpV8gaJpZM4OP6cM .
Hey! I successfully used the antsRegistrationSyNQuick on mean EPI image to get the files for antsApplyTransforms for high resolution fMRI BOLD data. I'm having trouble getting through the antsApplyTransform. Using a 4D file as input gave an error segmentation fault (core dumped).
I'm using ANTs on windows platform via Ubuntu 16.04. Anyway to get it done on this ubuntu subsystem
Thanks, R
@renilmathew you can open your own issue to ask about this, please include a reproducible example if possible but if you can't share the data, at least the full ANTs version information and the commands you ran plus their terminal output.
@renilmathew you can open your own issue to ask about this, please include a reproducible example if possible but if you can't share the data, at least the full ANTs version information and the commands you ran plus their terminal output.
Sure!
I was looking for the requested feature as well. I came up with this wrapper function based on the split/merge suggestion mentioned above. Here's the code, in the hope that it may be useful (note that I use some of the FSL tools for split/merge for lack of knowledge about their ANTs equivalents):
#!/usr/bin/bash
# concat_moco_affine.sh
# Safety precautions
# Using a variable that is not set will raise an error
set -o nounset
# Exit if a command fails.
set -o errexit
function echo_help {
echo "Humane wrapper to concatenate ANTs moco transforms with a generic affine"
echo "Usage: concat_moco_affine.sh input.nii.gz warp.nii.gz affine.mat reference.nii.gz"
echo "Concatanates and applies motion correction and affine in a single step."
}
if (($# < 1))
then
echo_help
exit 0
fi
fmri=$1
mocowarp=$2
affine=$3
ref=$4
tr=$(PrintHeader $fmri | grep "Voxel Spac" | cut -d ',' -f 4 | cut -d ']' -f 1)
nvols="$(($(fslnvols $fmri)-1))"
tmpfmri=$(mktemp -d)
fslsplit $fmri ${tmpfmri}/ -t
tmpwarp=$(mktemp -d)
fslsplit $mocowarp ${tmpwarp}/ -t
tmpout=$(mktemp -d)
parallel -j 4 antsApplyTransforms -d 3 -r $ref \
-o $tmpout/{1}.nii.gz -n LanczosWindowedSinc -i $tmpfmri/{1}.nii.gz \
-t $tmpwarp/{1}.nii.gz -t $affine -v 1 ::: $(seq -f "%04g" $nvols)
fslmerge -tr ${fmri/.nii.gz/space-fov.nii.gz} ${tmpout}/* $tr
exit 0
The alternative would be probably from ImageMath:
TimeSeriesDisassemble : Outputs n 3D image volumes for each time-point in time-series 4D image.
Usage : TimeSeriesDisassemble 4D_TimeSeries.nii.gz
TimeSeriesAssemble : Outputs a 4D time-series image from a list of 3D volumes.
Usage : TimeSeriesAssemble time_spacing time_origin *images.nii.gz
Taking a look at https://stnava.github.io/fMRIANTs/ it seems if one wants to combine the motion correction resampling step along with a coregistration and template build transform than a number of very large 4D warp files need to be generated and applied.
If I'm willing to use the output timeseries of antsMotionCorr instead, I can apply my transforms with
antsApplyTransforms -d 3 -e 3
.It comes to mind that antsApplyTransforms might be able to handle the 4D warp field for the "-e 3" case internally, avoiding these issues.
I'm not sure how hard it would be to get working but it would be a huge improvement to the workflow for timeseries data.