Title: | Nucleome Imaging Toolbox |
---|---|
Description: | Tools for 4D nucleome imaging. Quantitative analysis of the 3D nuclear landscape recorded with super-resolved fluorescence microscopy. See Volker J. Schmid, Marion Cremer, Thomas Cremer (2017) <doi:10.1016/j.ymeth.2017.03.013>. |
Authors: | Volker Schmid [aut, cre] |
Maintainer: | Volker Schmid <[email protected]> |
License: | GPL-3 |
Version: | 1.0.12 |
Built: | 2024-11-11 05:15:35 UTC |
Source: | https://github.com/bioimaginggroup/nucim |
Barplot with Intervals
barplot_with_interval( x, method = "minmax", qu = c(0, 1), ylim = NULL, horiz = FALSE, border = NA, ... )
barplot_with_interval( x, method = "minmax", qu = c(0, 1), ylim = NULL, horiz = FALSE, border = NA, ... )
x |
matrix |
method |
method for intervals: "minmax" (default), "quantile" or "sd" |
qu |
vector of two quantiles for method="quantile |
ylim |
limits for y axis. Default:NULL is ylim=c(0,max(interval)) |
horiz |
boolean: horizontal bars? |
border |
border parameter forwarded to barplot, default: NA is nor border |
... |
additional parameters forwarded to barplot |
plot
Barplot with Intervals for two or three bars beside
barplot_with_interval_23(x, method = "minmax", qu = c(0, 1), ylim = NULL, ...)
barplot_with_interval_23(x, method = "minmax", qu = c(0, 1), ylim = NULL, ...)
x |
array |
method |
method for intervals: "minmax" (default), "quantile" or "sd" |
qu |
vector of two quantiles for method="quantile |
ylim |
limits for y axis. Default:NULL is ylim=c(0,max(interval)) |
... |
additional parameters forwarded to barplot |
plot
Class neighbourhood distribution
class.neighbours(img, N, N.max = 7, cores = 1)
class.neighbours(img, N, N.max = 7, cores = 1)
img |
Class image |
N |
which class |
N.max |
maximum class (default: 7) |
cores |
number of cores used in parallel (needs parallel package) |
vector of length N.max
class.neighbours.folder
class.neighbours.folder(inputfolder, outputfolder, N = 7)
class.neighbours.folder(inputfolder, outputfolder, N = 7)
inputfolder |
Input folder |
outputfolder |
Output folder |
N |
Max class #' |
plots
Classify DAPI
classify(blue, mask, N, beta = 0.1, z = 1/3, silent = TRUE)
classify(blue, mask, N, beta = 0.1, z = 1/3, silent = TRUE)
blue |
DAPI channel (image) |
mask |
mask (image) |
N |
number of classes |
beta |
smoothing parameter used in potts model (default: 0.1) |
z |
scaling parameter: size of voxel in X-/Y-direction divided by the size of voxel in Z-direction (slice scaling parameter: size of voxel in X-/Y-direction divided by the size of voxel in Z-direction (slice thickness)) |
silent |
boolean. Should algorithm be silent? |
image with classes
Classify DAPI
classify.folder(f, N, beta = 0.1, output = paste0("class", N), cores = 1)
classify.folder(f, N, beta = 0.1, output = paste0("class", N), cores = 1)
f |
folder |
N |
number of classes |
beta |
beta parameter used in bioimagetools::segment() |
output |
output folder |
cores |
number of cores used in parallel (needs parallel package) |
results in "output" and "output"-n
These functions are provided for compatibility with older version of the nucim package. They may eventually be completely removed.
classify.single(...)
classify.single(...)
... |
parameters for classify |
image with classes
Count classes in classified image
classify.table(class, N)
classify.table(class, N)
class |
classes image |
N |
number of classes |
table with number of voxels per class
Compute colors in classes distribution
colors.in.classes( classes, color1, color2 = NULL, mask = array(TRUE, dim(classes)), N = max(classes, na.rm = TRUE), type = "tresh", thresh1 = NULL, thresh2 = NULL, sd1 = 2, sd2 = 2, col1 = "green", col2 = "red", test = FALSE, plot = TRUE, beside = TRUE, ylim = NULL, verbose = FALSE, ... )
colors.in.classes( classes, color1, color2 = NULL, mask = array(TRUE, dim(classes)), N = max(classes, na.rm = TRUE), type = "tresh", thresh1 = NULL, thresh2 = NULL, sd1 = 2, sd2 = 2, col1 = "green", col2 = "red", test = FALSE, plot = TRUE, beside = TRUE, ylim = NULL, verbose = FALSE, ... )
classes |
Image of classes |
color1 |
Image of first color |
color2 |
Image of second color |
mask |
Image mask |
N |
Maximum number of classes |
type |
Type of spot definition, see details |
thresh1 |
Threshold for first color image |
thresh2 |
Threshold for second color image |
sd1 |
For automatic threshold, that is: mean(color1)+sd1*sd(color1) |
sd2 |
For automatic threshold of color2 |
col1 |
Name of color 1 |
col2 |
Name of color 2 |
test |
Compute tests: "Wilcoxon" for Wilcoxon rank-sum (Mann-Whitney U), chisq for Chi-squared test |
plot |
Plot barplots |
beside |
a logical value. If FALSE, the columns of height are portrayed as stacked bars, and if TRUE the columns are portrayed as juxtaposed bars. |
ylim |
limits for the y axis (plot) |
verbose |
verbose mode |
... |
additional plotting parameters |
Type of spot definitions: "thresh" or "t": Threshold based (threshold can be given by thresh1/2 or automatically derived) "voxel" or "v": Spots are given as binary voxel mask "intensity" or "i": Voxels are weighted with voxel intensity. Intensity is scaled to [0,1] after subtracting thresh1/2 (or automatic threshold)
Table of classes with color 1 (and 2)
Compute colors in classes distribution for folders
colors.in.classes.folder( path, color1, color2 = NULL, N = 7, type = "intensity", thresh1 = NULL, thresh2 = NULL, sd1 = 2, sd2 = 2, col1 = "green", col2 = "red", cores = 1, verbose = FALSE )
colors.in.classes.folder( path, color1, color2 = NULL, N = 7, type = "intensity", thresh1 = NULL, thresh2 = NULL, sd1 = 2, sd2 = 2, col1 = "green", col2 = "red", cores = 1, verbose = FALSE )
path |
Path to root folder |
color1 |
Image of first color |
color2 |
Image of second color |
N |
Maximum number of classes |
type |
Type of spot definition, see details |
thresh1 |
Threshold for first color image |
thresh2 |
Threshold for second color image |
sd1 |
For automatic threshold, that is: mean(color1)+sd1*sd(color1) |
sd2 |
For automatic threshold of color2 |
col1 |
Name of color 1 |
col2 |
Name of color 2 |
cores |
Number of cores used in parallel, cores=1 implies no parallelization |
verbose |
verbose mode |
Results are in folder colorsinclasses
Compute distance to border of classes
compute.distance2border( f, color, N, from.spots = FALSE, output = "dist2border", cores = 1 )
compute.distance2border( f, color, N, from.spots = FALSE, output = "dist2border", cores = 1 )
f |
folder of classes images |
color |
folder of color images ("spots-"color for spots images) |
N |
which class |
from.spots |
Logical. |
output |
output folder |
cores |
number of parallel cores which can be used |
images in output"-"color"-"N
Mask DAPI in kernel
dapimask( img, size = NULL, voxelsize = NULL, thresh = "auto", silent = TRUE, cores = 1 )
dapimask( img, size = NULL, voxelsize = NULL, thresh = "auto", silent = TRUE, cores = 1 )
img |
DAPI channel image (3d) |
size |
size of img in microns |
voxelsize |
size of voxel in microns |
thresh |
threshold for intensity. Can be "auto": function will try to find automatic threshold |
silent |
Keep silent? |
cores |
number of cores available for parallel computing |
mask image, array with same dimension as img.
Automatic DAPI mask segmentation for files
dapimask.file( file, folder = "blue", voxelsize = NULL, size = NULL, silent = FALSE, cores = 1 )
dapimask.file( file, folder = "blue", voxelsize = NULL, size = NULL, silent = FALSE, cores = 1 )
file |
file to read |
folder |
with |
voxelsize |
real size of voxel (in microns), if NULL (default), look in folder XYZmic |
size |
real size of image (in microns), if NULL (default), look in folder XYZmic |
silent |
Keep silent? |
cores |
Number of cores available for parallel computing |
nothing, DAPI mask image will be saved to dapimask/
Automatic DAPI mask segmentation for folder
dapimask.folder( path, folder = "blue", voxelsize = NULL, size = NULL, cores = 1 )
dapimask.folder( path, folder = "blue", voxelsize = NULL, size = NULL, cores = 1 )
path |
path to folder with DAPI |
folder |
folder with DAPI images |
voxelsize |
real size of voxel (in microns), if NULL (default), look in folder XYZmic |
size |
real size of image (in microns), if NULL (default), look in folder XYZmic |
cores |
number of cores to use in parallel (need parallel package) |
nothing, results are in folder dapimask
Detects spots for one file
find.spots.file( file, dir, color, thresh = NULL, thresh.auto = FALSE, thresh.quantile = 0.9, filter = NULL, cores = 1 )
find.spots.file( file, dir, color, thresh = NULL, thresh.auto = FALSE, thresh.quantile = 0.9, filter = NULL, cores = 1 )
file |
file |
dir |
directory for results |
color |
which color, images have to be in folder with color name |
thresh |
threshold |
thresh.auto |
Logical. Find threshold automatically? |
thresh.quantile |
numeric. use simple |
filter |
2d-filter to use before spot detection |
cores |
number of cores to use in parallel (with parallel package only) |
spot images in spot-color/, number of spots as txt files in spot-color/
Detects spots
find.spots.folder( f, color, thresh = 1, thresh.auto = TRUE, filter = NULL, cores = 1 )
find.spots.folder( f, color, thresh = 1, thresh.auto = TRUE, filter = NULL, cores = 1 )
f |
path to folder |
color |
which color, images have to be in folder with color name |
thresh |
threshold |
thresh.auto |
Logical. Find threshold automatically? |
filter |
2d-filter to use before spot detection |
cores |
number of cores to use in parallel (with parallel package only) |
spot images in spot-color/, number of spots as txt files in spot-color/
Heatmap colors for n classes
heatmap.color(n)
heatmap.color(n)
n |
number of colors. |
barplot(8:1,col=heatmap.color(8))
barplot(8:1,col=heatmap.color(8))
Heatmap colors for 7 classes
heatmap7(...)
heatmap7(...)
... |
parameters are ignored. |
barplot(7:1,col=heatmap7())
barplot(7:1,col=heatmap7())
Find all distances to next neighbour of all classes for folders
nearestClassDistances.folder( path, N = 7, voxelsize = NULL, add = FALSE, cores = 1 )
nearestClassDistances.folder( path, N = 7, voxelsize = NULL, add = FALSE, cores = 1 )
path |
path to folder |
N |
number of classes, default: 7 |
voxelsize |
real size of voxels (in microns), if NULL (default), look in folder XYZmic |
add |
if TRUE, only process images which have not been processed before (i.e. have been added to classN) |
cores |
number of cores to use in parallel (needs parallel package if cores>1) |
nothing, results are in folder distances in RData format
Plot barplot for classified images in a folder
plot_classify.folder( path, N = 7, cores = 1, col = grDevices::grey(0.7), method = "sd" )
plot_classify.folder( path, N = 7, cores = 1, col = grDevices::grey(0.7), method = "sd" )
path |
path to folder |
N |
number of classes, default: 7 |
cores |
number of cores to use in parallel (needs parallel package if cores>1) |
col |
color of bars, either one or a vector of hex RGB characters |
method |
method for error bars ("sd", "minmax", "quartile") |
plots
Plot for colors in classes distribution for folders
plot_colors.in.classes.folder(path, col1 = "green", col2 = "red")
plot_colors.in.classes.folder(path, col1 = "green", col2 = "red")
path |
path to folder |
col1 |
color of channel 1 |
col2 |
color of channel 2 |
plot
Plots all distances to next neighbour of all classes for folders
plot_nearestClassDistances.folder( path, N = 7, cores = 1, method = "quantile", qu = 0.01 )
plot_nearestClassDistances.folder( path, N = 7, cores = 1, method = "quantile", qu = 0.01 )
path |
path to folder |
N |
number of classes, default: 7 |
cores |
number of cores to use in parallel (needs parallel package if cores>1) |
method |
method for summarizing distances, either "min" or "quantile" |
qu |
quantile for method="quantile", default: 0.01 |
plots
Split RGB channels
splitchannel(img, preprocess = TRUE)
splitchannel(img, preprocess = TRUE)
img |
rgb image |
preprocess |
logical. Should preprocessing be applied? |
list with red, green, blue channels and size in microns.
These functions are provided for compatibility with older version of the nucim package. They may eventually be completely removed.
splitchannels(...)
splitchannels(...)
... |
parameters for splitchannels.folder |
Nothing, folders red, green, blue and XYZmic include separate channels and pixel size information
Split channels into files and extracts size in microns
splitchannels.file(file, channels, rgb.folder, normalize = FALSE)
splitchannels.file(file, channels, rgb.folder, normalize = FALSE)
file |
file name |
channels |
e.g. c("red","green","blue") |
rgb.folder |
folder with file |
normalize |
boolean. Should we try to do normalization? |
files in "./red/", "./green", "./blue" and "./XYZmic"
Split RGB images into channels and pixel size information
splitchannels.folder( path, channels = c("red", "green", "blue"), rgb.folder = "rgb", normalize = FALSE, cores = 1 )
splitchannels.folder( path, channels = c("red", "green", "blue"), rgb.folder = "rgb", normalize = FALSE, cores = 1 )
path |
Path to root folder |
channels |
Vector of channels in images |
rgb.folder |
Folder with RGB images |
normalize |
boolean. Should we try to do normalization |
cores |
Number of cores used in parallel, cores=1 implies no parallelization |
Nothing, folders red, green, blue and XYZmic include separate channels and pixel size information
splitchannels.folder("./")
splitchannels.folder("./")
Find spots using information from two channels
spots.combined( red, green, mask, size = NULL, voxelsize = NULL, thresh.offset = 0.1, window = c(5, 5), min.sum.intensity = 2, max.distance = 0.5, use.brightest = FALSE, max.spots = NA, full.voxel = FALSE )
spots.combined( red, green, mask, size = NULL, voxelsize = NULL, thresh.offset = 0.1, window = c(5, 5), min.sum.intensity = 2, max.distance = 0.5, use.brightest = FALSE, max.spots = NA, full.voxel = FALSE )
red |
image |
green |
image |
mask |
image mask |
size |
size of img in microns |
voxelsize |
size of voxel in microns |
thresh.offset |
Thresh offset used in EBImage::thresh() |
window |
Half width and height of the moving rectangular window. |
min.sum.intensity |
spots smaller than min.sum.intensity are ignored |
max.distance |
use only spots with distance to other color spot smaller than max.distance |
use.brightest |
Logical; use only brightest in max.distance? |
max.spots |
maximum of spots (per channel), only when use brightest=TRUE |
full.voxel |
Logical; output contains full voxel instead of rgb intensities |
RGB image with spots will be written to output folder
Find spots using information from two channels
spots.combined.file( file, size = NULL, voxelsize = NULL, folder = "./", thresh.offset = 0.1, min.sum.intensity = 2, max.distance = 0.5, use.brightest = FALSE, max.spots = 2, full.voxel = FALSE, output = "markers" )
spots.combined.file( file, size = NULL, voxelsize = NULL, folder = "./", thresh.offset = 0.1, min.sum.intensity = 2, max.distance = 0.5, use.brightest = FALSE, max.spots = 2, full.voxel = FALSE, output = "markers" )
file |
File name |
size |
size of img in microns, if size and voxelsize are NULL, size is determined from folder XYZmic |
voxelsize |
size of voxel in microns |
folder |
Folder |
thresh.offset |
Thresh offset used in EBImage::thresh() |
min.sum.intensity |
spots smaller than min.sum.intensity are ignored |
max.distance |
use only spots with distance to other color spot smaller than max.distance |
use.brightest |
Logical; use only brightest in max.distance? |
max.spots |
maximum of spots (per channel), only when use brightest=TRUE |
full.voxel |
Logical; output contains full voxel instead of rgb intensities |
output |
output folder |
RGB image with spots will be written to output folder
Find spots using information from two channels for folder
spots.combined.folder( path, size = NULL, voxelsize = NULL, thresh.offset = 0.1, min.sum.intensity = 2, max.distance = 0.5, use.brightest = FALSE, max.spots = 2, full.voxel = FALSE, output = "markers", cores = 1 )
spots.combined.folder( path, size = NULL, voxelsize = NULL, thresh.offset = 0.1, min.sum.intensity = 2, max.distance = 0.5, use.brightest = FALSE, max.spots = 2, full.voxel = FALSE, output = "markers", cores = 1 )
path |
path to folder |
size |
size of img in microns, if size and voxelsize are NULL, size is determined from folder XYZmic |
voxelsize |
size of voxel in microns |
thresh.offset |
Thresh offset used in EBImage::thresh() |
min.sum.intensity |
spots smaller than min.sum.intensity are ignored |
max.distance |
use only spots with distance to other color spot smaller than max.distance |
use.brightest |
Logical; use only brightest in max.distance? |
max.spots |
maximum of spots (per channel), only when use brightest=TRUE |
full.voxel |
Logical; output contains full voxel instead of rgb intensities |
output |
output folder |
cores |
number of cores we can use of parallel computing (needs parallel package if cores>1) |
RGB image with spots will be written to output folder
Test for colors in classes distribution for folders
t_colors.in.classes.folder(path, test = "Wilcoxon")
t_colors.in.classes.folder(path, test = "Wilcoxon")
path |
path to folder |
test |
"Wilcoxon", "wilcox" or "U" for Wilcoxon rank-sum (Mann-Whitney U), chisq for Chi-squared test |
test results