classifyCells: A function to classify cells

Description Usage Arguments Details Value Author(s) Examples

View source: R/classifyCells.R

Description

The function classifies cells and paints the different class types in the image.

Usage

1
classifyCells(classifier,filename="",image=NA,segmentedImage=NA,featuresObjects=NA,paint=TRUE,KS=FALSE,cancerIdentifier=NA, maxShape=NA,minShape=NA,failureRegion=NA,colors=c(),classesToExclude=c(),threshold="otsu",numWindows=2,structures=NA,classifyStructures=FALSE,pixelClassifier=NA,ksToExclude=c())

Arguments

classifier

A Support Vector Machine created by createClassifier or directly by the package e1071

filename

A path to an image file.

image

An 'Image' object or an array.

segmentedImage

An 'Image' object or an array.The corresponding segmented image (created by segmentImage)

featuresObjects

Cell feature file of the segmentedImage (created by segmentImage)

paint

If true, the classified cells are painted with different colors in the image

KS

Use Kernel Smoohter in classification?

cancerIdentifier

A string which describes, how the cancer class is named.

maxShape

Maximum size of cell nuclei

minShape

Minimum size of cell nuclei

failureRegion

minimum size of failure regions

colors

Colors to paint the classes

classesToExclude

Which class should be excluded?

threshold

Which thresholding method should be used, "otsu" or "phansalkar"

numWindows

Number of windows to use for thresholding.

structures

If the image is already segmented, structures can be inserted to enable hierarchical classification.

classifyStructures

Use hierarchical classification. If yes a pixel classifier has to be defined.

pixelClassifier

A SVM to classify pixel based on their color values. Needed if hierarchical classification should be applied.

ksToExclude

These classes are excluded from kernel smoothing.

Details

The kernels smoother improves the classification for cells which are likely to occur in clusters, like tumour cells. The kernel smoothing method can only be applied for two classes. If there are more classes only the normal svm without kernel smoothing is applied. Different classes are labeled with different colors in the image.

Value

A list with

comp1

classes

comp2

Classes, painted in the image, if paint was true

Author(s)

Henrik Failmezger, failmezger@mpipz.mpg.de

Examples

1
2
3
4
5
6
7
8
t = system.file("extdata", "trainingData.txt", package="CRImage")
#read training data
trainingData=read.table(t,header=TRUE)
#create classifier
classifier=createClassifier(trainingData)[[1]]
#classify cells
f = system.file("extdata", "exImg.jpg", package="CRImage")
classesValues=classifyCells(classifier,filename=f,KS=TRUE,maxShape=800,minShape=40,failureRegion=2000)

CRImage documentation built on Nov. 8, 2020, 8:01 p.m.