Error while registering
ReddyRaveen opened this issue · 21 comments
@jonclayden , Hope you can help me out with this small issue.
I installed the latest versionon R Studio.
I gcan read images (both nifty and jpg), however, the moment I use methods to register, I get a variety of errors.
For the code;
source <- readNifti(system.file("extdata", "epi_t2.nii.gz", package="RNiftyReg"))
target <- readNifti(system.file("extdata", "flash_t1.nii.gz", package="RNiftyReg"))
result <- niftyreg(source, target)
These are the errors;
Error in niftyreg.linear(source, target, scope, init, sourceMask, targetMask, : Source image should have 2, 3 or 4 dimensions
Hi! Does this occur in a session with just RNiftyReg
loaded, or do you have a more complex environment running? Could you paste the result of sessionInfo()
, please?
Same problem when trying to apply a transformation, here's my code and session info. I was just running one of the examples
require(RNiftyReg)
require(jpeg)
require(mmand)
house <- readJPEG(system.file("extdata", "house_colour_large.jpg", package="RNiftyReg"))
house_bw <- apply(house, 1:2, mean)
affine <- buildAffine(skews=0.1, source=house)
house_skewed <- applyTransform(affine, house)
Error in niftyreg.linear(x, target, "affine", init = transform, nLevels = 0L, :
Source image should have 2, 3 or 4 dimensions
sessionInfo()
R version 3.6.0 (2019-04-26)
Platform: x86_64-apple-darwin15.6.0 (64-bit)
Running under: macOS Mojave 10.14.6
Matrix products: default
BLAS: /System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/libBLAS.dylib
LAPACK: /Library/Frameworks/R.framework/Versions/3.6/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] mmand_1.6.1 jpeg_0.1-8.1 RNiftyReg_2.6.8
loaded via a namespace (and not attached):
[1] compiler_3.6.0 tools_3.6.0 ore_1.6.3 Rcpp_1.0.1 splines_3.6.0 RNifti_1.2.2
Also tried on a more recent R version (4.0.2) in a Windows environment, same error even when trying @ReddyRaveen 's example.
This is quite strange. The only thing I can think of is that it might be related to the recent updates to RNifti
, but the code works for me locally (on Catalina) and the tests pass on CRAN macOS. This kind of error from a basic operation would make them fail.
Do you install packages from source or from binaries (getOption("pkgType")
)? Have you installed RNiftyReg
and/or RNifti
for the first time in the last couple of weeks?
I downloaded and installed the package and all related packages today for the first time from CRAN
Thanks. And from source or binaries?
Yes sorry forgot to say, binary
This is what happens if I try to install from source, I guess I am having troubles with devtools..
install.packages("RNiftyReg", type = "source")
trying URL 'https://cran.rstudio.com/src/contrib/RNiftyReg_2.6.8.tar.gz'
Content type 'application/x-gzip' length 3927800 bytes (3.7 MB)
==================================================
downloaded 3.7 MB
- installing source package ‘RNiftyReg’ ...
** package ‘RNiftyReg’ successfully unpacked and MD5 sums checked
** using staged installation
xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools), missing xcrun at: /Library/Developer/CommandLineTools/usr/bin/xcrun
xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools), missing xcrun at: /Library/Developer/CommandLineTools/usr/bin/xcrun
xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools), missing xcrun at: /Library/Developer/CommandLineTools/usr/bin/xcrun
xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools), missing xcrun at: /Library/Developer/CommandLineTools/usr/bin/xcrun
xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools), missing xcrun at: /Library/Developer/CommandLineTools/usr/bin/xcrun
xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools), missing xcrun at: /Library/Developer/CommandLineTools/usr/bin/xcrun
xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools), missing xcrun at: /Library/Developer/CommandLineTools/usr/bin/xcrun
xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools), missing xcrun at: /Library/Developer/CommandLineTools/usr/bin/xcrun
xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools), missing xcrun at: /Library/Developer/CommandLineTools/usr/bin/xcrun
xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools), missing xcrun at: /Library/Developer/CommandLineTools/usr/bin/xcrun
xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools), missing xcrun at: /Library/Developer/CommandLineTools/usr/bin/xcrun
xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools), missing xcrun at: /Library/Developer/CommandLineTools/usr/bin/xcrun
xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools), missing xcrun at: /Library/Developer/CommandLineTools/usr/bin/xcrun
xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools), missing xcrun at: /Library/Developer/CommandLineTools/usr/bin/xcrun
xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools), missing xcrun at: /Library/Developer/CommandLineTools/usr/bin/xcrun
xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools), missing xcrun at: /Library/Developer/CommandLineTools/usr/bin/xcrun
xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools), missing xcrun at: /Library/Developer/CommandLineTools/usr/bin/xcrun
xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools), missing xcrun at: /Library/Developer/CommandLineTools/usr/bin/xcrun
xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools), missing xcrun at: /Library/Developer/CommandLineTools/usr/bin/xcrun
xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools), missing xcrun at: /Library/Developer/CommandLineTools/usr/bin/xcrun
xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools), missing xcrun at: /Library/Developer/CommandLineTools/usr/bin/xcrun
xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools), missing xcrun at: /Library/Developer/CommandLineTools/usr/bin/xcrun
xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools), missing xcrun at: /Library/Developer/CommandLineTools/usr/bin/xcrun
xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools), missing xcrun at: /Library/Developer/CommandLineTools/usr/bin/xcrun
checking for g++... g++
checking whether the C++ compiler works... no
configure: error: in/private/var/folders/bf/9s2jb5vj4wjg2gql4mjjx8sh0000gn/T/RtmpJLD0IM/R.INSTALL457230750a99/RNiftyReg': configure: error: C++ compiler cannot create executables See
config.log' for more details
ERROR: configuration failed for package ‘RNiftyReg’ - removing ‘/Library/Frameworks/R.framework/Versions/3.6/Resources/library/RNiftyReg’
- restoring previous ‘/Library/Frameworks/R.framework/Versions/3.6/Resources/library/RNiftyReg’
Warning in install.packages :
installation of package ‘RNiftyReg’ had non-zero exit status
The downloaded source packages are in
‘/private/var/folders/bf/9s2jb5vj4wjg2gql4mjjx8sh0000gn/T/RtmprjppTz/downloaded_packages’
Yes, you're missing the Xcode command-line tools, which are needed to build from source on macOS.
I suspect that this problem may be because CRAN's currently taking a while to update binaries following package updates, and therefore the RNiftyReg
binary is out of step with the recently-updated RNifti
(which it links against). If installing from source is impractical, I would suggest waiting a few days for CRAN to catch up. Apologies for the inconvenience – I think this is just a question of unfortunate timing.
That was it! Got the Xcode command-line tools and installed from source, the error is gone. Thanks!
I'm seeing the same issues here too, locally on an Archlinux install with RNiftyReg
v2.6.8, RNifti
v1.2.2. Also repeated on github actions for all windows machines with RNifti
v1.2.2 and RNiftyReg
v2.6.8, although not linux machines, even though package versions are the same. The problem also arose with RNifti
v1.2.1, so that update is not the cause.
@mpadge OK, apologies. On your Linux machine, could you try reinstalling RNiftyReg
from source (the released v2.6.8 is fine), and checking if the issue persists, please?
I think what's happening is that CRAN doesn't rebuild binary packages when LinkingTo
dependencies change, so the recent RNifti
update is not consistent with existing RNiftyReg
builds, leading to an incompatibility between the two packages. I will try and get an update to RNiftyReg
pushed to CRAN today, which should trigger rebuilds to get things working again. Sorry for the inconvenience.
Sweeeet, it worked a treat! Much indebted for your wisdom there. But yeah, in these CI days we inhabit you're going to have to rush a CRAN release to get the binaries updated everywhere else. Can you please ping here when new version is up? Thanks loads for the quick solution
Update: Adding Remotes
to DESCRIPTION
to force rebuild cleared all previous errors on github actions, leaving green lights all round. The issue appears to be definitively fixed 🚀 💯
I have just downloaded and installed the binary on my Windows platform, works great now. Well done!
@jonclayden could you please do one small favour and increment your the version number, to make it easy to track whether CRAN or github version has been installed? They currently have same version number. Thanks
Yes, of course. CRAN won't accept duplicate version numbers anyway. Version 2.7.0 has been submitted; I'm just waiting for it to go through their checks.
Ok, RNiftyReg
v2.7.0 is now on CRAN. You may want to wait to update your builds until the Mac and Windows binaries are updated, though.
CRAN's Windows R-devel build is still stuck at v2.6.8 for some reason, but I'll close this issue because I'm not sure what more I can do.
That is definitively n-o-t y-o-u-r p-r-o-b-l-e-m . . thanks so much for helping with this one, problem is definitely solved!
Ah, all the binaries are finally up to date! 😅