Last data update: 2014.03.03

R: Cellularity Calculation of Aperio TX Scanner
processAperioR Documentation

Cellularity Calculation of Aperio TX Scanner

Description

Procession of Aperio TX Slides.

Usage

processAperio(classifier=classifier,inputFolder=inputFolder,outputFolder=outputFolder,identifier=identifier,numSlides=numSlides,cancerIdentifier=cancerIdentifier,classOther = NA,maxShape=800,minShape=40,failureRegion=2000,slideToProcess=NA,KS=TRUE,colors=c(),classesToExclude=c(),threshold="otsu",numWindows=2,colorCorrection=FALSE,classifyStructures=FALSE,ksToExclude=c(),pixelClassifier=NA,densityToExclude=c(),numDensityWindows=32,resizeFactor=4,plotCellTypeDensity=TRUE,greyscaleImage=0,penClassifier=NULL,referenceHist=NULL,fontSize = 10)

Arguments

classifier

The classifier.

inputFolder

The path to the image folder.

outputFolder

The path to the output folder.

identifier

The identifier of the files ("Ss" or "Da")

numSlides

The number of sections in the image.

cancerIdentifier

The identifier of the cancer class

classOther

deprecated

maxShape

Maximum size of cell nuclei

minShape

Minimum size of cell nuclei

failureRegion

minimum size of failure regions

slideToProcess

Set this parameter if only a certain slide should be processed

KS

Apply Kernel Smoother?

colors

Colors to paint the classes

classesToExclude

Which class should be excluded?

threshold

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

numWindows

Number of windows to use for thresholding.

colorCorrection

deprecated

classifyStructures

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

ksToExclude

These classes are excluded from kernel smoothing.

pixelClassifier

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

densityToExclude

This class is excluded from cellularity calculation.

numDensityWindows

Number of windows for the density plot.

resizeFactor

Specifies the size of the cell density image. If this variable is not defined, the size of the thumbnail is used for the cell density image, else the size is calculated by size(thumbnail)*resizeFactor. The thumbnail is the small overview image, created by the Aperio software.

plotCellTypeDensity

Plot the density of different cell types?

greyscaleImage

Color channel of the RGB image that should be used for thresholding

penClassifier

Classifier to exclude low quality images (will be part of next release)

referenceHist

Colour Histogram of a reference image that can be used to calculate the quality of the recent image. (will be part of next release)

fontSize

will be part of next release

Details

The function processes images of Aperio TX scanners. The images have to be saved in the CWS format.

Value

Four folders are created in the output folder.

Files

Cellularity values and cell numbers are saved in the file

classifiedImage

Subimages with labeled tumour and non tumour cells

tumourDensity

Cancer heatmaps for every subimage

cellCoordinates

Coordinates and cell class for every cell in the subimage

resizeFactor

Size of the cellularity density image, calculated by size(thumbnail) * resizeFactor. Whereas the thumbnail is the small overview image produced by Aperio.

Author(s)

Henrik Failmezger, failmezger@mpipz.mpg.de

Examples

#t = system.file("extdata", "trainingData.txt", package="CRImage")
#read training data
#trainingData=read.table(t,header=TRUE)
#create classifier
#classifier=createClassifier(trainingData,topo=FALSE)[[1]]
#classify aperio
#f = system.file("extdata",  package="CRImage")
#f=file.path(f,"8905")
#dir.create("AperiOutput")
#takes long time!

f = system.file("extdata",  package="CRImage")
fc=file.path(f,"testClassifier")
load(fc)
fp=file.path(f,"pixelClassifier")
load(fp)
pixelClassifier=model
pathToImage=file.path(f,"8905")

pathToOutput="" #specify an output folder here

#processAperio(classifier=classifier,inputFolder=pathToImage,outputFolder=pathToOutput,identifier="Da",numSlides=1,cancerIdentifier="c",maxShape=800,minShape=40,failureRegion=2000,slideToProcess=1,KS=FALSE,colors=c("white","green","blue","brown"),classesToExclude=c('a','l','nl'),threshold="otsu",ksToExclude=c('l','nl'),pixelClassifier=pixelClassifier,classifyStructures=TRUE,densityToExclude=c('a'),numDensityWindows=8,resizeFactor=1.5,plotCellTypeDensity=FALSE,greyscaleImage=1)

Results


R version 3.3.1 (2016-06-21) -- "Bug in Your Hair"
Copyright (C) 2016 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.

R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.

Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.

> library(CRImage)
Loading required package: EBImage
Loading required package: DNAcopy
Loading required package: aCGH
Loading required package: cluster
Loading required package: survival
Loading required package: multtest
Loading required package: BiocGenerics
Loading required package: parallel

Attaching package: 'BiocGenerics'

The following objects are masked from 'package:parallel':

    clusterApply, clusterApplyLB, clusterCall, clusterEvalQ,
    clusterExport, clusterMap, parApply, parCapply, parLapply,
    parLapplyLB, parRapply, parSapply, parSapplyLB

The following objects are masked from 'package:stats':

    IQR, mad, xtabs

The following objects are masked from 'package:base':

    Filter, Find, Map, Position, Reduce, anyDuplicated, append,
    as.data.frame, cbind, colnames, do.call, duplicated, eval, evalq,
    get, grep, grepl, intersect, is.unsorted, lapply, lengths, mapply,
    match, mget, order, paste, pmax, pmax.int, pmin, pmin.int, rank,
    rbind, rownames, sapply, setdiff, sort, table, tapply, union,
    unique, unsplit

Loading required package: Biobase
Welcome to Bioconductor

    Vignettes contain introductory material; view with
    'browseVignettes()'. To cite Bioconductor, see
    'citation("Biobase")', and for packages 'citation("pkgname")'.


Attaching package: 'Biobase'

The following object is masked from 'package:EBImage':

    channel


Attaching package: 'aCGH'

The following object is masked from 'package:stats':

    heatmap

> png(filename="/home/ddbj/snapshot/RGM3/R_BC/result/CRImage/processAperio.Rd_%03d_medium.png", width=480, height=480)
> ### Name: processAperio
> ### Title: Cellularity Calculation of Aperio TX Scanner
> ### Aliases: processAperio
> ### Keywords: misc
> 
> ### ** Examples
> 
> #t = system.file("extdata", "trainingData.txt", package="CRImage")
> #read training data
> #trainingData=read.table(t,header=TRUE)
> #create classifier
> #classifier=createClassifier(trainingData,topo=FALSE)[[1]]
> #classify aperio
> #f = system.file("extdata",  package="CRImage")
> #f=file.path(f,"8905")
> #dir.create("AperiOutput")
> #takes long time!
> 
> f = system.file("extdata",  package="CRImage")
> fc=file.path(f,"testClassifier")
> load(fc)
> fp=file.path(f,"pixelClassifier")
> load(fp)
> pixelClassifier=model
> pathToImage=file.path(f,"8905")
> 
> pathToOutput="" #specify an output folder here
> 
> #processAperio(classifier=classifier,inputFolder=pathToImage,outputFolder=pathToOutput,identifier="Da",numSlides=1,cancerIdentifier="c",maxShape=800,minShape=40,failureRegion=2000,slideToProcess=1,KS=FALSE,colors=c("white","green","blue","brown"),classesToExclude=c('a','l','nl'),threshold="otsu",ksToExclude=c('l','nl'),pixelClassifier=pixelClassifier,classifyStructures=TRUE,densityToExclude=c('a'),numDensityWindows=8,resizeFactor=1.5,plotCellTypeDensity=FALSE,greyscaleImage=1)
> 
> 
> 
> 
> 
> 
> dev.off()
null device 
          1 
>