Converts xyz coordinates in pixels to voxels of a specified µm size. The function summarizes the number of samples per group. It outputs a list where the first element ("data") is the data voxelized, and the second element ("summary") is the data summarized, i.e. the number of samples per voxel per group

voxelize(data, conv_factor = 5.16, voxel_size = 30)

Arguments

data

dataframe with xyz coordinates ("xPos", "yPox", "zPos") for example output of calculate_density(). It includes a variable ("sample_id") that is the quantity that will be summarizes over the group variable ("group").

conv_factor

number to be used for the conversion. The conversion factor depends on the imaging settings. For more information, see for example: https://mindresearchfacility.nl/wp-content/uploads/2019/12/Zoom-factor-and-corresponding-NA-and-resolution-by-pixel-size.pdf Defaults to 5.16

voxel_size

in µm. Defaults to 30. If you want to specify in pixels, put conv_factor = 1

Value

Examples

x <- data.frame( xPos = rnorm(100, 300, 100), yPos = rnorm(100, 300, 100), zPos = rnorm(100, 300, 100), group = rep(c("control", "exp"), each = 50), sample_id = rep(c(1:10), each = 10) ) y <- voxelize(x, voxel_size = 100)
#> Error in data %>% dplyr::mutate(xPos_vox = as.numeric(cut(xPos, µm[[1]])), yPos_vox = as.numeric(cut(yPos, µm[[2]])), zPos_vox = as.numeric(cut(zPos, µm[[3]]))): could not find function "%>%"