jonclayden/RNiftyReg

Segfault

Closed this issue · 1 comments

Just trying to register to PNGs/JPEGs, and getting a segfault. Here's a MWE:

library(RNiftyReg)
library(jpeg)
image <- readJPEG(system.file("extdata", "house_colour_large.jpg", package="RNiftyReg"))
image2 = image
devtools::session_info()
Session info ------------------------------------------------------------------
 setting  value                       
 version  R version 3.3.2 (2016-10-31)
 system   x86_64, darwin13.4.0        
 ui       X11                         
 language (EN)                        
 collate  en_US.UTF-8                 
 tz       America/New_York            
 date     2017-01-23                  

Packages ----------------------------------------------------------------------
 package   * version     date       source                            
 colorout  * 1.1-0       2015-04-20 Github (jalvesaq/colorout@1539f1f)
 devtools    1.12.0.9000 2016-12-08 Github (hadley/devtools@1ce84b0)  
 digest      0.6.11      2017-01-03 CRAN (R 3.3.2)                    
 jpeg      * 0.1-8       2014-01-23 CRAN (R 3.2.0)                    
 memoise     1.0.0       2016-01-29 CRAN (R 3.2.3)                    
 ore         1.5.0       2016-09-09 CRAN (R 3.3.0)                    
 pkgbuild    0.0.0.9000  2016-12-08 Github (r-pkgs/pkgbuild@65eace0)  
 pkgload     0.0.0.9000  2016-12-08 Github (r-pkgs/pkgload@def2b10)   
 Rcpp        0.12.8.2    2016-12-08 Github (RcppCore/Rcpp@8c7246e)    
 RNifti      0.3.0       2016-12-08 cran (@0.3.0)                     
 RNiftyReg * 2.4.1       2016-12-08 CRAN (R 3.3.2)                    
 withr       1.0.2       2016-06-20 CRAN (R 3.3.0)
reg = niftyreg(image, image2)
 *** caught segfault ***
address 0x0, cause 'unknown'

Traceback:
 1: .Call("regLinear", source, target, ifelse(scope == "affine",     1L, 0L), symmetric, nLevels, maxIterations, useBlockPercentage,     interpolation, sourceMask, targetMask, init, verbose, estimateOnly,     sequentialInit, internal, PACKAGE = "RNiftyReg")
 2: niftyreg.linear(source, target, scope, init, sourceMask, targetMask,     interpolation = interpolation, symmetric = symmetric, estimateOnly = estimateOnly,     sequentialInit = sequentialInit, internal = internal, ...)
 3: niftyreg(image, image2)

Possible actions:
1: abort (with core dump, if enabled)
2: normal R exit
3: exit R without saving workspace
4: exit R saving workspace

Thanks for the report. The issue is that RNiftyReg doesn't support RGB images, but neither does it catch them before passing them to the NiftyReg library, which results in a segfault. I'm working on a resolution, hopefully to support RGB(A) properly.