# R/imageMorphologicalFilters.R In David-J-R/Raspository: My Collection of Tools and Algorithms Programmed In R.

#' Title
#'
#' @import data.table
#'
#' @param method
#'
#' @references \insertRef{Taubig2014}{Raspository}
#'
#' @return
#' @export
#'
#' @examples
DT_Coordinates <- data.table(x=integer(), y=integer())

if(method[1] == "anglefunction"){
n <- ceiling((2 * pi * radius))
for(i in 0:n){
DT_Coordinates <- rbind(DT_Coordinates,
data.table(x = round(radius * cos(2 * pi * i/n)),
y = round(radius * sin(2 * pi * i/n))))
}
}else if(method[1] == "sqrt"){
y  <- sqrt(rSquared - x ^ 2)

## discretize values
x <- round(x)
y <- round(y)
DT_Coordinates <- rbind(DT_Coordinates, data.table(x = x, y = y))
DT_Coordinates <- rbind(DT_Coordinates, data.table(x = x, y = -y))
}
}else if(method[1] == "bresenham"){
x <- 0
DT_Coordinates <- rbind(DT_Coordinates,

while(x < y){
if(error < 0){
error <- error + 2 * x + 1
}else{
error <- error + 2 * x  - 2 * y + 2
y <- y - 1
}
x <- x + 1
DT_Coordinates <- rbind(DT_Coordinates,
data.table(x = c(x, x, -x, -x, y, y, -y, -y),
y = c(y, -y, y, -y, x, -x, x, -x)))

}
}

setkey(DT_Coordinates, x, y)

return(DT_Coordinates)
}

#' Title
#'
#' @import data.table
#'
#' @param x
#' @param y
#'
#'
#' @return
#' @export
#'
#' @examples
}

#' Title
#'
#' @import data.table
#'
#'
#' @return
#' @export
#'
#' @examples
DT_diskCoordinates <- data.table(x=integer(), y=integer())

if(method[1] == "naive"){
if(i ^ 2 + j ^ 2 <= radiusSq){
DT_diskCoordinates <- rbind(DT_diskCoordinates,
data.table(x=i, y=j))
}
}
}
}else if(method[1] == "bresenham"){
method = "bresenham"))
}else{
stop(paste(method, "method not implemented."))
}

return(DT_diskCoordinates)
}

#' Title
#'
#' @import data.table
#'
#' @param a
#' @param b
#'
#' @return
#' @export
#'
#' @examples
return(CJ(x = -a:a, -b:b))
}

#' Title
#'
#' @param img
#'
#' @references \insertRef{Weickert2019}{Raspository}
#'
#' @return
#' @export
#'
#' @examples
imgMatrix <- img@imageMatrix

}

#' Title
#'
#' @param img
#'
#' @references \insertRef{Weickert2019}{Raspository}
#'
#' @return
#' @export
#'
#' @examples
imgMatrix <- img@imageMatrix

}

#' Title
#'
#' @param img
#'
#' @return
#' @export
#'
#' @examples
}

#' Title
#'
#' @param img
#'
#' @return
#' @export
#'
#' @examples
}

#' Title
#'
#' @param img
#'
#' @return
#' @export
#'
#' @examples
}

#' Title
#'
#' @param img
#'
#' @return
#' @export
#'
#' @examples
}

#' Title
#'
#' @param img