20
20
# ' specifically the family of \code{antsRegistrationSyN*[so]} or
21
21
# ' \code{antsRegistrationSyN*[bo]} transforms. See 'typeOfTransform'
22
22
# ' in \code{antsRegistration}. Additionally, one can use a list
23
- # ' to pass a more tailored deformably -only transform optimization using
23
+ # ' to pass a more tailored deformable -only transform optimization using
24
24
# ' SyN or BSplineSyN transforms. The order of parameters in the list
25
25
# ' would be 1) transform specification, i.e. "SyN" or "BSplineSyN",
26
26
# ' 2) gradient (real), 3) intensity metric (string), 4) intensity metric
@@ -137,10 +137,10 @@ labelImageRegistration <- function( fixedLabelImages, movingLabelImages,
137
137
totalNumberOfLabels <- 0
138
138
for ( i in seq.int( length( fixedLabelImages ) ) )
139
139
{
140
- fixedLabelGeoms <- labelGeometryMeasures ( fixedLabelImages [[i ]] )
141
- fixedLabelIds <- fixedLabelGeoms $ Label
142
- movingLabelGeoms <- labelGeometryMeasures ( movingLabelImages [[i ]] )
143
- movingLabelIds <- movingLabelGeoms $ Label
140
+ fixedLabelIds <- unique ( fixedLabelImages [[i ]] )
141
+ fixedLabelIds <- fixedLabelIds [ ! fixedLabelIds %in% c( 0 )]
142
+ movingLabelIds <- unique ( movingLabelImages [[i ]] )
143
+ movingLabelIds <- movingLabelIds [ ! movingLabelIds %in% c( 0 )]
144
144
commonLabelIds [[i ]] <- intersect( fixedLabelIds , movingLabelIds )
145
145
totalNumberOfLabels = totalNumberOfLabels + length( commonLabelIds [[i ]] )
146
146
if ( verbose )
@@ -411,7 +411,7 @@ labelImageRegistration <- function( fixedLabelImages, movingLabelImages,
411
411
412
412
fwdtransforms <- c()
413
413
invtransforms <- c()
414
- if ( is.null( linearXfrm ) )
414
+ if ( ! is.null( linearXfrm ) )
415
415
{
416
416
if ( length( findInverseWarps ) > 0 )
417
417
{
@@ -432,7 +432,7 @@ labelImageRegistration <- function( fixedLabelImages, movingLabelImages,
432
432
if ( verbose )
433
433
{
434
434
message( " \n\n Resulting transforms" )
435
- if ( length( findInverseWarps ) > 0 )
435
+ if ( length( fwdtransforms ) > 1 )
436
436
{
437
437
message( paste0( " fwdtransforms: [" , fwdtransforms [1 ], " , " , fwdtransforms [2 ], " ]" ) )
438
438
message( paste0( " invtransforms: [" , invtransforms [1 ], " , " , invtransforms [2 ], " ]" ) )
0 commit comments