Medical Imaging Interaction Toolkit  2024.06.00
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 > >
virtual const char * GetClassName () const
 
 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 ()
 
 ~ContourExtractor2DImageFilter () override
 
void PrintSelf (std::ostream &os, Indent indent) const override
 
void GenerateData () override
 
void GenerateInputRequestedRegion () override
 
- Protected Member Functions inherited from itk::ImageToPathFilter< TInputImage, PolyLineParametricPath< 2 > >
 ImageToPathFilter ()
 
 ~ImageToPathFilter () override
 
void PrintSelf (std::ostream &os, Indent indent) const override
 

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).

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.

See also
Image
Path
PolyLineParametricPath

Definition at line 91 of file itkContourExtractor2DImageFilter.h.

Member Typedef Documentation

◆ ConstPointer

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

Definition at line 105 of file itkContourExtractor2DImageFilter.h.

◆ InputImagePointer

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

Image and path typedef support.

Definition at line 112 of file itkContourExtractor2DImageFilter.h.

◆ InputImageType

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

Convenient typedefs for simplifying declarations.

Definition at line 98 of file itkContourExtractor2DImageFilter.h.

◆ InputIndexType

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

Definition at line 117 of file itkContourExtractor2DImageFilter.h.

◆ InputOffsetType

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

Definition at line 118 of file itkContourExtractor2DImageFilter.h.

◆ InputPixelType

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

Definition at line 116 of file itkContourExtractor2DImageFilter.h.

◆ InputRealType

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

Real type associated to the input pixel type.

Definition at line 125 of file itkContourExtractor2DImageFilter.h.

◆ InputRegionType

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

Definition at line 119 of file itkContourExtractor2DImageFilter.h.

◆ OutputPathPointer

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

Definition at line 120 of file itkContourExtractor2DImageFilter.h.

◆ OutputPathType

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

Definition at line 99 of file itkContourExtractor2DImageFilter.h.

◆ Pointer

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

Definition at line 104 of file itkContourExtractor2DImageFilter.h.

◆ Self

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

Standard class typedefs.

Definition at line 102 of file itkContourExtractor2DImageFilter.h.

◆ Superclass

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

Definition at line 103 of file itkContourExtractor2DImageFilter.h.

◆ VertexListConstPointer

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

Definition at line 127 of file itkContourExtractor2DImageFilter.h.

◆ VertexListType

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

Definition at line 122 of file itkContourExtractor2DImageFilter.h.

◆ VertexType

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

Definition at line 121 of file itkContourExtractor2DImageFilter.h.

Constructor & Destructor Documentation

◆ ContourExtractor2DImageFilter()

template<class TInputImage >
itk::ContourExtractor2DImageFilter< TInputImage >::ContourExtractor2DImageFilter ( )
protected

◆ ~ContourExtractor2DImageFilter()

template<class TInputImage >
itk::ContourExtractor2DImageFilter< TInputImage >::~ContourExtractor2DImageFilter ( )
overrideprotected

Member Function Documentation

◆ ClearRequestedRegion()

template<class TInputImage >
void itk::ContourExtractor2DImageFilter< TInputImage >::ClearRequestedRegion ( )

◆ Clone()

template<class TInputImage >
Pointer itk::ContourExtractor2DImageFilter< TInputImage >::Clone ( ) const

◆ GenerateData()

template<class TInputImage >
void itk::ContourExtractor2DImageFilter< TInputImage >::GenerateData ( )
overrideprotected

◆ GenerateInputRequestedRegion()

template<class TInputImage >
void itk::ContourExtractor2DImageFilter< TInputImage >::GenerateInputRequestedRegion ( )
overrideprotected

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

◆ GetClassName()

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

Run-time type information (and related methods).

◆ GetContourValue()

template<class TInputImage >
virtual const InputRealType& itk::ContourExtractor2DImageFilter< TInputImage >::GetContourValue ( )
virtual

◆ GetRequestedRegion()

template<class TInputImage >
virtual const InputRegionType& itk::ContourExtractor2DImageFilter< TInputImage >::GetRequestedRegion ( )
virtual

◆ GetReverseContourOrientation()

template<class TInputImage >
virtual const bool& itk::ContourExtractor2DImageFilter< TInputImage >::GetReverseContourOrientation ( )
virtual

◆ GetVertexConnectHighPixels()

template<class TInputImage >
virtual const bool& itk::ContourExtractor2DImageFilter< TInputImage >::GetVertexConnectHighPixels ( )
virtual

◆ itkStaticConstMacro()

template<class TInputImage >
itk::ContourExtractor2DImageFilter< TInputImage >::itkStaticConstMacro ( InputImageDimension  ,
unsigned int  ,
TInputImage::ImageDimension   
)

Extract dimension from input and output image.

◆ New()

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

Method for creation through the object factory.

◆ PrintSelf()

template<class TInputImage >
void itk::ContourExtractor2DImageFilter< TInputImage >::PrintSelf ( std::ostream &  os,
Indent  indent 
) const
overrideprotected

◆ ReverseContourOrientationOff()

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

◆ ReverseContourOrientationOn()

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

◆ SetContourValue()

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.

◆ SetRequestedRegion()

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.

◆ SetReverseContourOrientation()

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.)

◆ SetVertexConnectHighPixels()

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.)

◆ VertexConnectHighPixelsOff()

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

◆ VertexConnectHighPixelsOn()

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

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