Skip to content

Commit

Permalink
BUG: wrong type for idx
Browse files Browse the repository at this point in the history
  • Loading branch information
stnava committed Aug 12, 2024
1 parent df1e66e commit 9227130
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions R/makePowersPointsImage.R
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ makePowersPointsImage <- function(pts, mask, radius = 5) {
for (j in seq(-n[2], n[2], by = 0.5)) {
for (k in seq(-n[3], n[3], by = 0.5)) {
local <- idx + c(i, j, k)
localpt <- antsTransformIndexToPhysicalPoint(mask, local)
localpt <- antsTransformIndexToPhysicalPoint(mask, as.numeric(local))
dist <- sqrt(sum((localpt - pt) * (localpt - pt)))
inImage <- (prod(idx <= dim(mask)) == 1) && (length(which(idx < 1)) == 0)
if ((dist <= rad) && (inImage == TRUE)) {
Expand Down Expand Up @@ -83,7 +83,7 @@ makePointsImage <- function(pts, mask, radius = 5) {
if (dim == 3) {
for (k in seq(-n[3], n[3], by = 0.5)) {
local <- idx + c(i, j, k)
localpt <- antsTransformIndexToPhysicalPoint(mask, local)
localpt <- antsTransformIndexToPhysicalPoint(mask, as.numeric(local))
dist <- sqrt(sum((localpt - pt) * (localpt - pt)))
inImage <- all(local >= 1 & local <= dim(powersLabels))
if ((dist <= rad) && (inImage == TRUE)) {
Expand All @@ -95,7 +95,7 @@ makePointsImage <- function(pts, mask, radius = 5) {
} # if dim == 3
if (dim == 2) {
local <- idx + c(i, j)
localpt <- antsTransformIndexToPhysicalPoint(mask, local)
localpt <- antsTransformIndexToPhysicalPoint(mask, as.numeric(local))
dist <- sqrt(sum((localpt - pt) * (localpt - pt)))
inImage <- (prod(local <= dim(mask)) == 1) && (length(which(local < 1)) == 0)
if ((dist <= rad) && (inImage == TRUE)) {
Expand Down

0 comments on commit 9227130

Please sign in to comment.