ITK
5.0.0
Insight Segmentation and Registration Toolkit
|
#include <itkKLMRegionGrowImageFilter.h>
Base class for a region growing object that performs energy-based region growing for multiband images.
itkKLMRegionGrowImageFilter is the base class for the KLMRegionGrowImageFilter objects. This object performs energy-based region growing for multiband images. Since this is based on G. Koepfler,C. Lopez and J. M. Morel's work described below, the acronym KLM is added at the end of the object name.
The ApplyRegionGrowImageFilter() function implements the segmentation algorithm that partitions the input image into non-overlapping regions by minimizing an energy functional which trades off the similarity of regions against the length of their shared boundary. The heart of the process relies on the MergeRegion() method that calls a private function to perform the merging of region based on the piecewise constant KLM algorithm for region merging. For extensibility purposes, the MergeRegion() function is made virtual. Extensions can be made possible using function overloading or overriding the virtual function in a derived class. It starts by breaking the image into many small regions and fitting the regions to a polynomial model. The algorithm iteratively merges into one region the two adjoining regions which are most alike in terms of the specified polynomial model given the length of the border between the two regions. Internally, the energy functional is evaluated using a Lagrangian parameter called lambda which is also called the scale parameter as it controls the coarseness of the segmentation where a small value of lambda corresponds to a finer segmentation with more regions and a large value corresponds to a coarse segmentation with fewer regions. Since the algorithm grows regions by merging like regions, the internal value of lambda increases as the number of regions decreases.
The user can stop the merging of regions using the SetMaximumNumberOfRegions() and SetMaximumLambda() functions. The SetMaximumNumberOfRegions() function is publicly inherited from its base class and internally sets the m_MaximumNumberOfRegions parameter. The SetMaximumLambda() function sets the m_MaximumLambda parameter. If the number of regions in the image is equal to m_MaximumNumberOfRegions or if the internal energy functional becomes greater than m_MaximumLambda, then the merging iterations will stop. Note that a larger energy function value for m_MaximumLambda will result in fewer boundaries and fewer regions, while a smaller value for m_MaximumLambda will result in more boundaries and more regions. To have m_MaximumNumberOfRegions control exactly the number of output regions, m_MaximumLamda should be set to a very large number. To have m_MaximumLambda control exactly the number of output regions, m_MaximumNumberOfRegions should be set to 2. As a default value, m_MaximumLambda is set to 1000 and m_MaximumNumberOfRegions is set to 2.
Currently implementation puts equal weight to the multichannel values. In future improvements we plan to allow the user to control the weights associated with each individual channels.
It is templated over the type of input and output image. This object supports data handling of multiband images. The object accepts images in vector format, where each pixel is a vector and each element of the vector corresponds to an entry from 1 particular band of a multiband dataset. We expect the user to provide the input to the routine in vector format. A single band image is treated as a vector image with a single element for every vector.
This algorithm implementation takes a multiband image stored in vector format as input and produces two outputs. Using the ImageToImageFilter, the piecewise constant approximation image is the output calculated using the process update mechanism. The second output, i.e., the image with the region labels (segmentation image) is returned at users request by calling GetLabelledImage() function. This function returns a reference to the labelled image determined using the KLM algorithm. The algorithm supports 2D and 3D data sets only. The input image dimensions must be exact multiples of the user specified gridsizes. Appropriate padding must be performed by the user if any image which are not multiples of the gridsizes are used.
For more information about the algorithm, see G. Koepfler, C. Lopez and J. M. Morel, ``A Multiscale Algorithm for Image Segmentation by Variational Method,'' {SIAM Journal of Numerical Analysis}, vol. 31, pp. 282-299, 1994.
Algorithm details:
This function segments a two-dimensional input image into non-overlapping atomic regions , where is the total number of region, by minimizing the following energy functional (also known as the simplified Mumford and Shah functional): , where denotes the domain of an image, is the input image, and is an approximation of . Furthermore, is defined to be piecewise constant in regions . If represents the boundary of the region, denotes the set of all region boundaries and is the total length of the boundaries. The parameter controls the coarseness of the segmentation (i.e. a larger will result in fewer boundaries).
Starting with small, piecewise-constant initial regions the algorithm iteratively merges the two adjacent regions and which most decrease the energy functional. In other words, the merging criterion is based on the difference between the current energy and the energy that would result after a merge, , where is the piecewise constant approximation of the input image , and is the common boundary between region and . It can be shown that .
Once two regions are merged the following update equations are used to calculated the constant approximation of the new region:
.
Again, the merging of regions continues until the desired number of regions has been reached or until the desired coarseness (specified by the scale parameter ) has been reached.
The two outputs are possible to derive from the object: (1) u, the piecewise constant approximation (mean of the regions) to the input image set; This is currently generated by the process object pipeline and the (2) the labelled regions in the input image set is generated by the GetLabelledImage() function.
Definition at line 165 of file itkKLMRegionGrowImageFilter.h.
Static Public Member Functions | |
static Pointer | New () |
Static Public Member Functions inherited from itk::Object | |
static bool | GetGlobalWarningDisplay () |
static void | GlobalWarningDisplayOff () |
static void | GlobalWarningDisplayOn () |
static Pointer | New () |
static void | SetGlobalWarningDisplay (bool flag) |
Static Public Member Functions inherited from itk::LightObject | |
static void | BreakOnError () |
static Pointer | New () |
Static Public Attributes | |
static constexpr unsigned int | InputImageDimension = TInputImage::ImageDimension |
static constexpr unsigned int | InputImageVectorDimension = InputImagePixelType::Dimension |
static constexpr RegionLabelType | LabelImageDimension = InputImageDimension |
static constexpr unsigned int | OutputImageDimension = TOutputImage::ImageDimension |
static constexpr unsigned int | OutputImageVectorDimension = OutputImagePixelType::Dimension |
Static Public Attributes inherited from itk::ImageToImageFilter< TInputImage, TOutputImage > | |
static constexpr unsigned int | InputImageDimension = TInputImage::ImageDimension |
static constexpr unsigned int | OutputImageDimension = TOutputImage::ImageDimension |
Static Public Attributes inherited from itk::ImageSource< TOutputImage > | |
static constexpr unsigned int | OutputImageDimension = TOutputImage::ImageDimension |
Private Types | |
using | InputImageSizeType = typename TInputImage::SizeType |
using | KLMSegmentationBorderPtr = typename KLMSegmentationBorder::Pointer |
using | KLMSegmentationRegionPtr = typename KLMSegmentationRegion::Pointer |
Private Attributes | |
KLMSegmentationBorderArrayPtr * | m_BorderCandidate {nullptr} |
std::vector < KLMSegmentationBorderArrayPtr > | m_BordersDynamicPointer |
std::vector < KLMSegmentationBorderPtr > | m_BordersPointer |
unsigned int | m_InitialNumberOfRegions {0} |
double | m_InitialRegionArea {0} |
MeanRegionIntensityType | m_InitialRegionMean |
double | m_InternalLambda {0} |
double | m_MaximumLambda {1000} |
unsigned int | m_NumberOfRegions {0} |
std::vector < KLMSegmentationRegionPtr > | m_RegionsPointer |
double | m_TotalBorderLength {0.0} |
Additional Inherited Members | |
Protected Types inherited from itk::ImageToImageFilter< TInputImage, TOutputImage > | |
using | InputToOutputRegionCopierType = ImageToImageFilterDetail::ImageRegionCopier< Self::OutputImageDimension, Self::InputImageDimension > |
using | OutputToInputRegionCopierType = ImageToImageFilterDetail::ImageRegionCopier< Self::InputImageDimension, Self::OutputImageDimension > |
Static Protected Member Functions inherited from itk::ImageSource< TOutputImage > | |
static const ImageRegionSplitterBase * | GetGlobalDefaultSplitter () |
static ITK_THREAD_RETURN_FUNCTION_CALL_CONVENTION | ThreaderCallback (void *arg) |
Protected Attributes inherited from itk::ImageSource< TOutputImage > | |
bool | m_DynamicMultiThreading |
Protected Attributes inherited from itk::ProcessObject | |
TimeStamp | m_OutputInformationMTime |
bool | m_Updating |
Protected Attributes inherited from itk::LightObject | |
std::atomic< int > | m_ReferenceCount |
using itk::KLMRegionGrowImageFilter< TInputImage, TOutputImage >::BorderType = KLMSegmentationBorder |
Type definition for the smart border type.
Definition at line 260 of file itkKLMRegionGrowImageFilter.h.
using itk::KLMRegionGrowImageFilter< TInputImage, TOutputImage >::ConstPointer = SmartPointer< const Self > |
Definition at line 174 of file itkKLMRegionGrowImageFilter.h.
using itk::KLMRegionGrowImageFilter< TInputImage, TOutputImage >::GridSizeType = typename Superclass::GridSizeType |
Type definition for the input grid size type used to create initial atomic regions.
Definition at line 208 of file itkKLMRegionGrowImageFilter.h.
using itk::KLMRegionGrowImageFilter< TInputImage, TOutputImage >::InputImageConstIterator = ImageRegionConstIterator< TInputImage > |
Definition at line 201 of file itkKLMRegionGrowImageFilter.h.
using itk::KLMRegionGrowImageFilter< TInputImage, TOutputImage >::InputImageConstPointer = typename TInputImage::ConstPointer |
Definition at line 185 of file itkKLMRegionGrowImageFilter.h.
using itk::KLMRegionGrowImageFilter< TInputImage, TOutputImage >::InputImageIndexType = typename TInputImage::IndexType |
Type definition for the input image index type.
Definition at line 197 of file itkKLMRegionGrowImageFilter.h.
using itk::KLMRegionGrowImageFilter< TInputImage, TOutputImage >::InputImageIterator = ImageRegionIterator< TInputImage > |
Type definition for the image iterators to be used.
Definition at line 200 of file itkKLMRegionGrowImageFilter.h.
using itk::KLMRegionGrowImageFilter< TInputImage, TOutputImage >::InputImagePixelType = typename TInputImage::PixelType |
Type definition for the input image pixel type.
Definition at line 188 of file itkKLMRegionGrowImageFilter.h.
using itk::KLMRegionGrowImageFilter< TInputImage, TOutputImage >::InputImagePointer = typename TInputImage::Pointer |
Definition at line 184 of file itkKLMRegionGrowImageFilter.h.
|
private |
Definition at line 357 of file itkKLMRegionGrowImageFilter.h.
using itk::KLMRegionGrowImageFilter< TInputImage, TOutputImage >::InputImageType = TInputImage |
Type definition for the input image.
Definition at line 183 of file itkKLMRegionGrowImageFilter.h.
using itk::KLMRegionGrowImageFilter< TInputImage, TOutputImage >::InputImageVectorType = typename TInputImage::PixelType::VectorType |
Type definition for the input image pixel vector type.
Definition at line 191 of file itkKLMRegionGrowImageFilter.h.
using itk::KLMRegionGrowImageFilter< TInputImage, TOutputImage >::InputRegionType = typename TInputImage::RegionType |
Type definition for the image region type.
Definition at line 204 of file itkKLMRegionGrowImageFilter.h.
using itk::KLMRegionGrowImageFilter< TInputImage, TOutputImage >::KLMSegmentationBorderArrayPtr = KLMDynamicBorderArray< BorderType > |
Type definition for the smart border pointers object.
Definition at line 263 of file itkKLMRegionGrowImageFilter.h.
|
private |
Definition at line 359 of file itkKLMRegionGrowImageFilter.h.
|
private |
Definition at line 358 of file itkKLMRegionGrowImageFilter.h.
using itk::KLMRegionGrowImageFilter< TInputImage, TOutputImage >::LabelImageIndexType = typename LabelImageType::IndexType |
Type definition for the labelled image index type.
Definition at line 251 of file itkKLMRegionGrowImageFilter.h.
using itk::KLMRegionGrowImageFilter< TInputImage, TOutputImage >::LabelImageIterator = ImageRegionIterator< LabelImageType > |
Type definition for the labelled image iterators.
Definition at line 254 of file itkKLMRegionGrowImageFilter.h.
using itk::KLMRegionGrowImageFilter< TInputImage, TOutputImage >::LabelImagePixelType = typename LabelImageType::PixelType |
Type definition for the labelled image pixel type.
Definition at line 248 of file itkKLMRegionGrowImageFilter.h.
using itk::KLMRegionGrowImageFilter< TInputImage, TOutputImage >::LabelImagePointer = typename LabelImageType::Pointer |
Type definition for the labelled image pointer.
Definition at line 245 of file itkKLMRegionGrowImageFilter.h.
using itk::KLMRegionGrowImageFilter< TInputImage, TOutputImage >::LabelImageType = Image< RegionLabelType, Self::LabelImageDimension > |
Type definition for the labelled image pixel type.
Definition at line 242 of file itkKLMRegionGrowImageFilter.h.
using itk::KLMRegionGrowImageFilter< TInputImage, TOutputImage >::MeanRegionIntensityType = vnl_vector< double > |
Storage type for the mean region intensity.
Definition at line 257 of file itkKLMRegionGrowImageFilter.h.
using itk::KLMRegionGrowImageFilter< TInputImage, TOutputImage >::OutputImageIndexType = typename TOutputImage::IndexType |
Type definition for the output image index type.
Definition at line 230 of file itkKLMRegionGrowImageFilter.h.
using itk::KLMRegionGrowImageFilter< TInputImage, TOutputImage >::OutputImageIterator = ImageRegionIterator< TOutputImage > |
Type definition for the output image iterators.
Definition at line 233 of file itkKLMRegionGrowImageFilter.h.
using itk::KLMRegionGrowImageFilter< TInputImage, TOutputImage >::OutputImagePixelType = typename TOutputImage::PixelType |
Type definition for the output image pixel type.
Definition at line 221 of file itkKLMRegionGrowImageFilter.h.
using itk::KLMRegionGrowImageFilter< TInputImage, TOutputImage >::OutputImagePointer = typename TOutputImage::Pointer |
Definition at line 212 of file itkKLMRegionGrowImageFilter.h.
using itk::KLMRegionGrowImageFilter< TInputImage, TOutputImage >::OutputImageType = TOutputImage |
Type definition for the output image.
Definition at line 211 of file itkKLMRegionGrowImageFilter.h.
using itk::KLMRegionGrowImageFilter< TInputImage, TOutputImage >::OutputImageVectorType = typename TOutputImage::PixelType::VectorType |
Type definition for the output image pixel vector type.
Definition at line 224 of file itkKLMRegionGrowImageFilter.h.
using itk::KLMRegionGrowImageFilter< TInputImage, TOutputImage >::Pointer = SmartPointer< Self > |
Definition at line 173 of file itkKLMRegionGrowImageFilter.h.
using itk::KLMRegionGrowImageFilter< TInputImage, TOutputImage >::RegionLabelType = typename KLMSegmentationRegion::RegionLabelType |
type definition for the region label type.
Definition at line 236 of file itkKLMRegionGrowImageFilter.h.
using itk::KLMRegionGrowImageFilter< TInputImage, TOutputImage >::Self = KLMRegionGrowImageFilter |
Standard class type aliases.
Definition at line 171 of file itkKLMRegionGrowImageFilter.h.
using itk::KLMRegionGrowImageFilter< TInputImage, TOutputImage >::Superclass = RegionGrowImageFilter< TInputImage, TOutputImage > |
Definition at line 172 of file itkKLMRegionGrowImageFilter.h.
|
protected |
|
overrideprotecteddefault |
|
protected |
Function that calls the KLM region growing algorithm.
|
overrideprotectedvirtual |
This is the interface function that calls the specific algorithm implementation of region growing.
Implements itk::RegionGrowImageFilter< TInputImage, TOutputImage >.
|
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.
|
overrideprotectedvirtual |
KLMRegionGrowImageFilter will produce all of the output. Therefore it must provide an implementation of EnlargeOutputRequestedRegion().
Reimplemented from itk::ProcessObject.
|
overrideprotectedvirtual |
Standard pipeline method.
Reimplemented from itk::ImageSource< TOutputImage >.
|
overrideprotectedvirtual |
KLMRegionGrowImageFilter needs the entire input. Therefore it must provide an implementation GenerateInputRequestedRegion().
Reimplemented from itk::ImageToImageFilter< TInputImage, TOutputImage >.
|
protected |
Generate the labelled image.
|
protectedvirtual |
Generate output approximated image.
LabelImagePointer itk::KLMRegionGrowImageFilter< TInputImage, TOutputImage >::GetLabelledImage | ( | ) |
Generate labelled image.
|
virtual |
Set/Get the desired threshold parameter for lambda. See itkSegmentationBorder documentation for details regarding this parameter.
|
virtual |
Run-time type information (and related methods).
Reimplemented from itk::RegionGrowImageFilter< TInputImage, TOutputImage >.
|
virtual |
Set/Get the desired number of regions.
|
protected |
Initialize the RegionGrowImageFilter algorithm.
|
protectedvirtual |
Calculate the statistics representing the region. In this case we compute the mean region intensity and the area of the initial N-dimensional rectangular area. This is the function that can be overriden in order to enable a different statistical representation for region initialization.
|
overrideprotectedvirtual |
Function to merge two regions. The smaller label is always assigned to the new region. This is consistent with the connected components algorithm.
Implements itk::RegionGrowImageFilter< TInputImage, TOutputImage >.
|
static |
Method for creation through the object factory.
void itk::KLMRegionGrowImageFilter< TInputImage, TOutputImage >::PrintAlgorithmBorderStats | ( | ) |
Function that prints all the border information.
void itk::KLMRegionGrowImageFilter< TInputImage, TOutputImage >::PrintAlgorithmRegionStats | ( | ) |
Function that prints all the region information.
|
overrideprotectedvirtual |
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::ImageToImageFilter< TInputImage, TOutputImage >.
|
protectedvirtual |
Function to resolve the region labels to be consecutively ordered. Each initial atomic region is given a new label and the aggregrate region area and mean intensity.
|
virtual |
Set/Get the desired threshold parameter for lambda. See itkSegmentationBorder documentation for details regarding this parameter.
|
virtual |
Set/Get the desired number of regions.
|
static |
InputImageDimension enumeration.
Definition at line 215 of file itkKLMRegionGrowImageFilter.h.
|
static |
InputImageVectorDimension enumeration.
Definition at line 194 of file itkKLMRegionGrowImageFilter.h.
|
static |
The dimension of the labelled image.
Definition at line 239 of file itkKLMRegionGrowImageFilter.h.
|
private |
Definition at line 373 of file itkKLMRegionGrowImageFilter.h.
|
private |
Definition at line 372 of file itkKLMRegionGrowImageFilter.h.
|
private |
Definition at line 371 of file itkKLMRegionGrowImageFilter.h.
|
private |
Definition at line 367 of file itkKLMRegionGrowImageFilter.h.
|
private |
Definition at line 376 of file itkKLMRegionGrowImageFilter.h.
|
private |
Definition at line 375 of file itkKLMRegionGrowImageFilter.h.
|
private |
Local variables.
Definition at line 366 of file itkKLMRegionGrowImageFilter.h.
|
private |
Definition at line 361 of file itkKLMRegionGrowImageFilter.h.
|
private |
Definition at line 362 of file itkKLMRegionGrowImageFilter.h.
|
private |
Definition at line 370 of file itkKLMRegionGrowImageFilter.h.
|
private |
Definition at line 368 of file itkKLMRegionGrowImageFilter.h.
|
static |
OutputImageDimension enumeration.
Definition at line 218 of file itkKLMRegionGrowImageFilter.h.
|
static |
OutputImageVectorDimension enumeration.
Definition at line 227 of file itkKLMRegionGrowImageFilter.h.