suppressPackageStartupMessages({
    library(cellCounter)
})
knitr::opts_chunk$set(warning=FALSE, message=FALSE)

Introduction

library(EBImage)
library(cellCounter) ## must load EBImage first.
files <- dir("../../others/sample/v", full.names = TRUE)[1:10]
## files <- dir("/Users/jianhongou/packages/others/tcf21/cal-s1", full.names = TRUE)
img2 <- readListImg(files)
## detect the cells, time comsuming, please try to run on cluster.
nmask.red <- lapply(img2, function(img){
  Image2(detectObjects3(channel(img, "red")))
})
nmask.green <- lapply(img2, function(img){
  Image2(detectObjects3(channel(img, "green")))
})

red.cells <- labeledImage2Cell(nmask.red, colorChannel="red")
green.cells <- labeledImage2Cell(nmask.green, colorChannel="green")
cells <- setParentOfCells(c(red.cells, green.cells))
#options(bitmapType='cairo')
ol <- overlayDetections(img2, cells)
display(ol, frames=1:5)
## used for downstream analysis
cellTbl <- outputCellTable(cells)

Session Info

sessionInfo()


jianhong/cellCounter documentation built on June 10, 2022, 8 p.m.