ITK
4.4.0
Insight Segmentation and Registration Toolkit
|
#include <itkContourExtractor2DImageFilter.h>
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 GetNumberOfIndexedOutputs() 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://users.polytech.unice.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://hdl.handle.net/1926/165
Definition at line 96 of file itkContourExtractor2DImageFilter.h.
Classes | |
class | ContourType |
struct | VertexHash |
Static Public Member Functions | |
static Pointer | New () |
Static Public Attributes | |
static const unsigned int | InputImageDimension = TInputImage::ImageDimension |
Static Public Attributes inherited from itk::ImageToPathFilter< TInputImage, PolyLineParametricPath< 2 > > | |
static const unsigned int | InputImageDimension |
Private Types | |
typedef vcl_list< ContourType > | ContourContainer |
typedef ContourContainer::iterator | ContourRef |
typedef VertexToContourMap::value_type | VertexContourRefPair |
typedef VertexToContourMap::iterator | VertexMapIterator |
typedef itksys::hash_map < VertexType, ContourRef, VertexHash > | VertexToContourMap |
Private Member Functions | |
void | AddSegment (const VertexType from, const VertexType to) |
ContourExtractor2DImageFilter (const Self &) | |
void | FillOutputs () |
VertexType | InterpolateContourPosition (InputPixelType fromValue, InputPixelType toValue, InputIndexType fromIndex, InputOffsetType toOffset) |
void | operator= (const Self &) |
Additional Inherited Members | |
Protected Types inherited from itk::LightObject | |
typedef int | InternalReferenceCountType |
Protected Attributes inherited from itk::ProcessObject | |
TimeStamp | m_OutputInformationMTime |
bool | m_Updating |
typedef SmartPointer< const Self > itk::ContourExtractor2DImageFilter< TInputImage >::ConstPointer |
Definition at line 112 of file itkContourExtractor2DImageFilter.h.
|
private |
Definition at line 235 of file itkContourExtractor2DImageFilter.h.
|
private |
Definition at line 236 of file itkContourExtractor2DImageFilter.h.
typedef InputImageType::Pointer itk::ContourExtractor2DImageFilter< TInputImage >::InputImagePointer |
Image and path typedef support.
Definition at line 118 of file itkContourExtractor2DImageFilter.h.
typedef TInputImage itk::ContourExtractor2DImageFilter< TInputImage >::InputImageType |
Convenient typedefs for simplifying declarations.
Definition at line 105 of file itkContourExtractor2DImageFilter.h.
typedef InputImageType::IndexType itk::ContourExtractor2DImageFilter< TInputImage >::InputIndexType |
Definition at line 123 of file itkContourExtractor2DImageFilter.h.
typedef InputImageType::OffsetType itk::ContourExtractor2DImageFilter< TInputImage >::InputOffsetType |
Definition at line 124 of file itkContourExtractor2DImageFilter.h.
typedef InputImageType::PixelType itk::ContourExtractor2DImageFilter< TInputImage >::InputPixelType |
Definition at line 122 of file itkContourExtractor2DImageFilter.h.
typedef NumericTraits< InputPixelType >::RealType itk::ContourExtractor2DImageFilter< TInputImage >::InputRealType |
Real type associated to the input pixel type.
Definition at line 131 of file itkContourExtractor2DImageFilter.h.
typedef InputImageType::RegionType itk::ContourExtractor2DImageFilter< TInputImage >::InputRegionType |
Definition at line 125 of file itkContourExtractor2DImageFilter.h.
typedef OutputPathType::Pointer itk::ContourExtractor2DImageFilter< TInputImage >::OutputPathPointer |
Definition at line 126 of file itkContourExtractor2DImageFilter.h.
typedef PolyLineParametricPath< 2 > itk::ContourExtractor2DImageFilter< TInputImage >::OutputPathType |
Definition at line 106 of file itkContourExtractor2DImageFilter.h.
typedef SmartPointer< Self > itk::ContourExtractor2DImageFilter< TInputImage >::Pointer |
Definition at line 111 of file itkContourExtractor2DImageFilter.h.
typedef ContourExtractor2DImageFilter itk::ContourExtractor2DImageFilter< TInputImage >::Self |
Standard class typedefs.
Definition at line 109 of file itkContourExtractor2DImageFilter.h.
typedef ImageToPathFilter< InputImageType, OutputPathType > itk::ContourExtractor2DImageFilter< TInputImage >::Superclass |
Definition at line 110 of file itkContourExtractor2DImageFilter.h.
|
private |
Definition at line 284 of file itkContourExtractor2DImageFilter.h.
typedef VertexListType::ConstPointer itk::ContourExtractor2DImageFilter< TInputImage >::VertexListConstPointer |
Definition at line 134 of file itkContourExtractor2DImageFilter.h.
typedef OutputPathType::VertexListType itk::ContourExtractor2DImageFilter< TInputImage >::VertexListType |
Definition at line 128 of file itkContourExtractor2DImageFilter.h.
|
private |
Definition at line 283 of file itkContourExtractor2DImageFilter.h.
|
private |
Definition at line 282 of file itkContourExtractor2DImageFilter.h.
typedef OutputPathType::VertexType itk::ContourExtractor2DImageFilter< TInputImage >::VertexType |
Definition at line 127 of file itkContourExtractor2DImageFilter.h.
|
protected |
End concept checking
|
protectedvirtual |
|
private |
|
private |
void itk::ContourExtractor2DImageFilter< TInputImage >::ClearRequestedRegion | ( | ) |
|
virtual |
Create an object from an instance, potentially deferring to a factory. This method allows you to create an instance of an object that is exactly the same type as the referring object. This is useful in cases where an object has been cast back to a base class.
Reimplemented from itk::Object.
|
private |
|
protectedvirtual |
This method causes the filter to generate its output.
Reimplemented from itk::ProcessObject.
|
protectedvirtual |
ContourExtractor2DImageFilter manually controls the input requested region via SetRequestedRegion and ClearRequestedRegion, so it must override the superclass method.
Reimplemented from itk::ProcessObject.
|
virtual |
Set/Get the image intensity value that the contours should follow. This is the equivalent of an iso-value in Marching Squares.
|
virtual |
Run-time type information (and related methods).
Reimplemented from itk::ImageToPathFilter< TInputImage, PolyLineParametricPath< 2 > >.
|
virtual |
|
virtual |
Control the orientation of the contours with reference to the image gradient. (See class documentation.)
|
virtual |
Control whether high- or low-valued pixels are vertex-connected. Default is for low-valued pixels to be vertex-connected. (See class documentation.)
|
private |
|
static |
Method for creation through the object factory.
|
private |
|
protectedvirtual |
Methods invoked by Print() to print information about the object including superclasses. Typically not called by the user (use Print() instead) but used in the hierarchical print process to combine the output of several classes.
Reimplemented from itk::ImageToPathFilter< TInputImage, PolyLineParametricPath< 2 > >.
|
virtual |
Control the orientation of the contours with reference to the image gradient. (See class documentation.)
|
virtual |
Control the orientation of the contours with reference to the image gradient. (See class documentation.)
|
virtual |
Set/Get the image intensity value that the contours should follow. This is the equivalent of an iso-value in Marching Squares.
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.
|
virtual |
Control the orientation of the contours with reference to the image gradient. (See class documentation.)
|
virtual |
Control whether high- or low-valued pixels are vertex-connected. Default is for low-valued pixels to be vertex-connected. (See class documentation.)
itk::ContourExtractor2DImageFilter< TInputImage >::typedef | ( | Concept::SameDimension< itkGetStaticConstMacro(InputImageDimension), 2 > | ) |
Begin concept checking This class requires DimensionShouldBe2 in the form of ( Concept::SameDimension< itkGetStaticConstMacro(InputImageDimension), 2 > )
itk::ContourExtractor2DImageFilter< TInputImage >::typedef | ( | Concept::Comparable< InputPixelType > | ) |
This class requires InputPixelTypeComparable in the form of ( Concept::Comparable< InputPixelType > )
itk::ContourExtractor2DImageFilter< TInputImage >::typedef | ( | Concept::HasPixelTraits< InputPixelType > | ) |
This class requires InputHasPixelTraitsCheck in the form of ( Concept::HasPixelTraits< InputPixelType > )
itk::ContourExtractor2DImageFilter< TInputImage >::typedef | ( | Concept::HasNumericTraits< InputPixelType > | ) |
This class requires InputHasNumericTraitsCheck in the form of ( Concept::HasNumericTraits< InputPixelType > )
|
virtual |
Control whether high- or low-valued pixels are vertex-connected. Default is for low-valued pixels to be vertex-connected. (See class documentation.)
|
virtual |
Control whether high- or low-valued pixels are vertex-connected. Default is for low-valued pixels to be vertex-connected. (See class documentation.)
|
static |
Extract dimension from input and output image.
Definition at line 102 of file itkContourExtractor2DImageFilter.h.
|
private |
Definition at line 291 of file itkContourExtractor2DImageFilter.h.
|
private |
Definition at line 287 of file itkContourExtractor2DImageFilter.h.
|
private |
Definition at line 290 of file itkContourExtractor2DImageFilter.h.
|
private |
Definition at line 204 of file itkContourExtractor2DImageFilter.h.
|
private |
Definition at line 209 of file itkContourExtractor2DImageFilter.h.
|
private |
Definition at line 208 of file itkContourExtractor2DImageFilter.h.
|
private |
Definition at line 205 of file itkContourExtractor2DImageFilter.h.
|
private |
Definition at line 207 of file itkContourExtractor2DImageFilter.h.
|
private |
Definition at line 206 of file itkContourExtractor2DImageFilter.h.