Skip to contents

An interpolated scan is created at specified resolutions resx, resy in x and y direction. The interpolation is based on na.approx from the zoo package. It is possible to create interpolations at a higher resolution than the one specified in the data itself, but it is not recommended to do so. x3p_interpolate can also be used as a way to linearly interpolate any missing values in an existing scan without changing the resolution.

Usage

x3p_interpolate(x3p, resx = 1e-06, resy = resx, maxgap = 1)

interpolate_x3p(x3p, resx = 1e-06, resy = resx, maxgap = 1)

Arguments

x3p

x3p object

resx

numeric value specifying the new resolution for the x axis.

resy

numeric value specifying the new resolution for the y axis.

maxgap

integer variable used in na.approx to specify the maximum number of NAs to be interpolated, defaults to 1.

Value

interpolated x3p object

Examples

logo <- x3p_read(system.file("csafe-logo.x3p", package="x3ptools"))
# resolution:
logo$header.info$incrementX
#> [1] 6.45e-07
# change resolution to 1 micron = 1e-6 meters
logo2 <- x3p_interpolate(logo, resx = 1e-6)
logo2$header.info$incrementX
#> [1] 1e-06