Skip to content

Commit

Permalink
fixing antsApplyTransforms
Browse files Browse the repository at this point in the history
  • Loading branch information
muschellij2 committed Jul 12, 2018
1 parent a542eee commit ad596f8
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 16 deletions.
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Package: ANTsRCore
Type: Package
Title: Core Software Infrastructure for ANTsR
Version: 0.5.3.2
Version: 0.5.4.0
Date: 2018-07-09
Authors@R: c(
person(given = "Brian B.", family = "Avants", role = "cre",
Expand Down
28 changes: 16 additions & 12 deletions R/antsApplyTransforms.R
Original file line number Diff line number Diff line change
Expand Up @@ -48,13 +48,15 @@
#' fixed <- antsImageRead( getANTsRData("r16") ,2)
#' moving <- antsImageRead( getANTsRData("r64") ,2)
#' fixed <- resampleImage(fixed,c(64,64),1,0)
#' moving <- resampleImage(moving,c(64,64),1,0)
#' moving <- resampleImage(moving,c(68,68),1,0)
#' mytx <- antsRegistration(fixed=fixed , moving=moving ,
#' typeofTransform = c("SyN") )
#' mywarpedimage <- antsApplyTransforms( fixed=fixed,moving=moving,
#' transformlist=mytx$fwdtransforms )
#' mywarpedimage <- antsApplyTransforms( fixed=moving,moving=fixed,
#' testthat::expect_true(antsImagePhysicalSpaceConsistency(mywarpedimage, fixed))
#' invwarped_image <- antsApplyTransforms( fixed=moving,moving=fixed,
#' transformlist=mytx$invtransforms )
#' testthat::expect_true(antsImagePhysicalSpaceConsistency(invwarped_image, moving))
#' # full access via listing the inputs in standard ANTs format
#'
#' @seealso \code{\link{antsRegistration}}
Expand Down Expand Up @@ -95,12 +97,12 @@ antsApplyTransforms <- function(
"genericLabel" )
interpolator <- match.arg( interpolator, interpOpts )

if (is.antsImage(moving)) {
moving = antsImageClone(moving)
}
if (is.antsImage(fixed)) {
fixed = antsImageClone(fixed)
}
# if (is.antsImage(moving)) {
# moving = antsImageClone(moving)
# }
# if (is.antsImage(fixed)) {
# fixed = antsImageClone(fixed)
# }

args <- list(fixed, moving, transformlist, interpolator, ...)
if (!is.character(fixed)) {
Expand All @@ -112,12 +114,11 @@ antsApplyTransforms <- function(
}
inpixeltype <- fixed@pixeltype
warpedmovout <- antsImageClone(moving)
f <- antsImageClone(fixed)
m <- antsImageClone(moving)
f <- fixed
m <- moving
if ( ( moving@dimension == 4 ) & ( fixed@dimension == 3 ) &
( imagetype == 0 ) )
stop( "Set imagetype 3 to transform time series images." )
wmo <- antsImageClone(warpedmovout)
mytx <- list()
# If whichtoinvert is NA, then attempt to guess the right thing to do
#
Expand Down Expand Up @@ -154,7 +155,7 @@ antsApplyTransforms <- function(

}
if ( is.na( compose ) )
args <- list(d = fixed@dimension, i = m, o = wmo, r = f, n = interpolator,
args <- list(d = fixed@dimension, i = m, o = warpedmovout, r = f, n = interpolator,
unlist(mytx))
tfn <- paste( compose, "comptx.nii.gz", sep='' )
if ( !is.na( compose ) ) {
Expand Down Expand Up @@ -183,6 +184,9 @@ antsApplyTransforms <- function(
}
# Get here if fixed, moving, transformlist are not missing, fixed is not of type character,
# and fixed and moving are not both of type antsImage
stop(paste0('fixed, moving, transformlist are not missing,',
' fixed is not of type character,',
' and fixed and moving are not both of type antsImage'))
return(1)
}
# if ( Sys.info()['sysname'] == 'XXX' ) { mycmd<-.antsrParseListToString( c(args)
Expand Down
2 changes: 1 addition & 1 deletion data/antsVersions.csv
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
Dependency;GitTag
ANTs;e1893f746f7126331a4c31f917538f914c175dfa
ANTsRCore;1a8ebc8ede39a1d9bf3a73294a335a8b554b24e7
ANTsRCore;a542eeec12b0ec46ccac36c8e52086e9474adfe0
6 changes: 4 additions & 2 deletions man/antsApplyTransforms.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit ad596f8

Please sign in to comment.