Skip to content

Commit

Permalink
adding smoothed_mask to the extrantsr version of smooth_mask.
Browse files Browse the repository at this point in the history
  • Loading branch information
muschellij2 committed Dec 11, 2017
1 parent a40b994 commit 35263ec
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 4 deletions.
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Package: extrantsr
Type: Package
Title: Extra Functions to Build on the ANTsR Package
Version: 3.7.0
Version: 3.7.1
Author: John Muschelli
Maintainer: John Muschelli <muschellij2@gmail.com>
Description: Extends the ANTsR package with simple wrappers and complex
Expand Down
13 changes: 11 additions & 2 deletions R/smooth_image.R
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@
#' @param mask (character) optional mask given for image
#' @param smooth_mask (logical) Smooth mask? If TRUE, the masked image
#' will be divided by the smoothed mask.
#' @param smoothed_mask (character or antsImage) If specified and
#' \code{smooth_mask = TRUE}, then will use this as the smoothed mask for
#' division.
#' @param verbose (logical) print out command before running
#' @param retfile logical to indicate if an \code{antsImage} should be returned
#' (useful for chaining)
Expand All @@ -29,6 +32,7 @@ smooth_image <- function(
sigma=10,
mask=NULL,
smooth_mask = TRUE,
smoothed_mask = NULL,
verbose = TRUE,
retfile = FALSE,
...){
Expand All @@ -41,8 +45,13 @@ smooth_image <- function(

sm_file = ANTsRCore::smoothImage(inimg = file, sigma = sigma, ...)
if (!is.null(mask) & smooth_mask ) {
# smoothing mask
sm_mask = ANTsRCore::smoothImage(inimg = mask, sigma = sigma, ...)
if (is.null(smoothed_mask)) {
# smoothing mask
sm_mask = ANTsRCore::smoothImage(inimg = mask, sigma = sigma, ...)
} else {
sm_mask = check_ants(smoothed_mask)
}

# dividing smoothed mask
sm_file = sm_file / sm_mask
rm( list = "sm_mask"); gc(); gc();
Expand Down
6 changes: 5 additions & 1 deletion man/smooth_image.Rd

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

0 comments on commit 35263ec

Please sign in to comment.