Skip to content
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

antsMotionCorr --write-displacement no output #1797

Closed
toomanycats opened this issue Sep 25, 2024 · 9 comments
Closed

antsMotionCorr --write-displacement no output #1797

toomanycats opened this issue Sep 25, 2024 · 9 comments

Comments

@toomanycats
Copy link

Operating system and version

CentOS 7

CPU architecture

x86_64 (PC, Intel Mac, other Intel/AMD)

ANTs code version

ants-2.5.0

ANTs installation type

Compiled from source

Summary of the problem

When I use antsMotionCorr with the --write-displacements options I see no displacement output.

The input 4D NiFTI is a PET series.

Commands to reproduce the problem.

antsMotionCorr --write-displacement -m CC -d 3 -o ".nii.gz" -p Linear -t Rigid -o ave.nii.gz -a PET_4frames.nii.gz

Output of the command with verbose output.

ANTSVERSION=ants-2.5.0

ls
ave.nii.gz

Data to reproduce the problem

BRAIN_AC_ADNIrecon_2024.02.21.nii.gz

@cookpa
Copy link
Member

cookpa commented Sep 26, 2024

I think it is --write-displacement 1. I will update the usage

@toomanycats
Copy link
Author

toomanycats commented Sep 26, 2024

I forgot to add that I already tried adding an explicit "true":

antsMotionCorr -v --write-displacement 1 -d 3 -p Linear -t Rigid -o ave.nii.gz -a ../Sample/ADNIDII-0-3028-1/BRAIN_AC_ADNIrecon_2024.02.21.nii.gz
ANTSVERSION=ants-2.5.0
verbose
average out ave.nii.gz

Still no love. I keep thinking I'm missing something obvious that I'm not seeing in my call.
Confirming there's really multiple frames:

fslinfo ../Sample/ADNIDII-0-3028-1/BRAIN_AC_ADNIrecon_2024.02.21.nii.gz | grep -P '^dim4'
dim4            6

@cookpa
Copy link
Member

cookpa commented Sep 26, 2024

You need to do it in two stages:

antsMotionCorr -d 3 -a BRAIN_AC_ADNIrecon_2024.02.21.nii.gz -o ave.nii.gz

Then

antsMotionCorr -d 3 -o [ moco, moco_corrected.nii.gz, moco_avg.nii.gz ] \
    -v 1 --write-displacement 1  -p Linear -t Rigid[ 0.05 ] \
    -m MI[ ave.nii.gz , BRAIN_AC_ADNIrecon_2024.02.21.nii.gz, 1, 32 ] \
    -i 10x10 -f 2x1 -s 1x0

@toomanycats
Copy link
Author

toomanycats commented Sep 26, 2024

Ok thanks ! Perhaps the doc needs an example.
I'm not a skilled C++ programmer, but I find this program difficult to read. There's a lot of procedural code here:

ANTs::WriteImage<DisplacementIOFieldType>(displacementinv, dfn.c_str());

@toomanycats
Copy link
Author

If want motion estimates, should I also use antsMotionCorrStats ?
I was going to compute the rigid motion myself using python.

Cheers and thanks again.

@cookpa
Copy link
Member

cookpa commented Sep 26, 2024

Yes antsMotionCorrStats, but that only works with the CSV parameter file. It doesn't work for warp fields.

@cookpa
Copy link
Member

cookpa commented Sep 26, 2024

Examples in the usage would be good.

There are some examples in the README.md on the main page, and others in the wiki.

@toomanycats
Copy link
Author

I'm beginning to understand the arguments now ! Cheers.

@toomanycats
Copy link
Author

The examples in Examples/Scripts solved my misunderstanding. Thank you for your help.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants