ANTsX / ANTsR

R interface to the ANTs biomedical image processing library
https://antsx.github.io/ANTsR
Apache License 2.0
127 stars 35 forks source link

antsMotionCalculation Error #375

Closed sromanz closed 1 year ago

sromanz commented 1 year ago

In the latest version of ANTsR I receive this error message when running the antsMotionCalculation command (see end of Bug Report).

A small time series (4D image) of dimensions (64,64,64,3) is used in the test. The goal is motion-correct each time point to the very first image. In previous versions of ANTsR (unfortunately I don't remember exactly the latest working version) this problem never appeared.

This is my current environment: platform x86_64-pc-linux-gnu arch x86_64 os linux-gnu system x86_64, linux-gnu status major 4 minor 2.2 year 2022 month 10 day 31 svn rev 83211 language R version.string R version 4.2.2 (2022-10-31) nickname Innocent and Trustin

ANTsR, ANTsRCore, and ITKR were installed through devtools.


test=antsMotionCalculation(re4d,mask=NA,fixed=ref_re,num_threads=8, moreaccurate = 1, txtype= "Rigid", verbose = TRUE ) verbose Registration using 1 total stages. nimagestoavg 3

Stage 1 fixed image: 0x55eca056bf10 moving image: 0x55eca70ded50 number of levels = 1 shrink factors per level: [1] smoothing sigmas per level: [0] smoothing sigmas in physical space units: 0 using fixed reference image for all frames use histogram matching 1 regular sampling (percentage = 0.25) using the Mattes MI metric. employing scales estimator

Running rigid registration 0

done resampling timepoint : 0 use histogram matching 1

Running rigid registration 1

done resampling timepoint : 1 use histogram matching 1

Running rigid registration 2

done resampling timepoint : 2 motion corrected out 0x55ecaa8e7790 i^th value 0 is -1.03679 i^th value 1 is -0.00267407 i^th value 2 is -0.00228088 write average post 0x55eca70eb030

Total elapsed time: 3.8172 averagemetric -0.347249 get motion corr params 0x55eca743f320 motion-correction params written STD ExceptionObject caught! Error in .antsMotionCorrStats(tsimg, mask, mocoparams, num_threads = num_threads, : Not an S4 object. In addition: Warning messages: 1: In missing(k) || is.na(k) : 'length(x) = 64 > 1' in coercion to 'logical(1)' 2: In missing(k) || is.na(k) : 'length(x) = 64 > 1' in coercion to 'logical(1)' 3: In missing(k) || is.na(k) : 'length(x) = 64 > 1' in coercion to 'logical(1)'

ArzuHas commented 1 year ago

Hi, I have a similar issue right now, such as

pcasl antsImage Pixel Type : float Components Per Pixel: 1 Dimensions : 128x128x32x20 Voxel Spacing : 1.875x1.875x4.5x4 Origin : -126.2133 120.9435 -28.66926 0 Direction : 0.9997505 0.0223372 -0.00016536 0 0.0223372 -0.9996409 0.01480313 0 -0.00016536 0.01480313 0.9998904 0 0 0 0 1 Filename : Ax_3DPASL(Eyes_Open)_ADNI3_Advance_11.nii.gz

antsMotionCalculation(pcasl) Error in missing(k) || is.na(k) : 'length = 32' in coercion to 'logical(1)'

Have you found a solution?