zero_pad: Zero pads an image

Description Usage Arguments Value Examples

View source: R/zero_pad.R

Description

This function zero pads an image by a certain number of dimensions, usually for convolution

Usage

1
zero_pad(img, kdim, invert = FALSE, pad_value = 0, ...)

Arguments

img

Array or class nifti

kdim

Dimensions of kernel

invert

(logical) If FALSE, does zero padding. If TRUE, reverses the process.

pad_value

Value to pad the image with. May use other values, such as -1024 for CT data

...

Options to copyNIfTIHeader

Value

Object of class nifti

Examples

1
2
3
4
5
kdim = c(3,3,5)
img = array(rnorm(30*30*36), dim = c(30, 30, 36))
pad = zero_pad(img, kdim)
back = zero_pad(pad, kdim, invert=TRUE)
all.equal(back, img)

neuroconductor-devel/neurobase documentation built on May 6, 2021, 1:48 p.m.