ITK 6.0.0
Insight Toolkit
 
Loading...
Searching...
No Matches
itk::ScanlineFilterCommon< TInputImage, TOutputImage > Class Template Reference

#include <itkScanlineFilterCommon.h>

Detailed Description

template<typename TInputImage, typename TOutputImage>
class itk::ScanlineFilterCommon< TInputImage, TOutputImage >

Helper class for a group of filters which operate on scan-lines.

This implementation was taken from the Insight Journal paper: https://doi.org/10.54294/q6auw4

Definition at line 41 of file itkScanlineFilterCommon.h.

+ Inheritance diagram for itk::ScanlineFilterCommon< TInputImage, TOutputImage >:
+ Collaboration diagram for itk::ScanlineFilterCommon< TInputImage, TOutputImage >:

Classes

struct  RunLength
 
struct  WorkUnitData
 

Public Types

using ConstPointer = SmartPointer<const Self>
 
using EnclosingFilter = ImageToImageFilter<TInputImage, TOutputImage>
 
using IndexType = typename TInputImage::IndexType
 
using InputImageConstPointer = typename InputImageType::ConstPointer
 
using InputImagePointer = typename InputImageType::Pointer
 
using InputImageType = TInputImage
 
using InputPixelType = typename TInputImage::PixelType
 
using OffsetType = typename TInputImage::OffsetType
 
using OutputImagePixelType = typename TOutputImage::PixelType
 
using OutputImagePointer = typename OutputImageType::Pointer
 
using OutputImageType = TOutputImage
 
using OutputIndexType = typename TOutputImage::IndexType
 
using OutputOffsetType = typename TOutputImage::OffsetType
 
using OutputPixelType = typename TOutputImage::PixelType
 
using OutputRegionType = typename TOutputImage::RegionType
 
using OutputSizeType = typename TOutputImage::SizeType
 
using Pointer = SmartPointer<Self>
 
using RegionType = OutputRegionType
 
using Self = ScanlineFilterCommon
 
using SizeType = typename TInputImage::SizeType
 

Public Member Functions

void Register () const
 
 ScanlineFilterCommon (EnclosingFilter *enclosingFilter)
 
void UnRegister () const noexcept
 
 ~ScanlineFilterCommon ()=default
 

Static Public Member Functions

static Pointer New ()
 

Static Public Attributes

static constexpr unsigned int ImageDimension = TOutputImage::ImageDimension
 
static constexpr unsigned int InputImageDimension = TInputImage::ImageDimension
 
static constexpr unsigned int OutputImageDimension = TOutputImage::ImageDimension
 

Protected Types

using CompareLinesCallback
 
using ConsecutiveVectorType = std::vector<OutputPixelType>
 
using InternalLabelType = SizeValueType
 
using LineEncodingConstIterator = typename LineEncodingType::const_iterator
 
using LineEncodingIterator = typename LineEncodingType::iterator
 
using LineEncodingType = std::vector<RunLength>
 
using LineMapType = std::vector<LineEncodingType>
 
using OffsetVectorConstIterator = typename OffsetVectorType::const_iterator
 
using OffsetVectorType = std::vector<OffsetValueType>
 
using OutSizeType = typename TOutputImage::RegionType::SizeType
 
using UnionFindType = std::vector<InternalLabelType>
 

Protected Member Functions

bool CheckNeighbors (const OutputIndexType &A, const OutputIndexType &B) const
 
void CompareLines (const LineEncodingType &current, const LineEncodingType &Neighbour, bool sameLineOffset, bool labelCompare, OutputPixelType background, CompareLinesCallback callback)
 
void ComputeEquivalence (const SizeValueType workUnitResultsIndex, bool strictlyLess)
 
SizeValueType CreateConsecutive (OutputPixelType backgroundValue)
 
WorkUnitData CreateWorkUnitData (const RegionType &outputRegionForThread)
 
SizeValueType IndexToLinearIndex (const IndexType &index) const
 
void InitUnion (InternalLabelType numberOfLabels)
 
void LinkLabels (const InternalLabelType label1, const InternalLabelType label2)
 
InternalLabelType LookupSet (const InternalLabelType label)
 
void SetupLineOffsets (bool wholeNeighborhood)
 

Protected Attributes

ConsecutiveVectorType m_Consecutive
 
WeakPointer< EnclosingFilterm_EnclosingFilter
 
bool m_FullyConnected { false }
 
LineMapType m_LineMap
 
OffsetVectorType m_LineOffsets
 
std::mutex m_Mutex
 
std::atomic< SizeValueTypem_NumberOfLabels
 
UnionFindType m_UnionFind
 
std::deque< WorkUnitDatam_WorkUnitResults
 

Member Typedef Documentation

◆ CompareLinesCallback

template<typename TInputImage, typename TOutputImage>
using itk::ScanlineFilterCommon< TInputImage, TOutputImage >::CompareLinesCallback
protected
Initial value:
std::function<void(const LineEncodingConstIterator & currentRun,
const LineEncodingConstIterator & neighborRun,
typename LineEncodingType::const_iterator LineEncodingConstIterator
long OffsetValueType
Definition itkIntTypes.h:97

Definition at line 250 of file itkScanlineFilterCommon.h.

◆ ConsecutiveVectorType

template<typename TInputImage, typename TOutputImage>
using itk::ScanlineFilterCommon< TInputImage, TOutputImage >::ConsecutiveVectorType = std::vector<OutputPixelType>
protected

Definition at line 134 of file itkScanlineFilterCommon.h.

◆ ConstPointer

template<typename TInputImage, typename TOutputImage>
using itk::ScanlineFilterCommon< TInputImage, TOutputImage >::ConstPointer = SmartPointer<const Self>

Definition at line 48 of file itkScanlineFilterCommon.h.

◆ EnclosingFilter

template<typename TInputImage, typename TOutputImage>
using itk::ScanlineFilterCommon< TInputImage, TOutputImage >::EnclosingFilter = ImageToImageFilter<TInputImage, TOutputImage>

Definition at line 99 of file itkScanlineFilterCommon.h.

◆ IndexType

template<typename TInputImage, typename TOutputImage>
using itk::ScanlineFilterCommon< TInputImage, TOutputImage >::IndexType = typename TInputImage::IndexType

Definition at line 85 of file itkScanlineFilterCommon.h.

◆ InputImageConstPointer

template<typename TInputImage, typename TOutputImage>
using itk::ScanlineFilterCommon< TInputImage, TOutputImage >::InputImageConstPointer = typename InputImageType::ConstPointer

Definition at line 84 of file itkScanlineFilterCommon.h.

◆ InputImagePointer

template<typename TInputImage, typename TOutputImage>
using itk::ScanlineFilterCommon< TInputImage, TOutputImage >::InputImagePointer = typename InputImageType::Pointer

Definition at line 83 of file itkScanlineFilterCommon.h.

◆ InputImageType

template<typename TInputImage, typename TOutputImage>
using itk::ScanlineFilterCommon< TInputImage, TOutputImage >::InputImageType = TInputImage

Definition at line 82 of file itkScanlineFilterCommon.h.

◆ InputPixelType

template<typename TInputImage, typename TOutputImage>
using itk::ScanlineFilterCommon< TInputImage, TOutputImage >::InputPixelType = typename TInputImage::PixelType

Definition at line 78 of file itkScanlineFilterCommon.h.

◆ InternalLabelType

template<typename TInputImage, typename TOutputImage>
using itk::ScanlineFilterCommon< TInputImage, TOutputImage >::InternalLabelType = SizeValueType
protected

Definition at line 108 of file itkScanlineFilterCommon.h.

◆ LineEncodingConstIterator

template<typename TInputImage, typename TOutputImage>
using itk::ScanlineFilterCommon< TInputImage, TOutputImage >::LineEncodingConstIterator = typename LineEncodingType::const_iterator
protected

Definition at line 126 of file itkScanlineFilterCommon.h.

◆ LineEncodingIterator

template<typename TInputImage, typename TOutputImage>
using itk::ScanlineFilterCommon< TInputImage, TOutputImage >::LineEncodingIterator = typename LineEncodingType::iterator
protected

Definition at line 125 of file itkScanlineFilterCommon.h.

◆ LineEncodingType

template<typename TInputImage, typename TOutputImage>
using itk::ScanlineFilterCommon< TInputImage, TOutputImage >::LineEncodingType = std::vector<RunLength>
protected

Definition at line 124 of file itkScanlineFilterCommon.h.

◆ LineMapType

template<typename TInputImage, typename TOutputImage>
using itk::ScanlineFilterCommon< TInputImage, TOutputImage >::LineMapType = std::vector<LineEncodingType>
protected

Definition at line 131 of file itkScanlineFilterCommon.h.

◆ OffsetType

template<typename TInputImage, typename TOutputImage>
using itk::ScanlineFilterCommon< TInputImage, TOutputImage >::OffsetType = typename TInputImage::OffsetType

Definition at line 87 of file itkScanlineFilterCommon.h.

◆ OffsetVectorConstIterator

template<typename TInputImage, typename TOutputImage>
using itk::ScanlineFilterCommon< TInputImage, TOutputImage >::OffsetVectorConstIterator = typename OffsetVectorType::const_iterator
protected

Definition at line 129 of file itkScanlineFilterCommon.h.

◆ OffsetVectorType

template<typename TInputImage, typename TOutputImage>
using itk::ScanlineFilterCommon< TInputImage, TOutputImage >::OffsetVectorType = std::vector<OffsetValueType>
protected

Definition at line 128 of file itkScanlineFilterCommon.h.

◆ OutputImagePixelType

template<typename TInputImage, typename TOutputImage>
using itk::ScanlineFilterCommon< TInputImage, TOutputImage >::OutputImagePixelType = typename TOutputImage::PixelType

Definition at line 95 of file itkScanlineFilterCommon.h.

◆ OutputImagePointer

template<typename TInputImage, typename TOutputImage>
using itk::ScanlineFilterCommon< TInputImage, TOutputImage >::OutputImagePointer = typename OutputImageType::Pointer

Definition at line 89 of file itkScanlineFilterCommon.h.

◆ OutputImageType

template<typename TInputImage, typename TOutputImage>
using itk::ScanlineFilterCommon< TInputImage, TOutputImage >::OutputImageType = TOutputImage

Definition at line 88 of file itkScanlineFilterCommon.h.

◆ OutputIndexType

template<typename TInputImage, typename TOutputImage>
using itk::ScanlineFilterCommon< TInputImage, TOutputImage >::OutputIndexType = typename TOutputImage::IndexType

Definition at line 92 of file itkScanlineFilterCommon.h.

◆ OutputOffsetType

template<typename TInputImage, typename TOutputImage>
using itk::ScanlineFilterCommon< TInputImage, TOutputImage >::OutputOffsetType = typename TOutputImage::OffsetType

Definition at line 94 of file itkScanlineFilterCommon.h.

◆ OutputPixelType

template<typename TInputImage, typename TOutputImage>
using itk::ScanlineFilterCommon< TInputImage, TOutputImage >::OutputPixelType = typename TOutputImage::PixelType

Extract some information from the image types. Dimensionality of the two images is assumed to be the same.

Definition at line 77 of file itkScanlineFilterCommon.h.

◆ OutputRegionType

template<typename TInputImage, typename TOutputImage>
using itk::ScanlineFilterCommon< TInputImage, TOutputImage >::OutputRegionType = typename TOutputImage::RegionType

Definition at line 90 of file itkScanlineFilterCommon.h.

◆ OutputSizeType

template<typename TInputImage, typename TOutputImage>
using itk::ScanlineFilterCommon< TInputImage, TOutputImage >::OutputSizeType = typename TOutputImage::SizeType

Definition at line 93 of file itkScanlineFilterCommon.h.

◆ OutSizeType

template<typename TInputImage, typename TOutputImage>
using itk::ScanlineFilterCommon< TInputImage, TOutputImage >::OutSizeType = typename TOutputImage::RegionType::SizeType
protected

Definition at line 109 of file itkScanlineFilterCommon.h.

◆ Pointer

template<typename TInputImage, typename TOutputImage>
using itk::ScanlineFilterCommon< TInputImage, TOutputImage >::Pointer = SmartPointer<Self>

Definition at line 47 of file itkScanlineFilterCommon.h.

◆ RegionType

template<typename TInputImage, typename TOutputImage>
using itk::ScanlineFilterCommon< TInputImage, TOutputImage >::RegionType = OutputRegionType

Definition at line 91 of file itkScanlineFilterCommon.h.

◆ Self

template<typename TInputImage, typename TOutputImage>
using itk::ScanlineFilterCommon< TInputImage, TOutputImage >::Self = ScanlineFilterCommon

Definition at line 46 of file itkScanlineFilterCommon.h.

◆ SizeType

template<typename TInputImage, typename TOutputImage>
using itk::ScanlineFilterCommon< TInputImage, TOutputImage >::SizeType = typename TInputImage::SizeType

Definition at line 86 of file itkScanlineFilterCommon.h.

◆ UnionFindType

template<typename TInputImage, typename TOutputImage>
using itk::ScanlineFilterCommon< TInputImage, TOutputImage >::UnionFindType = std::vector<InternalLabelType>
protected

Definition at line 133 of file itkScanlineFilterCommon.h.

Constructor & Destructor Documentation

◆ ScanlineFilterCommon()

template<typename TInputImage, typename TOutputImage>
itk::ScanlineFilterCommon< TInputImage, TOutputImage >::ScanlineFilterCommon ( EnclosingFilter * enclosingFilter)
inline

Definition at line 101 of file itkScanlineFilterCommon.h.

References m_EnclosingFilter.

◆ ~ScanlineFilterCommon()

template<typename TInputImage, typename TOutputImage>
itk::ScanlineFilterCommon< TInputImage, TOutputImage >::~ScanlineFilterCommon ( )
default

Member Function Documentation

◆ CheckNeighbors()

template<typename TInputImage, typename TOutputImage>
bool itk::ScanlineFilterCommon< TInputImage, TOutputImage >::CheckNeighbors ( const OutputIndexType & A,
const OutputIndexType & B ) const
inlineprotected

Definition at line 228 of file itkScanlineFilterCommon.h.

References itk::Math::abs(), m_FullyConnected, and OutputImageDimension.

Referenced by ComputeEquivalence().

◆ CompareLines()

template<typename TInputImage, typename TOutputImage>
void itk::ScanlineFilterCommon< TInputImage, TOutputImage >::CompareLines ( const LineEncodingType & current,
const LineEncodingType & Neighbour,
bool sameLineOffset,
bool labelCompare,
OutputPixelType background,
CompareLinesCallback callback )
inlineprotected

Definition at line 256 of file itkScanlineFilterCommon.h.

References ImageDimension, and m_FullyConnected.

Referenced by ComputeEquivalence().

◆ ComputeEquivalence()

template<typename TInputImage, typename TOutputImage>
void itk::ScanlineFilterCommon< TInputImage, TOutputImage >::ComputeEquivalence ( const SizeValueType workUnitResultsIndex,
bool strictlyLess )
inlineprotected

◆ CreateConsecutive()

template<typename TInputImage, typename TOutputImage>
SizeValueType itk::ScanlineFilterCommon< TInputImage, TOutputImage >::CreateConsecutive ( OutputPixelType backgroundValue)
inlineprotected

Definition at line 200 of file itkScanlineFilterCommon.h.

References m_Consecutive, and m_UnionFind.

◆ CreateWorkUnitData()

template<typename TInputImage, typename TOutputImage>
WorkUnitData itk::ScanlineFilterCommon< TInputImage, TOutputImage >::CreateWorkUnitData ( const RegionType & outputRegionForThread)
inlineprotected

Definition at line 446 of file itkScanlineFilterCommon.h.

References IndexToLinearIndex().

◆ IndexToLinearIndex()

template<typename TInputImage, typename TOutputImage>
SizeValueType itk::ScanlineFilterCommon< TInputImage, TOutputImage >::IndexToLinearIndex ( const IndexType & index) const
inlineprotected

Definition at line 137 of file itkScanlineFilterCommon.h.

References ImageDimension, and m_EnclosingFilter.

Referenced by CreateWorkUnitData().

◆ InitUnion()

template<typename TInputImage, typename TOutputImage>
void itk::ScanlineFilterCommon< TInputImage, TOutputImage >::InitUnion ( InternalLabelType numberOfLabels)
inlineprotected

Definition at line 153 of file itkScanlineFilterCommon.h.

References m_LineMap, and m_UnionFind.

◆ LinkLabels()

template<typename TInputImage, typename TOutputImage>
void itk::ScanlineFilterCommon< TInputImage, TOutputImage >::LinkLabels ( const InternalLabelType label1,
const InternalLabelType label2 )
inlineprotected

Definition at line 183 of file itkScanlineFilterCommon.h.

References LookupSet(), m_Mutex, and m_UnionFind.

Referenced by ComputeEquivalence().

◆ LookupSet()

template<typename TInputImage, typename TOutputImage>
InternalLabelType itk::ScanlineFilterCommon< TInputImage, TOutputImage >::LookupSet ( const InternalLabelType label)
inlineprotected

Definition at line 172 of file itkScanlineFilterCommon.h.

References m_UnionFind.

Referenced by LinkLabels().

◆ New()

template<typename TInputImage, typename TOutputImage>
static Pointer itk::ScanlineFilterCommon< TInputImage, TOutputImage >::New ( )
inlinestatic

Definition at line 62 of file itkScanlineFilterCommon.h.

References itk::ObjectFactory< T >::Create().

◆ Register()

template<typename TInputImage, typename TOutputImage>
void itk::ScanlineFilterCommon< TInputImage, TOutputImage >::Register ( ) const
inline

Definition at line 50 of file itkScanlineFilterCommon.h.

References m_EnclosingFilter, and itk::Object::Register().

◆ SetupLineOffsets()

template<typename TInputImage, typename TOutputImage>
void itk::ScanlineFilterCommon< TInputImage, TOutputImage >::SetupLineOffsets ( bool wholeNeighborhood)
inlineprotected

◆ UnRegister()

template<typename TInputImage, typename TOutputImage>
void itk::ScanlineFilterCommon< TInputImage, TOutputImage >::UnRegister ( ) const
inlinenoexcept

Definition at line 56 of file itkScanlineFilterCommon.h.

References m_EnclosingFilter, and itk::Object::UnRegister().

Member Data Documentation

◆ ImageDimension

template<typename TInputImage, typename TOutputImage>
unsigned int itk::ScanlineFilterCommon< TInputImage, TOutputImage >::ImageDimension = TOutputImage::ImageDimension
staticconstexpr

Definition at line 79 of file itkScanlineFilterCommon.h.

Referenced by CompareLines(), and IndexToLinearIndex().

◆ InputImageDimension

template<typename TInputImage, typename TOutputImage>
unsigned int itk::ScanlineFilterCommon< TInputImage, TOutputImage >::InputImageDimension = TInputImage::ImageDimension
staticconstexpr

Definition at line 81 of file itkScanlineFilterCommon.h.

◆ m_Consecutive

template<typename TInputImage, typename TOutputImage>
ConsecutiveVectorType itk::ScanlineFilterCommon< TInputImage, TOutputImage >::m_Consecutive
protected

Definition at line 506 of file itkScanlineFilterCommon.h.

Referenced by CreateConsecutive().

◆ m_EnclosingFilter

template<typename TInputImage, typename TOutputImage>
WeakPointer<EnclosingFilter> itk::ScanlineFilterCommon< TInputImage, TOutputImage >::m_EnclosingFilter
protected

◆ m_FullyConnected

template<typename TInputImage, typename TOutputImage>
bool itk::ScanlineFilterCommon< TInputImage, TOutputImage >::m_FullyConnected { false }
protected

Definition at line 503 of file itkScanlineFilterCommon.h.

Referenced by CheckNeighbors(), CompareLines(), and SetupLineOffsets().

◆ m_LineMap

template<typename TInputImage, typename TOutputImage>
LineMapType itk::ScanlineFilterCommon< TInputImage, TOutputImage >::m_LineMap
protected

Definition at line 511 of file itkScanlineFilterCommon.h.

Referenced by ComputeEquivalence(), and InitUnion().

◆ m_LineOffsets

template<typename TInputImage, typename TOutputImage>
OffsetVectorType itk::ScanlineFilterCommon< TInputImage, TOutputImage >::m_LineOffsets
protected

Definition at line 504 of file itkScanlineFilterCommon.h.

Referenced by ComputeEquivalence(), and SetupLineOffsets().

◆ m_Mutex

template<typename TInputImage, typename TOutputImage>
std::mutex itk::ScanlineFilterCommon< TInputImage, TOutputImage >::m_Mutex
protected

Definition at line 507 of file itkScanlineFilterCommon.h.

Referenced by LinkLabels().

◆ m_NumberOfLabels

template<typename TInputImage, typename TOutputImage>
std::atomic<SizeValueType> itk::ScanlineFilterCommon< TInputImage, TOutputImage >::m_NumberOfLabels
protected

Definition at line 509 of file itkScanlineFilterCommon.h.

◆ m_UnionFind

template<typename TInputImage, typename TOutputImage>
UnionFindType itk::ScanlineFilterCommon< TInputImage, TOutputImage >::m_UnionFind
protected

Definition at line 505 of file itkScanlineFilterCommon.h.

Referenced by CreateConsecutive(), InitUnion(), LinkLabels(), and LookupSet().

◆ m_WorkUnitResults

template<typename TInputImage, typename TOutputImage>
std::deque<WorkUnitData> itk::ScanlineFilterCommon< TInputImage, TOutputImage >::m_WorkUnitResults
protected

Definition at line 510 of file itkScanlineFilterCommon.h.

Referenced by ComputeEquivalence().

◆ OutputImageDimension

template<typename TInputImage, typename TOutputImage>
unsigned int itk::ScanlineFilterCommon< TInputImage, TOutputImage >::OutputImageDimension = TOutputImage::ImageDimension
staticconstexpr

Definition at line 80 of file itkScanlineFilterCommon.h.

Referenced by CheckNeighbors().


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