dorianps / LINDA

Lesion Identification with Neighborhood Data Analysis
Apache License 2.0
20 stars 4 forks source link

object of type 'S4' is not subsettable #33

Open pinilorenzo opened 2 years ago

pinilorenzo commented 2 years ago

Good morning,

I am testing LINDA for stroke lesion segmentation, but I have encountered the following error: Error in nnz[-temp] <- F : object of type 'S4' is not subsettable in the first prediction step, just after AffineTransform registration.

I was wondering whether this error might be linked with R version (I'm using R version 3.4.4 - 2018-03-15) or if it might be linked with some libraries I need to update/re-install. I saw a similar thread https://github.com/dorianps/LINDA/issues/28 but I still encounter this error after reinstalling.

Any suggestions? Best, Lorenzo

dorianps commented 2 years ago

Hi Lorenzo,

Honestly, I don't know where's it coming from, but I notice your R version is a bit old. ANTsR has kind of evolved without looking back. You can try to use 3.5+, or just get the docker container which is built every month. I can't promise the error will not be in the docker version, but it is unlikely.

https://hub.docker.com/r/dorianps/linda

P.s. I liked your review of fmri in Huntington disease from 2020. And I miss via Venezia a Padova :)

pinilorenzo commented 2 years ago

Hi Dorian,

Thanks a lot for your quick response. I will update R and I'll let you know if everything works.

P.s. Wow, I didn't know you was in Padova!! Thanks for reading my review, and congrats for this tool!

pinilorenzo commented 2 years ago

Hi Dorian,

I updated R version to 4.1.2.

This "object type error" occurs at line 156 of Linda_predict.R file: mmseg1<-suppressMessages( mrvnrfs.predict_chunks( rfm$rflist, list(features), predlabel.sub, rad=rad, multiResSchedule=mr, voxchunk=5000 ) )

I guess it might be a problem with some of my installed library. Since I'm not an R expert, I was wondering whether you might figure out where is the problem.

Thanks, Lorenzo

dorianps commented 2 years ago

I will test it later. Can you tell me how it works before the error shows? I am trying to understand if this is happening early (which might be a bug) or in the later iterations (which might indicate problems with registration or early failures propagated downstream). Can you post the messages you see in R?

And one more question: how big is the lesion you are trying to segment? LINDA does not work well with tiny lesions.

dorianps commented 2 years ago

@pinilorenzo I tested LINDA on two different systems, fresh/updated installs, and works fine on case c0005s0007t01 of tha ATLAS dataset. Thus, I think it might be your specific case or image that fails at some point early. It can be the initial skull stripping, or registration. A very large lesion that takes most of the hemisphere may also create a problem, but I doubt someone is alive with a stroke like that.

Here are the two systems I tested.

System 1, CentOS7, 32 CPU cores, LINDA finished in 18mins

> devtools::session_info()
Session info ---------------------------------------------------------------------------------------------------------
 setting  value                       
 version  R version 3.5.0 (2018-04-23)
 system   x86_64, linux-gnu           
 ui       RStudio (1.3.1093)          
 language (EN)                        
 collate  en_US.UTF-8                 
 tz       America/New_York            
 date     2022-01-29                  

Packages -------------------------------------------------------------------------------------------------------------
 package       * version   date       source                          
 ANTsR           0.5.7.5   2022-01-28 Github (ANTsX/ANTsR@ecfb0b3)    
 ANTsRCore       0.7.5     2022-01-28 Github (ANTsX/ANTsRCore@e0d1f23)
 base          * 3.5.0     2018-05-13 local                           
 BiocInstaller * 1.30.0    2022-01-28 Bioconductor                    
 cellranger      1.1.0     2016-07-27 CRAN (R 3.5.0)                  
 compiler        3.5.0     2018-05-13 local                           
 crayon          1.3.4     2017-09-16 cran (@1.3.4)                   
 datasets      * 3.5.0     2018-05-13 local                           
 devtools        1.13.5    2018-02-18 CRAN (R 3.5.0)                  
 digest          0.6.27    2020-10-24 cran (@0.6.27)                  
 dplyr           1.0.2     2020-08-18 cran (@1.0.2)                   
 ellipsis        0.3.1     2020-05-15 cran (@0.3.1)                   
 generics        0.1.0     2020-10-31 cran (@0.1.0)                   
 glue            1.4.2     2020-08-27 cran (@1.4.2)                   
 graphics      * 3.5.0     2018-05-13 local                           
 grDevices     * 3.5.0     2018-05-13 local                           
 grid            3.5.0     2018-05-13 local                           
 ITKR            0.5.3.3   2022-01-28 Github (adigherman/ITKR@186128b)
 knitr           1.20      2018-02-20 cran (@1.20)                    
 lattice         0.20-35   2017-03-25 CRAN (R 3.5.0)                  
 lifecycle       0.2.0     2020-03-06 CRAN (R 3.5.0)                  
 LINDA         * 0.5.1     2022-01-28 Github (dorianps/LINDA@3c92f92) 
 magrittr        2.0.2     2022-01-26 cran (@2.0.2)                   
 Matrix          1.2-14    2018-04-13 CRAN (R 3.5.0)                  
 memoise         1.1.0     2017-04-21 CRAN (R 3.5.0)                  
 methods       * 3.5.0     2018-05-13 local                           
 pillar          1.4.7     2020-11-20 cran (@1.4.7)                   
 pkgconfig       2.0.3     2019-09-22 cran (@2.0.3)                   
 purrr           0.3.4     2020-04-17 cran (@0.3.4)                   
 R6              2.5.0     2020-10-28 cran (@2.5.0)                   
 randomForest    4.6-14    2018-03-25 cran (@4.6-14)                  
 Rcpp            1.0.4.6   2020-04-09 cran (@1.0.4.6)                 
 RcppEigen       0.3.3.9.1 2020-12-17 cran (@0.3.3.9)                 
 readxl          1.3.1     2019-03-13 CRAN (R 3.5.0)                  
 rlang           0.4.10    2020-12-30 cran (@0.4.10)                  
 rstudioapi      0.10      2019-03-19 cran (@0.10)                    
 stats         * 3.5.0     2018-05-13 local                           
 tibble          3.0.4     2020-10-12 cran (@3.0.4)                   
 tidyr           1.0.2     2020-01-24 CRAN (R 3.5.0)                  
 tidyselect      1.1.0     2020-05-11 cran (@1.1.0)                   
 tools           3.5.0     2018-05-13 local                           
 utils         * 3.5.0     2018-05-13 local                           
 vctrs           0.3.6     2020-12-17 cran (@0.3.6)                   
 withr           2.1.2     2018-03-15 CRAN (R 3.5.0)        

System 2: Ubuntu 20.04, 4 CPU cores, LINDA finished in 49 mins,

─ Session info ───────────────────────────────────────────────────────────────────────────────────
 setting  value
 version  R version 3.6.3 (2020-02-29)
 os       Ubuntu 20.04.3 LTS
 system   x86_64, linux-gnu
 ui       RStudio
 language (EN)
 collate  C.UTF-8
 ctype    C.UTF-8
 tz       America/New_York
 date     2022-01-29
 rstudio  2021.09.2+382 Ghost Orchid (server)
 pandoc   NA

─ Packages ───────────────────────────────────────────────────────────────────────────────────────
 package      * version   date (UTC) lib source
 ANTsR          0.5.7.5   2022-01-29 [1] Github (ANTsX/ANTsR@ecfb0b3)
 ANTsRCore      0.7.5     2022-01-28 [1] Github (ANTsX/ANTsRCore@e0d1f23)
 brio           1.1.3     2021-11-30 [1] CRAN (R 3.6.3)
 cachem         1.0.6     2021-08-19 [1] CRAN (R 3.6.3)
 callr          3.7.0     2021-04-20 [1] CRAN (R 3.6.3)
 cli            3.1.1     2022-01-20 [1] CRAN (R 3.6.3)
 crayon         1.4.2     2021-10-29 [1] CRAN (R 3.6.3)
 curl           4.3.2     2021-06-23 [1] CRAN (R 3.6.3)
 desc           1.4.0     2021-09-28 [1] CRAN (R 3.6.3)
 devtools       2.4.3     2021-11-30 [1] CRAN (R 3.6.3)
 ellipsis       0.3.2     2021-04-29 [1] CRAN (R 3.6.3)
 fastmap        1.1.0     2021-01-25 [1] CRAN (R 3.6.3)
 fs             1.5.2     2021-12-08 [1] CRAN (R 3.6.3)
 glue           1.6.1     2022-01-22 [1] CRAN (R 3.6.3)
 ITKR           0.5.3.3   2022-01-28 [1] Github (adigherman/ITKR@186128b)
 lattice        0.20-40   2020-02-19 [4] CRAN (R 3.6.2)
 lifecycle      1.0.1     2021-09-24 [1] CRAN (R 3.6.3)
 LINDA        * 0.5.1     2022-01-29 [1] Github (dorianps/LINDA@3c92f92)
 magrittr       2.0.2     2022-01-26 [1] CRAN (R 3.6.3)
 Matrix         1.2-18    2019-11-27 [4] CRAN (R 3.6.1)
 memoise        2.0.1     2021-11-26 [1] CRAN (R 3.6.3)
 pkgbuild       1.3.1     2021-12-20 [1] CRAN (R 3.6.3)
 pkgload        1.2.4     2021-11-30 [1] CRAN (R 3.6.3)
 prettyunits    1.1.1     2020-01-24 [1] CRAN (R 3.6.3)
 processx       3.5.2     2021-04-30 [1] CRAN (R 3.6.3)
 ps             1.6.0     2021-02-28 [1] CRAN (R 3.6.3)
 purrr          0.3.4     2020-04-17 [1] CRAN (R 3.6.3)
 R6             2.5.1     2021-08-19 [1] CRAN (R 3.6.3)
 randomForest   4.6-14    2018-03-25 [1] CRAN (R 3.6.3)
 Rcpp           1.0.8     2022-01-13 [1] CRAN (R 3.6.3)
 RcppEigen      0.3.3.9.1 2020-12-17 [1] CRAN (R 3.6.3)
 remotes        2.4.2     2021-11-30 [1] CRAN (R 3.6.3)
 rlang          1.0.0     2022-01-26 [1] CRAN (R 3.6.3)
 rprojroot      2.0.2     2020-11-15 [1] CRAN (R 3.6.3)
 rstudioapi     0.13      2020-11-12 [1] CRAN (R 3.6.3)
 sessioninfo    1.2.2     2021-12-06 [1] CRAN (R 3.6.3)
 testthat       3.1.2     2022-01-20 [1] CRAN (R 3.6.3)
 usethis        2.1.5     2021-12-09 [1] CRAN (R 3.6.3)
 withr          2.4.3     2021-11-30 [1] CRAN (R 3.6.3)

 [1] /home/dp/R/x86_64-pc-linux-gnu-library/3.6
 [2] /usr/local/lib/R/site-library
 [3] /usr/lib/R/site-library
 [4] /usr/lib/R/library
dorianps commented 2 years ago

@pinilorenzo , when you find the culprit, feel free to post it here and close this issue. My suspicion is still the T1w image or type of lesion you have. Something has gone wrong with image registration or lesion prediction.

pinilorenzo commented 2 years ago

Yep, I will. In the next few days I will try with different images and I'll let you know. Thanks a lot for your support!