The image below has 3 channels - blue (DAPI nuclei), red (Ph3 cell death), green (Ki67 cell proliferation)
library(SimpleITK)
source("setup.R")
cntrl <- ReadImage("images/Control.tif")
# it is a 3D tif, so need to turn it into colour to display
red <- cntrl[,,1]
green <- cntrl[,,2]
blue <- cntrl[,,3]
# first use of a filter
cntrl.colour <- ComposeImageFilter()$Execute(red, green, blue)
cntrl.colour
segChannel
splitBlobs
Apply thresholding and splitting to each channel and count the cells
dapi.cells <- segChannel(blue, 1)
ph3.cells <- segChannel(red, 1)
Ki67.cells <- segChannel(green, 1)
## stats
dapi.stats <- LabelShapeStatisticsImageFilter()
lmap <- dapi.stats$Execute(dapi.cells$labels)
dapi.cells.count <- dapi.stats$GetNumberOfLabels()
ph3.stats <- LabelShapeStatisticsImageFilter()
lmap <- ph3.stats$Execute(ph3.cells$labels)
ph3.cells.count <- ph3.stats$GetNumberOfLabels()
Ki67.stats <- LabelShapeStatisticsImageFilter()
lmap <- Ki67.stats$Execute(Ki67.cells$labels)
Ki67.cells.count <- Ki67.stats$GetNumberOfLabels()
c(dapi.cells.count, ph3.cells.count, Ki67.cells.count)
dapi.cells$dist
dapi.cells$labels > 0
ph3.cells$labels > 0