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

aslPerfusion #386

Closed ArzuHas closed 1 year ago

ArzuHas commented 1 year ago

Describe the bug I installed ANTsR package to perform asl image analysis. When I run "aslPerfusion()", I received following error:

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

I tried different version of the packages and update R, as well as different datasets. However, I got same error all the time. Can

Screen Shot 2023-05-16 at 9 34 36 PM

I am working on mac os system, the version of R is 4.3.0 and the version of ANTsR is 0.5.7.5

Could you please help me on this issue? Thanks, Arzu

Additional context Add any other context about the problem here.

stnava commented 1 year ago

are you able to run example data from here ?

I just ran:


aa=aslPerfusion( asl=img, moreaccurate=1, dorobust=0, mask=msk, N3=TRUE , verbose=TRUE )

without any issue and producing:

image

if you can share your data, we may be able to help more.

> sessionInfo()
R version 4.2.1 (2022-06-23)
Platform: aarch64-apple-darwin20 (64-bit)
Running under: macOS Ventura 13.0.1

Matrix products: default
BLAS:   /Library/Frameworks/R.framework/Versions/4.2-arm64/Resources/lib/libRblas.0.dylib
LAPACK: /Library/Frameworks/R.framework/Versions/4.2-arm64/Resources/lib/libRlapack.dylib

locale:
[1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
[1] robust_0.7-1    misc3d_0.9-1    pixmap_0.4-12   ANTsR_0.5.7.5  
[5] ANTsRCore_0.7.5

loaded via a namespace (and not attached):
 [1] Rcpp_1.0.10         mvtnorm_1.1-3       lattice_0.20-45    
 [4] rrcov_1.7-2         MASS_7.3-58.1       grid_4.2.1         
 [7] pcaPP_2.0-3         stats4_4.2.1        magrittr_2.0.3     
[10] robustbase_0.95-0   Matrix_1.5-3        ITKR_0.6.0.0.2     
[13] tools_4.2.1         RcppEigen_0.3.3.9.3 DEoptimR_1.0-11    
[16] fit.models_0.64     compiler_4.2.1      tcltk_4.2.1        
ArzuHas commented 1 year ago

Thank you very much for your response. It is same when I used the data and tried to update my version to match with yours. Please see the ASL and mask image that I am working on attached. Btw, here is my sessionInfo: Screen Shot 2023-05-17 at 3 20 25 PM ASL.nii.gz ASLvol0000_bet_mask.nii.gz

All the best, Arzu

stnava commented 1 year ago

could not reproduce the issue with the code below

fn='ASL.nii.gz'
img=antsImageRead(fn)
avg=getAverageOfTimeSeries(img)
msk=getMask(avg)
plot(ts(rowMeans(timeseries2matrix(img,msk))))
aa=aslPerfusion( asl=img, moreaccurate=1, dorobust=0, mask=msk, N3=TRUE , verbose=TRUE )

which produced:

image

no difference when using

msk=antsImageRead("ASLvol0000_bet_mask.nii.gz")

image

I do see warnings of this nature:

50: In missing(k) || is.na(k) : 'length(x) = 32 > 1' in coercion to 'logical(1)'

do you have warnings=errors turned on?

ArzuHas commented 1 year ago

Yes, I always see exactly same error.

image
ArzuHas commented 1 year ago

When I tried your code above, I got the same error in the stage of "getAverageOfTimeSeries(img)"

Screen Shot 2023-05-17 at 4 15 46 PM

stnava commented 1 year ago

do you have warnings=errors turned on?

try to set options(warn=0) or options(warn=1) in your R session

ArzuHas commented 1 year ago

Yes unfortunately, I see when I have errors turned on:

Screen Shot 2023-05-17 at 4 38 42 PM

stnava commented 1 year ago

this commit should address your issue https://github.com/ANTsX/ANTsR/commit/d2824a6f1ee0f4a7e3ba472772cd310ed1c78577

however, you will have to compile from source to get it

ArzuHas commented 1 year ago

It worked! I am grateful for your help!

Arzu

ArzuHas commented 1 year ago

Hi, Actually, it was a false alarm. Although it did not give an error for the first parts, I saw the same error after a while of processing of aslPerfusion command such as: Screen Shot 2023-05-17 at 5 58 41 PM

stnava commented 1 year ago

yes - there was another location with a similar issue.

should be fixed now.

if you see this come up again ( definitely possible ) please open a new issue.