Title: ITK Segmentation Methods
1ITK Segmentation Methods
Kitware Inc.
2Overview
- Region Growing
- ConfidenceConnected
- ConnectedThreshold
- IsolatedConnected
- Watersheds
- Level Sets
- FastMarching
- ShapeDetection
- GeodesicActiveContours
- ThresholdSegmentation
- CannySegmentationLevelSet
3Region GrowingSegmentation Methods
4Confidence Connected
Seed Point
5Confidence Connected
typedef itkImagelt unsigned char , 2 gt
ImageType typedef itkConfidenceConnectedImage
Filterlt ImageType, ImageType gt
FilterType FilterTypePointer filter
FilterTypeNew() filter-gtSetMultiplier( 1.5 )
filter-gtSetNumberOfIterations( 5 )
filter-gtSetInitialNeighborhoodRadius ( 2 )
filter-gtSetReplaceValue( 255 )
FilterTypeIndexType index index0 123
index1 235 filter-gtSetSeed( index
) filter-gtSetInput( reader-gtGetOutput() )
writer-gtSetInput( filter-gtGetOutput() )
writer-gtUpdate()
6Connected Threshold
Intensity
Seed Point
7Connected Threshold
typedef itkImagelt unsigned char , 2 gt
ImageType typedef itkConnectedThresholdImageF
ilterlt ImageType, ImageType gt
FilterType FilterTypePointer filter
FilterTypeNew() filter-gtSetLower( 155 )
filter-gtSetUpper( 235 ) filter-gtSetReplaceValu
e( 255 ) FilterTypeIndexType index index0
123 index1 235 filter-gtSetSeed( index
) filter-gtSetInput( reader-gtGetOutput() )
writer-gtSetInput( filter-gtGetOutput() )
writer-gtUpdate()
8Isolated Connected
Intensity
2 Seed Points
9Isolated Connected
typedef itkImagelt unsigned char , 2 gt
ImageType typedef itkIsolatedConnectedImageFi
lterlt ImageType, ImageType gt
FilterType FilterTypePointer filter
FilterTypeNew() filter-gtSetLower( 155 )
filter-gtSetUpperValueLimit( 235 )
filter-gtSetReplaceValue( 255 )
filter-gtSetSeed1( index1 ) filter-gtSetSeed2(
index2 ) filter-gtSetInput( reader-gtGetOutput()
) writer-gtSetInput( filter-gtGetOutput() )
writer-gtUpdate()
10Exercise 12
11WatershedSegmentation
12Watershed Concept
Intensity
13Watershed Segmentation
typedef itkImagelt float , 2 gt
ImageType typedef itkWatershedImageFilterlt
ImageType
gt WatershedFilterType
WatershedFilterTypePointer filter
WatershedFilterTypeNew() filter-gtSetThreshold(
0.001 ) filter-gtSetLevel( 0.15 )
filter-gtSetInput( reader-gtGetOutput() )
filter-gtUpdate()
14Colour Encoding the Output
typedef itkScalarToRGBPixelFunctorlt unsigned
long gt FunctorType typedef
WatershedFilterTypeOutputImageType
LabeledImageType typedef itkUnaryFunctorImage
Filterlt ImageType, LabeledImageType, Fu
nctorType gt ColorFilterType ColorFilter
TypePointer colorFilter ColorFilterTypeNew()
colorFilter-gtSetInput( filter-gtGetOutput()
) writer-gtSetInput( colorFilter-gtGetOutput()
) writer-gtUpdate()
15Creating Edges
typedef itkGradientMagnitudeRecursiveGaussianI
mageFilterlt ImageType, ImageType gt
EdgeFilterType EdgeFilterTypePointer
edgeFilter EdgeFilterTypeNew() edgeFilter-gtS
etInput( reader-gtGetOutput() )
edgeFilter-gtSetSigma( 1.0 )
filter-gtSetInput( edgeFilter-gtGetOutput() )
writer-gtUpdate()
16Exercise 13
17Level SetSegmentation Methods
18Level Set Concept
F(x,y) lt 0
F(x,y) gt 0
Zero set F(x,y)0
19Level Set Evolution
PDE Restricted Cellular Automata
F(x,y,t)
F(x,y,t1)
20Fast Marching
Front propagation
?x V . ?t
21Fast Marching
Speed Image
Time-Crossing Map
22Fast Marching
typedef itkImagelt float , 2 gt
ImageType typedef itkFastMarchingImageFilterlt
ImageType, ImageType gt FilterType Filter
TypePointer fastMarching
FilterTypeNew() fastMarching-gtSetInput (
speedImage ) fastMarching-gtSetOutputSize(
speedImage-gtGetBufferedRegion().GetSize() )
fastMarching-gtSetStoppingValue( 100.0 )
23Fast Marching
typedef FilterTypeNodeContainer
NodeContainer typedef FilterTypeNodeType No
deType NodeContainerPointer seeds
NodeContainerNew() seeds-gtInitialize()
NodeType seed seed.SetValue( 0.0
) seed.SetIndex( index ) seeds-gtInsertElement(
0, seed )
24Fast Marching
fastMarching-gtSetTrialPoints( seeds )
thresholder-gtSetInput( fastMarching-gtGetOutput(
) ) thresholder-gtSetLowerThreshold( 0.0
) thresholder-gtSetUpperThreshold( timeThreshold
) thresholder-gtUpdate()
25Exercise 14
26Shape Detection
PDE Includes a curvature term
Prevents leaking
27Shape Detection
28Shape Detection
typedef itkImagelt float , 2 gt
ImageType typedef itkShapeDetectionLevelSetIm
ageFilterlt
ImageType, ImageType gt
FilterType FilterTypePointer shapeDetection
FilterTypeNew() shapeDetection-gtSetInput(
inputLevelSet ) shapeDetection-gtSetFeatureImage(
speedImage ) shapeDetection-gtSetPropagationSca
ling( 1.0 ) shapeDetection-gtSetCurvatureScaling(
0.05 )
29Shape Detection
shapeDetection-gtSetMaximumRMSError( 0.001 )
shapeDetection-gtSetMaximumIterations( 400 )
shapeDetection-gtUpdate() stdcout ltlt
shapeDetection-gtGetRMSChange() ltlt stdendl
stdcout ltlt shapeDetection-gtGetElapsedIterations
() ltlt stdendl thresholder-gtSetInput(
shapeDetection-gtGetOutput() ) thresholder-gtSetLo
werThreshold( -1e7 ) thresholder-gtSetUpperThresh
old( 0.0 )
30Exercise 15
31Geodesic Active Contour
Intensity Profile
X axis
Advection term added
32Geodesic Active Contour
Vector Field Computed Internally
33Geodesic Active Contour
typedef itkImagelt float , 2 gt
ImageType typedef itkGeodesicActiveContourLev
elSetImageFilterlt
ImageType, ImageType gt
FilterType FilterTypePointer
geodesicActiveContour FilterTypeNew() geod
esicActiveContour-gtSetInput( inputLevelSet )
geodesicActiveContour-gtSetFeatureImage(
speedImage ) geodesicActiveContour-gtSetPropagat
ionScaling( 1.0 ) geodesicActiveContour-gtSetCurv
atureScaling( 0.05 ) geodesicActiveContour-gtSetA
dvectionScaling( 8.0 )
34Geodesic Active Contours
geodesicActiveContour-gtSetMaximumRMSError( 0.001
) geodesicActiveContour-gtSetMaximumIterations(
400 ) geodesicActiveContour-gtUpdate() stdco
ut ltlt geodesicActiveContour-gtGetRMSChange() ltlt
stdendl stdcout ltlt geodesicActiveContour-gtGe
tElapsedIterations() ltlt stdendl
thresholder-gtSetInput( geodesicActiveContour
) thresholder-gtSetLowerThreshold( -1e7 )
thresholder-gtSetUpperThreshold( 0.0 )
35Exercise 16
36Threshold Level Set
Advection term added controlled by a threshold
LevelSet equivalent of a connected components
method inside a threshold
but with options for preventing leaks
37Threshold Segmentation
typedef itkImagelt float , 2 gt
ImageType typedef itkThresholdSegmentationLev
elSetImageFilterlt
ImageType, ImageType gt
FilterType FilterTypePointer
thresholdSegmentation FilterTypeNew() thre
sholdSegmentation-gtSetInput( inputLevelSet )
thresholdSegmentation-gtSetFeatureImage(
inputImage ) thresholdSegmentation-gtSetPropagat
ionScaling( 1.0 ) thresholdSegmentation-gtSetCurv
atureScaling( 5.0 ) thresholdSegmentation-gtSetAd
vectionScaling( 2.0 )
38Threshold Segmentation
thresholdSegmentation-gtSetMaximumRMSError( 0.001
) thresholdSegmentation-gtSetMaximumIterations(
400 ) thresholdSegmentation-gtSetLowerThreshold(
210 ) thresholdSegmentation-gtSetUpperThreshold(
250 ) thresholdSegmentation-gtSetIsoSurface(
0.0 ) // zero set thresholdSegmentation-gtSetUs
eNegativeFeaturesOn() thresholdSegmentation-gtUpd
ate()
39Exercise 17
40Threshold Level Set
Advection term added controlled by edges
Canny edges attract the zero set
41Canny Segmentation
typedef itkImagelt float , 2 gt
ImageType typedef itkCannySegmentationLevelSe
tImageFilterlt
ImageType, ImageType gt
FilterType FilterTypePointer
cannySegmentation FilterTypeNew() cannySeg
mentation-gtSetInput( inputLevelSet )
cannySegmentation-gtSetFeatureImage( inputImage
) cannySegmentation-gtSetPropagationScaling(
0.0 ) cannySegmentation-gtSetCurvatureScaling(
1.0 ) cannySegmentation-gtSetAdvectionScaling(
2.0 ) // canny edges
42Canny Segmentation
cannySegmentation-gtSetMaximumRMSError( 0.01 )
cannySegmentation-gtSetMaximumIterations( 400 )
cannySegmentation-gtSetThreshold( 2.0 )
cannySegmentation-gtSetVariance( 1.0 )
cannySegmentation-gtSetIsoSurface( 127.0 ) //
zero set cannySegmentation-gtSetUseNegativeFeatur
esOn() cannySegmentation-gtUpdate()
43Exercise 18
44Enjoy ITK !