Skip to content

Commit

Permalink
fixed bug in kmeansSegmentation
Browse files Browse the repository at this point in the history
  • Loading branch information
muschellij2 committed Nov 23, 2018
1 parent ab2e7cf commit 8113542
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 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.6.2.2
Version: 0.6.3
Date: 2018-11-02
Authors@R: c(
person(given = "Brian B.", family = "Avants", role = "cre",
Expand Down
4 changes: 2 additions & 2 deletions R/kmeansSegmentation.R
Original file line number Diff line number Diff line change
Expand Up @@ -46,16 +46,16 @@ kmeansSegmentation <- function(img, k, kmask = NA, mrf = 0.1, verbose=FALSE,
...) {
img = check_ants(img)
dim <- img@dimension
kmimg = iMath(img, "Normalize")
if (is.na(kmask)) {
kmimg = iMath(img, "Normalize")
kmask <- getMask(kmimg, 0.01, 1, cleanup = 2)
} else {
kmask = check_ants(kmask)
}
kmask = iMath(kmask, "FillHoles") %>% thresholdImage(1,2)
nhood <- paste(rep(1, dim), collapse = "x")
mrf <- paste("[", mrf, ",", nhood, "]", sep = "")
kmimg <- atropos( a = kmimg, m = mrf, c = "[5,0]",
kmimg <- atropos( a = img, m = mrf, c = "[5,0]",
i = paste("kmeans[",k, "]", sep = ""),
verbose = verbose,
x = kmask,
Expand Down

0 comments on commit 8113542

Please sign in to comment.