SimpleITK  
Public Types | Public Member Functions | Private Types | Private Member Functions | Private Attributes | Friends | List of all members
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 49 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)
 
SelfFindUpperThresholdOff ()
 
SelfFindUpperThresholdOn ()
 
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 ()
 
SelfSetFindUpperThreshold (bool FindUpperThreshold)
 
SelfSetIsolatedValueTolerance (double IsolatedValueTolerance)
 
SelfSetLower (double Lower)
 
SelfSetReplaceValue (uint8_t ReplaceValue)
 
SelfSetSeed1 (std::vector< unsigned int > Seed1)
 
SelfSetSeed2 (std::vector< unsigned int > Seed2)
 
SelfSetUpper (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. More...
 
virtual int AddCommand (itk::simple::EventEnum event, itk::simple::Command &cmd)
 Add a Command Object to observer the event. More...
 
virtual float GetProgress () const
 An Active Measurement of the progress of execution. More...
 
virtual bool HasCommand (itk::simple::EventEnum event) const
 Query of this object has any registered commands for event. More...
 
 ProcessObject ()
 
virtual void RemoveAllCommands ()
 Remove all registered commands. More...
 
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)
 

Private Attributes

bool m_FindUpperThreshold {true}
 
double m_IsolatedValue {0.0}
 
double m_IsolatedValueTolerance {1.0}
 
double m_Lower {0}
 
std::unique_ptr< detail::MemberFunctionFactory< MemberFunctionType > > m_MemberFactory
 
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. More...
 
static void SetGlobalDefaultCoordinateTolerance (double)
 Access the global tolerance to determine congruent spaces. More...
 
static double GetGlobalDefaultDirectionTolerance ()
 Access the global tolerance to determine congruent spaces. More...
 
static void SetGlobalDefaultDirectionTolerance (double)
 Access the global tolerance to determine congruent spaces. More...
 
static bool SetGlobalDefaultThreader (const std::string &threader)
 Set/Get the default threader used for process objects. More...
 
static std::string GetGlobalDefaultThreader ()
 Set/Get the default threader used for process objects. More...
 
static void SetGlobalDefaultNumberOfThreads (unsigned int n)
 
static unsigned int GetGlobalDefaultNumberOfThreads ()
 Set/Get the default threader used for process objects. More...
 
- 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 171 of file sitkIsolatedConnectedImageFilter.h.

◆ PixelIDTypeList

Define the pixels types supported by this filter

Definition at line 61 of file sitkIsolatedConnectedImageFilter.h.

◆ Self

Definition at line 51 of file sitkIsolatedConnectedImageFilter.h.

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

Self& itk::simple::IsolatedConnectedImageFilter::FindUpperThresholdOff ( )
inline

Definition at line 133 of file sitkIsolatedConnectedImageFilter.h.

◆ FindUpperThresholdOn()

Self& itk::simple::IsolatedConnectedImageFilter::FindUpperThresholdOn ( )
inline

Set the value of FindUpperThreshold to true or false respectfully.

Definition at line 132 of file sitkIsolatedConnectedImageFilter.h.

◆ 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 138 of file sitkIsolatedConnectedImageFilter.h.

◆ 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 153 of file sitkIsolatedConnectedImageFilter.h.

◆ 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 124 of file sitkIsolatedConnectedImageFilter.h.

◆ 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 94 of file sitkIsolatedConnectedImageFilter.h.

◆ GetName()

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

Name of this class

Implements itk::simple::ProcessObject.

Definition at line 157 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 114 of file sitkIsolatedConnectedImageFilter.h.

◆ GetSeed1()

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

Definition at line 73 of file sitkIsolatedConnectedImageFilter.h.

◆ GetSeed2()

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

Definition at line 84 of file sitkIsolatedConnectedImageFilter.h.

◆ 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 145 of file sitkIsolatedConnectedImageFilter.h.

◆ 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 104 of file sitkIsolatedConnectedImageFilter.h.

◆ SetFindUpperThreshold()

Self& 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 129 of file sitkIsolatedConnectedImageFilter.h.

◆ SetIsolatedValueTolerance()

Self& itk::simple::IsolatedConnectedImageFilter::SetIsolatedValueTolerance ( double  IsolatedValueTolerance)
inline

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

Definition at line 119 of file sitkIsolatedConnectedImageFilter.h.

◆ SetLower()

Self& 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 89 of file sitkIsolatedConnectedImageFilter.h.

◆ SetReplaceValue()

Self& 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 109 of file sitkIsolatedConnectedImageFilter.h.

◆ SetSeed1()

Self& 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 69 of file sitkIsolatedConnectedImageFilter.h.

◆ SetSeed2()

Self& 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 80 of file sitkIsolatedConnectedImageFilter.h.

◆ SetUpper()

Self& 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 99 of file sitkIsolatedConnectedImageFilter.h.

◆ ToString()

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

Print ourselves out

Reimplemented from itk::simple::ProcessObject.

Friends And Related Function Documentation

◆ detail::MemberFunctionAddressor< MemberFunctionType >

Definition at line 175 of file sitkIsolatedConnectedImageFilter.h.

Member Data Documentation

◆ m_FindUpperThreshold

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

Definition at line 193 of file sitkIsolatedConnectedImageFilter.h.

◆ m_IsolatedValue

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

Definition at line 198 of file sitkIsolatedConnectedImageFilter.h.

◆ m_IsolatedValueTolerance

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

Definition at line 190 of file sitkIsolatedConnectedImageFilter.h.

◆ m_Lower

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

Definition at line 184 of file sitkIsolatedConnectedImageFilter.h.

◆ m_MemberFactory

std::unique_ptr<detail::MemberFunctionFactory<MemberFunctionType> > itk::simple::IsolatedConnectedImageFilter::m_MemberFactory
private

Definition at line 177 of file sitkIsolatedConnectedImageFilter.h.

◆ m_ReplaceValue

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

Definition at line 188 of file sitkIsolatedConnectedImageFilter.h.

◆ m_Seed1

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

Definition at line 180 of file sitkIsolatedConnectedImageFilter.h.

◆ m_Seed2

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

Definition at line 182 of file sitkIsolatedConnectedImageFilter.h.

◆ m_ThresholdingFailed

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

Definition at line 196 of file sitkIsolatedConnectedImageFilter.h.

◆ m_Upper

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

Definition at line 186 of file sitkIsolatedConnectedImageFilter.h.


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