convertCoordinates: Convert coordinates to/from min/max representation from/to...

View source: R/ssdUtilities.R

convertCoordinatesR Documentation

Convert coordinates to/from min/max representation from/to centroids/width

Description

Function for converting box coordinates to/from min/max representation from/to centroids/width

Usage

convertCoordinates(boxes, type = c("minmax2centroids", "centroids2minmax"))

Arguments

boxes

A vector or 2-D array where each row corresponds to a single box consisting of the format (xmin,xmax,ymin,ymax) or (centerx,centery,width,height) for 2-D vs. (xmin,xmax,ymin,ymax,zmin,zmax) or (centerx,centery,centerz,width,height,depth) for 3-D.

type

either ⁠'minmax2centroids'⁠ or ⁠'centroids2minmax'⁠

Value

a vector or 2-D array with the converted coordinates

Author(s)

Tustison NJ

Examples

vec2d = c(1, 10, 1, 10)
convertCoordinates(vec2d)
convertCoordinates(vec2d, type = "centroids2minmax")
convertCoordinates(rbind( vec2d, vec2d, vec2d))
convertCoordinates(rbind( vec2d, vec2d, vec2d), "centroids2minmax")

vec3d = c(1, 10, 1, 10, 1, 10)
convertCoordinates(vec3d)
convertCoordinates(vec3d, type = "centroids2minmax")
convertCoordinates(rbind( vec3d, vec3d, vec3d))
convertCoordinates(rbind( vec3d, vec3d, vec3d), type = "centroids2minmax")


ANTsX/ANTsRNet documentation built on Nov. 21, 2024, 4:07 a.m.