Closed muratmaga closed 3 months ago
I think the problem (for R >=4.2) is here over in ANTsRCore:
The breaking change in R 4.2.0 is documented in R news as follows:
Calling if() or while() with a condition of length greater than one gives an error rather than a warning. Consequently, environment variable _R_CHECK_LENGTH_1CONDITION no longer has any effect.
I guess you can do something like
if (all(is.na(initx))) {
initx = paste("[", f, ",", m, ",1]", sep = "")
}
to ensure that the result is a logical of length 1 or check for whatever else distinguishes between the signalling value of NA
vs when initx
contains a transform.
Fix works fine, thank you.
I wonder if this needs to be committed to the repo? Because this is going to fail for anyone who has more than items in the transform. if this is a frowned upon thing (i.e., the goal of transformList is only to pass a single transform, like a prior affine), than perhaps documentation needs to be updated.
In the current implementation, multiple transform files should be allowed, but multiple linear antsTransform objects are not. There's some manipulation of the antsTransform objects that I don't understand, so I've left it alone. But it should support using a vector of file names like my_registration$fwdtransforms
. Fixed and documented in #397
I recently moved to R 4.3.1 from 4.1.2. This line of code for two step registrations seems to work fine in 4.1.2, with a warning about transform orders (which I always got).
but same code fails with this error in 4.3.1
Error in if (is.na(initx)) { : the condition has length > 1
Here is the session info for both R versions. As far as I can tell both have the same ANTs versions. Not sure where the error is coming from.
R4.1.2
R 4.3.1: