segmentImage {CRImage} | R Documentation

## Segmentation of an image

### Description

The function segments cells or cell nuclei in the image.

### Usage

    segmentImage(filename="",image=NA,maxShape=NA,minShape=NA,failureRegion=NA,threshold="otsu",numWindows=2, colorCorrection=FALSE, classifyStructures=FALSE,pixelClassifier=NULL,greyscaleImage=0,penClassifier=NULL,referenceHist=NULL)

### Arguments

`filename` | A path to an image
`image` | An 'image' object, if no filename is specified.
`maxShape` | Maximum size of cell nuclei
`minShape` | Minimum size of cell nuclei
`failureRegion` | minimum size of failure regions
`threshold` | Thresholding method, "otsu" or "phansalkar"
`numWindows` | Number of windows to use for thresholding.
`colorCorrection` | deprecated
`classifyStructures` | Segment structures in the image, if yes a pixel classifier has to be defined
`pixelClassifier` | A SVM which classifies RGB color values in foreground and background.
`greyscaleImage` | Channel of the RGB image, to use for thresholding, if 0 use a joined greyscale image.
`penClassifier` | Classifier to exclude low quality images(will be part of next release)
`referenceHist` | Color histogram of a reference image, that can be used to estimate the quality of the recent image (will be part of next release)

### Details

The image is converted to greyscale and thresholded. Clutter is deleted using morphological operations. Clustered objects are separated using watershed algorithm. Segmented Cell nuclei, which exceed the maximum size are thresholded and segmented again. Cell nuclei which fall below the minimum size are deleted. Dark regions which exceed the parameter failureRegion are considered as artefacts and deleted. If the parameters are not defined, the operations will not be executed. Features are generated for every segmented object.

### Value

A list is returned containing

`image` | The original image
`segmented image` | The segmented image

### Author(s)

Henrik Failmezger, failmezger@cip.ifi.lmu.de

### References

EBImage, 'http://www.bioconductor.org/packages/release/bioc/html/EBImage.html'

### Examples

    #segment image
    #f = system.file('extdata' ,'exImg.jpg',package='CRImage')
    #segmentationValues=segmentImage(f,maxShape=800,minShape=40,failureRegion=2000,threshold="otsu",numWindows=4)
    #image=segmentationValues[[1]]
    #segmentedImage=segmentationValues[[2]]
    #imageFeatures=segmentationValues[[3]]

[Package CRImage version 1.32.0 Index]