occupancy: 3D Occupancy

View source: R/occupancy.R

occupancyR Documentation

3D Occupancy

Description

Function to calculate the occupancy of a target channel at certain distances from a focal channel

Usage

occupancy(
  imgs,
  focal.channel,
  target.channel,
  size,
  npixel,
  R = 10,
  dstep = 1,
  pwidth,
  zstep,
  cores = 1,
  kern.smooth = NULL,
  layers = NULL,
  naming = NULL
)

occupancy.default(
  imgs,
  focal.channel,
  target.channel,
  size,
  npixel,
  dstep = 1,
  pwidth,
  zstep,
  cores = 1,
  kern.smooth = NULL,
  layers = NULL,
  naming = NULL
)

Arguments

imgs

The paths of array files; i.e. output from loadIMG or findIMG functions.

focal.channel

Name of the channel from which the distance is calculated. Should be in the names of the array files

target.channel

Name of the channel for calculate occupancy of. Should be in the names of the array files

size

The maximum distance (microns) to examine. Has to be a multiple of both pwidth and zstep. Beware, increasing size will increase runtime exponetially!

npixel

Number of random pixels to examine. Increasing this will increase precision (and runtime in a linear fashion)

R

Number of times to run the occupancy analysis

dstep

The interval between examined distances (microns). Increasing this decreases resolution but speeds up function linearly. Defaults to 1

pwidth

Width of pixels in microns

zstep

z-step in microns

cores

The number of cores to use. Defaults to 1

kern.smooth

Optional. Numeric vector indicating range of median smoothing in the x,y,z directions. Has to be odd intergers. c(1,1,1) means no smoothing.

layers

Optional. Should the function only look in a subset of layers. A list with lists of layers to use for each image. Can also be the output from extract_layers

naming

Optional. Add metadata to the output dataframe by looking through names of array files. Should be a list of character vectors, each list element will be added as a variable. Example: naming=list(Time=c("T0","T1","T2")). The function inserts a variable called Time, and then looks through the names of the array files and inserts characters mathcing either T0, T1 or T2

Value

A dataframe with the occupancy values for each distance


Russel88/RCon3D documentation built on Dec. 14, 2022, 11:06 p.m.