SimpleITK  
itk::simple::IsolatedConnectedImageFilter Class Reference

Label pixels that are connected to one set of seeds but not another. More...

#include <sitkIsolatedConnectedImageFilter.h>

+ Inheritance diagram for itk::simple::IsolatedConnectedImageFilter:
+ Collaboration diagram for itk::simple::IsolatedConnectedImageFilter:

Detailed Description

Label pixels that are connected to one set of seeds but not another.

IsolatedConnectedImageFilter finds the optimal threshold to separate two regions. It has two modes, one to separate dark regions surrounded by bright regions by automatically finding a minimum isolating upper threshold, and another to separate bright regions surrounded by dark regions by automatically finding a maximum lower isolating threshold. The mode can be chosen by setting FindUpperThresholdOn() /Off(). In both cases, the isolating threshold is retrieved with GetIsolatedValue() .

The algorithm labels pixels with ReplaceValue that are connected to Seeds1 AND NOT connected to Seeds2. When finding the threshold to separate two dark regions surrounded by bright regions, given a fixed lower threshold, the filter adjusts the upper threshold until the two sets of seeds are not connected. The algorithm uses a binary search to adjust the upper threshold, starting at Upper. The reverse is true for finding the threshold to separate two bright regions. Lower defaults to the smallest possible value for the InputImagePixelType, and Upper defaults to the largest possible value for the InputImagePixelType.

The user can also supply the Lower and Upper values to restrict the search. However, if the range is too restrictive, it could happen that no isolating threshold can be found between the user specified Lower and Upper values. Therefore, unless the user is sure of the bounds to set, it is recommended that the user set these values to the lowest and highest intensity values in the image, respectively.

The user can specify more than one seed for both regions to separate. The algorithm will try find the threshold that ensures that all of the first seeds are contained in the resulting segmentation and all of the second seeds are not contained in the segmentation.

It is possible that the algorithm may not be able to find the isolating threshold because no such threshold exists. The user can check for this by querying the GetThresholdingFailed() flag.

See also
itk::simple::IsolatedConnected for the procedural interface
itk::IsolatedConnectedImageFilter for the Doxygen on the original ITK class.

Definition at line 66 of file sitkIsolatedConnectedImageFilter.h.

Public Types

using PixelIDTypeList = BasicPixelIDTypeList
 
using Self = IsolatedConnectedImageFilter
 
- Public Types inherited from itk::simple::ImageFilter
using Self = ImageFilter
 
- Public Types inherited from itk::simple::ProcessObject
using Self = ProcessObject
 

Public Member Functions

Image Execute (const Image &image1)
 
void FindUpperThresholdOff ()
 
void FindUpperThresholdOn ()
 
bool GetFindUpperThreshold () const
 
double GetIsolatedValue () const
 
double GetIsolatedValueTolerance () const
 
double GetLower () const
 
std::string GetName () const
 
uint8_t GetReplaceValue () const
 
std::vector< unsigned int > GetSeed1 () const
 
std::vector< unsigned int > GetSeed2 () const
 
bool GetThresholdingFailed () const
 
double GetUpper () const
 
 IsolatedConnectedImageFilter ()
 
void SetFindUpperThreshold (bool FindUpperThreshold)
 
void SetIsolatedValueTolerance (double IsolatedValueTolerance)
 
void SetLower (double Lower)
 
void SetReplaceValue (uint8_t ReplaceValue)
 
void SetSeed1 (std::vector< unsigned int > Seed1)
 
void SetSeed2 (std::vector< unsigned int > Seed2)
 
void SetUpper (double Upper)
 
std::string ToString () const
 
virtual ~IsolatedConnectedImageFilter ()
 
- Public Member Functions inherited from itk::simple::ImageFilter
 ImageFilter ()
 
virtual ~ImageFilter ()=0
 
- Public Member Functions inherited from itk::simple::ProcessObject
virtual void Abort ()
 
virtual int AddCommand (itk::simple::EventEnum event, const std::function< void()> &func)
 Directly add a callback to observe an event.
 
virtual int AddCommand (itk::simple::EventEnum event, itk::simple::Command &cmd)
 Add a Command Object to observer the event.
 
virtual float GetProgress () const
 An Active Measurement of the progress of execution.
 
virtual bool HasCommand (itk::simple::EventEnum event) const
 Query of this object has any registered commands for event.
 
 ProcessObject ()
 
virtual void RemoveAllCommands ()
 Remove all registered commands.
 
virtual ~ProcessObject ()
 
virtual void DebugOn ()
 
virtual void DebugOff ()
 
virtual bool GetDebug () const
 
virtual void SetDebug (bool debugFlag)
 
virtual void SetNumberOfThreads (unsigned int n)
 
virtual unsigned int GetNumberOfThreads () const
 
virtual void SetNumberOfWorkUnits (unsigned int n)
 
virtual unsigned int GetNumberOfWorkUnits () const
 

Private Types

using MemberFunctionType = Image (Self::*)(const Image &image1)
 

Private Member Functions

template<class TImageType>
Image ExecuteInternal (const Image &image1)
 

Static Private Member Functions

static const detail::MemberFunctionFactory< MemberFunctionType > & GetMemberFunctionFactory ()
 

Private Attributes

bool m_FindUpperThreshold { true }
 
double m_IsolatedValue { 0.0 }
 
double m_IsolatedValueTolerance { 1.0 }
 
double m_Lower { 0 }
 
uint8_t m_ReplaceValue { 1u }
 
std::vector< unsigned int > m_Seed1 { std::vector<unsigned int>(3, 0) }
 
std::vector< unsigned int > m_Seed2 { std::vector<unsigned int>(3, 0) }
 
bool m_ThresholdingFailed { false }
 
double m_Upper { 1 }
 

Friends

struct detail::MemberFunctionAddressor< MemberFunctionType >
 

Additional Inherited Members

- Static Public Member Functions inherited from itk::simple::ProcessObject
static bool GetGlobalDefaultDebug ()
 
static void GlobalDefaultDebugOff ()
 
static void GlobalDefaultDebugOn ()
 
static void SetGlobalDefaultDebug (bool debugFlag)
 
static void GlobalWarningDisplayOn ()
 
static void GlobalWarningDisplayOff ()
 
static void SetGlobalWarningDisplay (bool flag)
 
static bool GetGlobalWarningDisplay ()
 
static double GetGlobalDefaultCoordinateTolerance ()
 Access the global tolerance to determine congruent spaces.
 
static void SetGlobalDefaultCoordinateTolerance (double)
 Access the global tolerance to determine congruent spaces.
 
static double GetGlobalDefaultDirectionTolerance ()
 Access the global tolerance to determine congruent spaces.
 
static void SetGlobalDefaultDirectionTolerance (double)
 Access the global tolerance to determine congruent spaces.
 
static bool SetGlobalDefaultThreader (const std::string &threader)
 Set/Get the default threader used for process objects.
 
static std::string GetGlobalDefaultThreader ()
 Set/Get the default threader used for process objects.
 
static void SetGlobalDefaultNumberOfThreads (unsigned int n)
 
static unsigned int GetGlobalDefaultNumberOfThreads ()
 Set/Get the default threader used for process objects.
 
- Protected Member Functions inherited from itk::simple::ImageFilter
void CheckImageMatchingDimension (const Image &image1, const Image &image2, const std::string &image2Name)
 
void CheckImageMatchingPixelType (const Image &image1, const Image &image2, const std::string &image2Name)
 
void CheckImageMatchingSize (const Image &image1, const Image &image2, const std::string &image2Name)
 
- Protected Member Functions inherited from itk::simple::ProcessObject
virtual unsigned long AddITKObserver (const itk::EventObject &, itk::Command *)
 
virtual itk::ProcessObjectGetActiveProcess ()
 
virtual void OnActiveProcessDelete ()
 
virtual void onCommandDelete (const itk::simple::Command *cmd) noexcept
 
virtual void PreUpdate (itk::ProcessObject *p)
 
virtual void RemoveITKObserver (EventCommand &e)
 
- Protected Member Functions inherited from itk::simple::NonCopyable
 NonCopyable ()=default
 
 NonCopyable (const NonCopyable &)=delete
 
NonCopyableoperator= (const NonCopyable &)=delete
 
- Static Protected Member Functions inherited from itk::simple::ImageFilter
template<class TImageType>
static void FixNonZeroIndex (TImageType *img)
 
- Static Protected Member Functions inherited from itk::simple::ProcessObject
template<class TImageType>
static TImageType::ConstPointer CastImageToITK (const Image &img)
 
template<class TPixelType, unsigned int VImageDimension, unsigned int VLength, template< typename, unsigned int > class TVector>
static Image CastITKToImage (itk::Image< TVector< TPixelType, VLength >, VImageDimension > *img)
 
template<unsigned int VImageDimension, unsigned int VLength, template< unsigned int > class TVector>
static Image CastITKToImage (itk::Image< TVector< VLength >, VImageDimension > *img)
 
template<class TImageType>
static Image CastITKToImage (TImageType *img)
 
static const itk::EventObjectGetITKEventObject (EventEnum e)
 
template<typename T>
static std::ostream & ToStringHelper (std::ostream &os, const T &v)
 
static std::ostream & ToStringHelper (std::ostream &os, const char &v)
 
static std::ostream & ToStringHelper (std::ostream &os, const signed char &v)
 
static std::ostream & ToStringHelper (std::ostream &os, const unsigned char &v)
 

Member Typedef Documentation

◆ MemberFunctionType

Setup for member function dispatching

Definition at line 216 of file sitkIsolatedConnectedImageFilter.h.

◆ PixelIDTypeList

Define the pixels types supported by this filter

Definition at line 78 of file sitkIsolatedConnectedImageFilter.h.

◆ Self

Constructor & Destructor Documentation

◆ ~IsolatedConnectedImageFilter()

virtual itk::simple::IsolatedConnectedImageFilter::~IsolatedConnectedImageFilter ( )
virtual

Destructor

◆ IsolatedConnectedImageFilter()

itk::simple::IsolatedConnectedImageFilter::IsolatedConnectedImageFilter ( )

Default Constructor that takes no arguments and initializes default parameters

Member Function Documentation

◆ Execute()

Image itk::simple::IsolatedConnectedImageFilter::Execute ( const Image & image1)

Execute the filter on the input image

◆ ExecuteInternal()

template<class TImageType>
Image itk::simple::IsolatedConnectedImageFilter::ExecuteInternal ( const Image & image1)
private

◆ FindUpperThresholdOff()

void itk::simple::IsolatedConnectedImageFilter::FindUpperThresholdOff ( )
inline

Definition at line 178 of file sitkIsolatedConnectedImageFilter.h.

References SetFindUpperThreshold().

◆ FindUpperThresholdOn()

void itk::simple::IsolatedConnectedImageFilter::FindUpperThresholdOn ( )
inline

Set the value of FindUpperThreshold to true or false respectfully.

Definition at line 176 of file sitkIsolatedConnectedImageFilter.h.

References SetFindUpperThreshold().

◆ GetFindUpperThreshold()

bool itk::simple::IsolatedConnectedImageFilter::GetFindUpperThreshold ( ) const
inline

Set/Get whether to find an upper threshold (separating two dark regions) or a lower threshold (separating two bright regions).

Definition at line 184 of file sitkIsolatedConnectedImageFilter.h.

References m_FindUpperThreshold.

◆ GetIsolatedValue()

double itk::simple::IsolatedConnectedImageFilter::GetIsolatedValue ( ) const
inline

Get value that isolates the two seeds.

This is a measurement. Its value is updated in the Execute methods, so the value will only be valid after an execution.

Definition at line 201 of file sitkIsolatedConnectedImageFilter.h.

References m_IsolatedValue.

◆ GetIsolatedValueTolerance()

double itk::simple::IsolatedConnectedImageFilter::GetIsolatedValueTolerance ( ) const
inline

Set/Get the precision required for the intensity threshold value. The default is 1.

Definition at line 163 of file sitkIsolatedConnectedImageFilter.h.

References m_IsolatedValueTolerance.

◆ GetLower()

double itk::simple::IsolatedConnectedImageFilter::GetLower ( ) const
inline

Set/Get the limit on the lower threshold value. The default is the NonpositiveMin() for the InputPixelType.

Definition at line 122 of file sitkIsolatedConnectedImageFilter.h.

References m_Lower.

◆ GetMemberFunctionFactory()

static const detail::MemberFunctionFactory< MemberFunctionType > & itk::simple::IsolatedConnectedImageFilter::GetMemberFunctionFactory ( )
staticprivate

◆ GetName()

std::string itk::simple::IsolatedConnectedImageFilter::GetName ( ) const
inlinevirtual

Name of this class

Implements itk::simple::ProcessObject.

Definition at line 204 of file sitkIsolatedConnectedImageFilter.h.

◆ GetReplaceValue()

uint8_t itk::simple::IsolatedConnectedImageFilter::GetReplaceValue ( ) const
inline

Set/Get value to replace thresholded pixels. Pixels that lie within the thresholds will be replaced with this value. The default is 1.

Definition at line 150 of file sitkIsolatedConnectedImageFilter.h.

References m_ReplaceValue.

◆ GetSeed1()

std::vector< unsigned int > itk::simple::IsolatedConnectedImageFilter::GetSeed1 ( ) const
inline

Definition at line 95 of file sitkIsolatedConnectedImageFilter.h.

References m_Seed1.

◆ GetSeed2()

std::vector< unsigned int > itk::simple::IsolatedConnectedImageFilter::GetSeed2 ( ) const
inline

Definition at line 109 of file sitkIsolatedConnectedImageFilter.h.

References m_Seed2.

◆ GetThresholdingFailed()

bool itk::simple::IsolatedConnectedImageFilter::GetThresholdingFailed ( ) const
inline

Get the flag that tells whether the algorithm failed to find a threshold.

This is a measurement. Its value is updated in the Execute methods, so the value will only be valid after an execution.

Definition at line 193 of file sitkIsolatedConnectedImageFilter.h.

References m_ThresholdingFailed.

◆ GetUpper()

double itk::simple::IsolatedConnectedImageFilter::GetUpper ( ) const
inline

Set/Get the limit on the upper threshold value. The default is the max() for the InputPixelType.

Definition at line 135 of file sitkIsolatedConnectedImageFilter.h.

References m_Upper.

◆ SetFindUpperThreshold()

void itk::simple::IsolatedConnectedImageFilter::SetFindUpperThreshold ( bool FindUpperThreshold)
inline

Set/Get whether to find an upper threshold (separating two dark regions) or a lower threshold (separating two bright regions).

Definition at line 171 of file sitkIsolatedConnectedImageFilter.h.

References m_FindUpperThreshold.

Referenced by FindUpperThresholdOff(), and FindUpperThresholdOn().

◆ SetIsolatedValueTolerance()

void itk::simple::IsolatedConnectedImageFilter::SetIsolatedValueTolerance ( double IsolatedValueTolerance)
inline

Set/Get the precision required for the intensity threshold value. The default is 1.

Definition at line 157 of file sitkIsolatedConnectedImageFilter.h.

References m_IsolatedValueTolerance.

◆ SetLower()

void itk::simple::IsolatedConnectedImageFilter::SetLower ( double Lower)
inline

Set/Get the limit on the lower threshold value. The default is the NonpositiveMin() for the InputPixelType.

Definition at line 116 of file sitkIsolatedConnectedImageFilter.h.

References m_Lower.

◆ SetReplaceValue()

void itk::simple::IsolatedConnectedImageFilter::SetReplaceValue ( uint8_t ReplaceValue)
inline

Set/Get value to replace thresholded pixels. Pixels that lie within the thresholds will be replaced with this value. The default is 1.

Definition at line 143 of file sitkIsolatedConnectedImageFilter.h.

References m_ReplaceValue.

◆ SetSeed1()

void itk::simple::IsolatedConnectedImageFilter::SetSeed1 ( std::vector< unsigned int > Seed1)
inline

Set a single seed point 1.

This seed will be isolated from Seed2 (if possible). All pixels connected to this seed will be replaced with ReplaceValue.

Definition at line 90 of file sitkIsolatedConnectedImageFilter.h.

References m_Seed1.

◆ SetSeed2()

void itk::simple::IsolatedConnectedImageFilter::SetSeed2 ( std::vector< unsigned int > Seed2)
inline

Set a single seed point 2.

This seed will be isolated from Seed1 (if possible).

Definition at line 104 of file sitkIsolatedConnectedImageFilter.h.

References m_Seed2.

◆ SetUpper()

void itk::simple::IsolatedConnectedImageFilter::SetUpper ( double Upper)
inline

Set/Get the limit on the upper threshold value. The default is the max() for the InputPixelType.

Definition at line 129 of file sitkIsolatedConnectedImageFilter.h.

References m_Upper.

◆ ToString()

std::string itk::simple::IsolatedConnectedImageFilter::ToString ( ) const
virtual

Print ourselves out

Reimplemented from itk::simple::ProcessObject.

Friends And Related Symbol Documentation

◆ detail::MemberFunctionAddressor< MemberFunctionType >

Definition at line 217 of file sitkIsolatedConnectedImageFilter.h.

References ExecuteInternal().

Member Data Documentation

◆ m_FindUpperThreshold

bool itk::simple::IsolatedConnectedImageFilter::m_FindUpperThreshold { true }
private

◆ m_IsolatedValue

double itk::simple::IsolatedConnectedImageFilter::m_IsolatedValue { 0.0 }
private

Definition at line 239 of file sitkIsolatedConnectedImageFilter.h.

Referenced by GetIsolatedValue().

◆ m_IsolatedValueTolerance

double itk::simple::IsolatedConnectedImageFilter::m_IsolatedValueTolerance { 1.0 }
private

◆ m_Lower

double itk::simple::IsolatedConnectedImageFilter::m_Lower { 0 }
private

Definition at line 226 of file sitkIsolatedConnectedImageFilter.h.

Referenced by GetLower(), and SetLower().

◆ m_ReplaceValue

uint8_t itk::simple::IsolatedConnectedImageFilter::m_ReplaceValue { 1u }
private

Definition at line 230 of file sitkIsolatedConnectedImageFilter.h.

Referenced by GetReplaceValue(), and SetReplaceValue().

◆ m_Seed1

std::vector<unsigned int> itk::simple::IsolatedConnectedImageFilter::m_Seed1 { std::vector<unsigned int>(3, 0) }
private

Definition at line 222 of file sitkIsolatedConnectedImageFilter.h.

Referenced by GetSeed1(), and SetSeed1().

◆ m_Seed2

std::vector<unsigned int> itk::simple::IsolatedConnectedImageFilter::m_Seed2 { std::vector<unsigned int>(3, 0) }
private

Definition at line 224 of file sitkIsolatedConnectedImageFilter.h.

Referenced by GetSeed2(), and SetSeed2().

◆ m_ThresholdingFailed

bool itk::simple::IsolatedConnectedImageFilter::m_ThresholdingFailed { false }
private

Definition at line 238 of file sitkIsolatedConnectedImageFilter.h.

Referenced by GetThresholdingFailed().

◆ m_Upper

double itk::simple::IsolatedConnectedImageFilter::m_Upper { 1 }
private

Definition at line 228 of file sitkIsolatedConnectedImageFilter.h.

Referenced by GetUpper(), and SetUpper().


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