Medical Imaging Interaction Toolkit  2016.11.0
Medical Imaging Interaction Toolkit
itk::ContourExtractor2DImageFilter< TInputImage > Class Template Reference

Computes a list of PolyLineParametricPath objects from the contours in a 2D image. More...

#include <itkContourExtractor2DImageFilter.h>

Inheritance diagram for itk::ContourExtractor2DImageFilter< TInputImage >:
Collaboration diagram for itk::ContourExtractor2DImageFilter< TInputImage >:

Public Types

typedef TInputImage InputImageType
 
typedef PolyLineParametricPath< 2 > OutputPathType
 
typedef ContourExtractor2DImageFilter Self
 
typedef ImageToPathFilter< InputImageType, OutputPathTypeSuperclass
 
typedef SmartPointer< SelfPointer
 
typedef SmartPointer< const SelfConstPointer
 
typedef InputImageType::Pointer InputImagePointer
 
typedef InputImageType::PixelType InputPixelType
 
typedef InputImageType::IndexType InputIndexType
 
typedef InputImageType::OffsetType InputOffsetType
 
typedef InputImageType::RegionType InputRegionType
 
typedef OutputPathType::Pointer OutputPathPointer
 
typedef OutputPathType::VertexType VertexType
 
typedef OutputPathType::VertexListType VertexListType
 
typedef NumericTraits< InputPixelType >::RealType InputRealType
 
typedef VertexListType::ConstPointer VertexListConstPointer
 
- Public Types inherited from itk::ImageToPathFilter< TInputImage, PolyLineParametricPath< 2 > >
typedef ImageToPathFilter Self
 
typedef PathSource< PolyLineParametricPath< 2 > > Superclass
 
typedef SmartPointer< SelfPointer
 
typedef SmartPointer< const SelfConstPointer
 
typedef TInputImage InputImageType
 
typedef InputImageType::Pointer InputImagePointer
 
typedef InputImageType::ConstPointer InputImageConstPointer
 
typedef InputImageType::RegionType InputImageRegionType
 
typedef InputImageType::PixelType InputImagePixelType
 

Public Member Functions

 itkStaticConstMacro (InputImageDimension, unsigned int, TInputImage::ImageDimension)
 
Pointer Clone () const
 
virtual const char * GetClassName () const
 
virtual void SetReverseContourOrientation (bool _arg)
 
virtual const bool & GetReverseContourOrientation ()
 
virtual void ReverseContourOrientationOn ()
 
virtual void ReverseContourOrientationOff ()
 
virtual void SetVertexConnectHighPixels (bool _arg)
 
virtual const bool & GetVertexConnectHighPixels ()
 
virtual void VertexConnectHighPixelsOn ()
 
virtual void VertexConnectHighPixelsOff ()
 
void SetRequestedRegion (const InputRegionType region)
 
virtual const InputRegionTypeGetRequestedRegion ()
 
void ClearRequestedRegion ()
 
virtual void SetContourValue (InputRealType _arg)
 
virtual const InputRealTypeGetContourValue ()
 
- Public Member Functions inherited from itk::ImageToPathFilter< TInputImage, PolyLineParametricPath< 2 > >
 itkStaticConstMacro (InputImageDimension, unsigned int, TInputImage::ImageDimension)
 
virtual void SetInput (const InputImageType *image)
 
virtual void SetInput (unsigned int, const TInputImage *image)
 
const InputImageTypeGetInput (void)
 
const InputImageTypeGetInput (unsigned int idx)
 

Static Public Member Functions

static Pointer New ()
 

Protected Member Functions

 ContourExtractor2DImageFilter ()
 
virtual ~ContourExtractor2DImageFilter ()
 
void PrintSelf (std::ostream &os, Indent indent) const
 
void GenerateData ()
 
virtual void GenerateInputRequestedRegion () throw (InvalidRequestedRegionError)
 
- Protected Member Functions inherited from itk::ImageToPathFilter< TInputImage, PolyLineParametricPath< 2 > >
 ImageToPathFilter ()
 
 ~ImageToPathFilter ()
 

Detailed Description

template<class TInputImage>
class itk::ContourExtractor2DImageFilter< TInputImage >

Computes a list of PolyLineParametricPath objects from the contours in a 2D image.

Uses the "marching squares" method to compute a the iso-valued contours of the input 2D image for a given intensity value. Multiple outputs may be produced because an image can have multiple contours at a given level, so it is advised to call GetNumberOfOutputs() and GetOutput(n) to retrieve all of the contours. The contour value to be extracted can be set with SetContourValue(). Image intensities will be linearly interpolated to provide sub-pixel resolution for the output contours.

The marching squares algorithm is a special case of the marching cubes algorithm (Lorensen, William and Harvey E. Cline. Marching Cubes: A High Resolution 3D Surface Construction Algorithm. Computer Graphics (SIGGRAPH 87 Proceedings) 21(4) July 1987, p. 163-170). A simple explanation is available here: http://www.essi.fr/~lingrand/MarchingCubes/algo.html

There is a single ambiguous case in the marching squares algorithm: if a given 2x2-pixel square has two high-valued and two low-valued pixels, each pair diagonally adjacent. (Where high- and low-valued is with respect to the contour value sought.) In this case, either the high-valued pixels can be connected into the same "object" (where groups of pixels encircled by a given contour are considered an object), or the low-valued pixels can be connected. This is the "face connected" versus "face + vertex connected" (or 4- versus 4-connected) distinction: high-valued pixels most be treated as one, and low-valued as the other. By default, high-valued pixels are treated as "face-connected" and low-valued pixels are treated as "face + vertex" connected. To reverse this, call VertexConnectHighPixelsOn();

Outputs are not guaranteed to be closed paths: contours which intersect the image edge will be left open. All other paths will be closed. (The closed-ness of a path can be tested by checking whether the beginning point is the same as the end point.)

Produced paths are oriented. Following the path from beginning to end, image intensity values lower than the contour value are to the left of the path and intensity values grater than the contour value are to the right. In other words, the image gradient at a path segment is (approximately) in the direct of that segment rotated right by 90 degrees, because the image intensity values increase from left-to-right across the segment. This means that the generated contours will circle clockwise around "hills" of above-contour-value intensity, and counter-clockwise around "depressions" of below-contour-value intensity. This convention can be reversed by calling ReverseContourOrientationOn().

By default the input image's largest possible region will be processed; call SetRequestedRegion() to process a different region, or ClearRequestedRegion() to revert to the default value. Note that the requested regions are usually set on the output; however since paths have no notion of a "region", this must be set at the filter level.

This class was contributed to the Insight Journal by Zachary Pincus. http://insight-journal.org/midas/handle.php?handle=1926/165

See also
Image
Path
PolyLineParametricPath

Definition at line 97 of file itkContourExtractor2DImageFilter.h.

Member Typedef Documentation

template<class TInputImage >
typedef SmartPointer<const Self> itk::ContourExtractor2DImageFilter< TInputImage >::ConstPointer

Definition at line 111 of file itkContourExtractor2DImageFilter.h.

template<class TInputImage >
typedef InputImageType::Pointer itk::ContourExtractor2DImageFilter< TInputImage >::InputImagePointer

Image and path typedef support.

Definition at line 117 of file itkContourExtractor2DImageFilter.h.

template<class TInputImage >
typedef TInputImage itk::ContourExtractor2DImageFilter< TInputImage >::InputImageType

Convenient typedefs for simplifying declarations.

Definition at line 104 of file itkContourExtractor2DImageFilter.h.

template<class TInputImage >
typedef InputImageType::IndexType itk::ContourExtractor2DImageFilter< TInputImage >::InputIndexType

Definition at line 122 of file itkContourExtractor2DImageFilter.h.

template<class TInputImage >
typedef InputImageType::OffsetType itk::ContourExtractor2DImageFilter< TInputImage >::InputOffsetType

Definition at line 123 of file itkContourExtractor2DImageFilter.h.

template<class TInputImage >
typedef InputImageType::PixelType itk::ContourExtractor2DImageFilter< TInputImage >::InputPixelType

Definition at line 121 of file itkContourExtractor2DImageFilter.h.

template<class TInputImage >
typedef NumericTraits<InputPixelType>::RealType itk::ContourExtractor2DImageFilter< TInputImage >::InputRealType

Real type associated to the input pixel type.

Definition at line 130 of file itkContourExtractor2DImageFilter.h.

template<class TInputImage >
typedef InputImageType::RegionType itk::ContourExtractor2DImageFilter< TInputImage >::InputRegionType

Definition at line 124 of file itkContourExtractor2DImageFilter.h.

template<class TInputImage >
typedef OutputPathType::Pointer itk::ContourExtractor2DImageFilter< TInputImage >::OutputPathPointer

Definition at line 125 of file itkContourExtractor2DImageFilter.h.

template<class TInputImage >
typedef PolyLineParametricPath<2> itk::ContourExtractor2DImageFilter< TInputImage >::OutputPathType

Definition at line 105 of file itkContourExtractor2DImageFilter.h.

template<class TInputImage >
typedef SmartPointer<Self> itk::ContourExtractor2DImageFilter< TInputImage >::Pointer

Definition at line 110 of file itkContourExtractor2DImageFilter.h.

template<class TInputImage >
typedef ContourExtractor2DImageFilter itk::ContourExtractor2DImageFilter< TInputImage >::Self

Standard class typedefs.

Definition at line 108 of file itkContourExtractor2DImageFilter.h.

template<class TInputImage >
typedef ImageToPathFilter<InputImageType, OutputPathType> itk::ContourExtractor2DImageFilter< TInputImage >::Superclass

Definition at line 109 of file itkContourExtractor2DImageFilter.h.

template<class TInputImage >
typedef VertexListType::ConstPointer itk::ContourExtractor2DImageFilter< TInputImage >::VertexListConstPointer

Definition at line 132 of file itkContourExtractor2DImageFilter.h.

template<class TInputImage >
typedef OutputPathType::VertexListType itk::ContourExtractor2DImageFilter< TInputImage >::VertexListType

Definition at line 127 of file itkContourExtractor2DImageFilter.h.

template<class TInputImage >
typedef OutputPathType::VertexType itk::ContourExtractor2DImageFilter< TInputImage >::VertexType

Definition at line 126 of file itkContourExtractor2DImageFilter.h.

Constructor & Destructor Documentation

template<class TInputImage >
itk::ContourExtractor2DImageFilter< TInputImage >::ContourExtractor2DImageFilter ( )
protected
template<class TInputImage >
virtual itk::ContourExtractor2DImageFilter< TInputImage >::~ContourExtractor2DImageFilter ( )
protectedvirtual

Member Function Documentation

template<class TInputImage >
void itk::ContourExtractor2DImageFilter< TInputImage >::ClearRequestedRegion ( )
template<class TInputImage >
Pointer itk::ContourExtractor2DImageFilter< TInputImage >::Clone ( ) const
template<class TInputImage >
void itk::ContourExtractor2DImageFilter< TInputImage >::GenerateData ( )
protected
template<class TInputImage >
virtual void itk::ContourExtractor2DImageFilter< TInputImage >::GenerateInputRequestedRegion ( )
throw (InvalidRequestedRegionError
)
protectedvirtual

ContourExtractor2DImageFilter manually controls the input requested region via SetRequestedRegion and ClearRequestedRegion, so it must override the superclass method.

template<class TInputImage >
virtual const char* itk::ContourExtractor2DImageFilter< TInputImage >::GetClassName ( ) const
virtual

Run-time type information (and related methods).

Reimplemented from itk::ImageToPathFilter< TInputImage, PolyLineParametricPath< 2 > >.

template<class TInputImage >
virtual const InputRealType& itk::ContourExtractor2DImageFilter< TInputImage >::GetContourValue ( )
virtual
template<class TInputImage >
virtual const InputRegionType& itk::ContourExtractor2DImageFilter< TInputImage >::GetRequestedRegion ( )
virtual
template<class TInputImage >
virtual const bool& itk::ContourExtractor2DImageFilter< TInputImage >::GetReverseContourOrientation ( )
virtual
template<class TInputImage >
virtual const bool& itk::ContourExtractor2DImageFilter< TInputImage >::GetVertexConnectHighPixels ( )
virtual
template<class TInputImage >
itk::ContourExtractor2DImageFilter< TInputImage >::itkStaticConstMacro ( InputImageDimension  ,
unsigned  int,
TInputImage::ImageDimension   
)

Extract dimension from input and output image.

template<class TInputImage >
static Pointer itk::ContourExtractor2DImageFilter< TInputImage >::New ( )
static

Method for creation through the object factory.

template<class TInputImage >
void itk::ContourExtractor2DImageFilter< TInputImage >::PrintSelf ( std::ostream &  os,
Indent  indent 
) const
protectedvirtual
template<class TInputImage >
virtual void itk::ContourExtractor2DImageFilter< TInputImage >::ReverseContourOrientationOff ( )
virtual
template<class TInputImage >
virtual void itk::ContourExtractor2DImageFilter< TInputImage >::ReverseContourOrientationOn ( )
virtual
template<class TInputImage >
virtual void itk::ContourExtractor2DImageFilter< TInputImage >::SetContourValue ( InputRealType  _arg)
virtual

Set/Get the image intensity value that the contours should follow. This is the equivalent of an iso-value in Marching Squares.

template<class TInputImage >
void itk::ContourExtractor2DImageFilter< TInputImage >::SetRequestedRegion ( const InputRegionType  region)

Control whether the largest possible input region is used, or if a custom requested region is to be used.

template<class TInputImage >
virtual void itk::ContourExtractor2DImageFilter< TInputImage >::SetReverseContourOrientation ( bool  _arg)
virtual

Control the orientation of the contours with reference to the image gradient. (See class documentation.)

template<class TInputImage >
virtual void itk::ContourExtractor2DImageFilter< TInputImage >::SetVertexConnectHighPixels ( bool  _arg)
virtual

Control whether high- or low-valued pixels are vertex-connected. Default is for low-valued pixels to be vertex-connected. (See class documentation.)

template<class TInputImage >
virtual void itk::ContourExtractor2DImageFilter< TInputImage >::VertexConnectHighPixelsOff ( )
virtual
template<class TInputImage >
virtual void itk::ContourExtractor2DImageFilter< TInputImage >::VertexConnectHighPixelsOn ( )
virtual

The documentation for this class was generated from the following file: