SimpleITK  2.0.0rc2.post50
Public Types | Public Member Functions | Private Types | Private Member Functions | Private Attributes | Friends | List of all members
itk::simple::ExtractImageFilter Class Reference

Decrease the image size by cropping the image to the selected region bounds. More...

#include <sitkExtractImageFilter.h>

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

Public Types

enum  DirectionCollapseToStrategyType {
  DIRECTIONCOLLAPSETOUNKOWN,
  DIRECTIONCOLLAPSETOIDENTITY,
  DIRECTIONCOLLAPSETOSUBMATRIX,
  DIRECTIONCOLLAPSETOGUESS
}
 
using PixelIDTypeList = NonLabelPixelIDTypeList
 
using Self = ExtractImageFilter
 
- 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)
 
Image Execute (Image &&image1)
 
 ExtractImageFilter ()
 
DirectionCollapseToStrategyType GetDirectionCollapseToStrategy () const
 
std::vector< int > GetIndex () const
 Get the starting index to extract. More...
 
std::string GetName () const
 
std::vector< unsigned int > GetSize () const
 Get the size of the region to extract. More...
 
SelfSetDirectionCollapseToStrategy (DirectionCollapseToStrategyType DirectionCollapseToStrategy)
 Set the strategy to be used to collapse physical space dimensions. More...
 
SelfSetIndex (std::vector< int > Index)
 Set the starting index of the input image to extract. More...
 
SelfSetSize (std::vector< unsigned int > Size)
 Set the size of the region to extract. More...
 
std::string ToString () const
 
virtual ~ExtractImageFilter ()
 
- 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)
 
template<class TImageType >
Image ExecuteInternal (const TImageType *image1, unsigned int outputDimension, std::integral_constant< unsigned int, 1 > meta)
 
template<class TImageType , unsigned int OutputDimension>
Image ExecuteInternal (const TImageType *image1, unsigned int outputDimension, std::integral_constant< unsigned int, OutputDimension > meta)
 

Private Attributes

DirectionCollapseToStrategyType m_DirectionCollapseToStrategy {itk::simple::ExtractImageFilter::DIRECTIONCOLLAPSETOGUESS}
 
std::vector< int > m_Index {std::vector<int>(SITK_MAX_DIMENSION, 0)}
 
bool m_InPlace {false}
 
std::unique_ptr< detail::MemberFunctionFactory< MemberFunctionType > > m_MemberFactory
 
std::vector< unsigned int > m_Size {std::vector<unsigned int>(SITK_MAX_DIMENSION, 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<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)
 

Detailed Description

Decrease the image size by cropping the image to the selected region bounds.

ExtractImageFilter changes the image boundary of an image by removing pixels outside the target region. The region is specified as a Size and Index. The Size must be specified, while the Index defaults to zeros.

ExtractImageFilter can collapses dimensions so that the input image may have more dimensions than the output image (i.e. 4-D input image to a 3-D output image). To specify what dimensions to collapse, the Size must be specified. For any dimension dim where the Size[dim] == 0, that dimension is collapsed. The index to collapse on is specified by Index[dim]. For example, we have a image 4D = a 4x4x4x4 image, and we want to get a 3D image, 3D = a 4x4x4 image, specified as [x,y,z,2] from 4D (i.e. the 3rd "time" slice from 4D). The Size = [4,4,4,0] and Index = [0,0,0,2].

The number of dimension in Size and Index must at least dimension of the input image. The number of non-zero dimensions in Size determines the output dimension.

Determining the direction of the collapsed output image from an larger dimensional input space is an ill defined problem in general. It is required that the application developer select the desired transformation strategy for collapsing direction cosines. The strategy defaults to the guess approach. Direction Collapsing Strategies: 1) DirectionCollapseToUnknown(); This is the default in ITK and the filter can not run when this is set. 1) DirectionCollapseToIdentity(); Output has identity direction no matter what 2) DirectionCollapseToSubmatrix(); Output direction is the sub-matrix if it is positive definite, else throw an exception.

This filter is implemented as a multithreaded filter. It provides a DynamicThreadedGenerateData() method for its implementation.

See also
CropImageFilter
itk::simple::Extract for the procedural interface
itk::ExtractImageFilter for the Doxygen on the original ITK class.

Definition at line 72 of file sitkExtractImageFilter.h.

Member Typedef Documentation

◆ MemberFunctionType

using itk::simple::ExtractImageFilter::MemberFunctionType = Image (Self::*)( const Image& image1 )
private

Setup for member function dispatching

Definition at line 158 of file sitkExtractImageFilter.h.

◆ PixelIDTypeList

Define the pixels types supported by this filter

Definition at line 84 of file sitkExtractImageFilter.h.

◆ Self

Definition at line 74 of file sitkExtractImageFilter.h.

Member Enumeration Documentation

◆ DirectionCollapseToStrategyType

Enumerator
DIRECTIONCOLLAPSETOUNKOWN 
DIRECTIONCOLLAPSETOIDENTITY 
DIRECTIONCOLLAPSETOSUBMATRIX 
DIRECTIONCOLLAPSETOGUESS 

Definition at line 109 of file sitkExtractImageFilter.h.

Constructor & Destructor Documentation

◆ ~ExtractImageFilter()

virtual itk::simple::ExtractImageFilter::~ExtractImageFilter ( )
virtual

Destructor

◆ ExtractImageFilter()

itk::simple::ExtractImageFilter::ExtractImageFilter ( )

Default Constructor that takes no arguments and initializes default parameters

Member Function Documentation

◆ Execute() [1/2]

Image itk::simple::ExtractImageFilter::Execute ( const Image image1)

◆ Execute() [2/2]

Image itk::simple::ExtractImageFilter::Execute ( Image &&  image1)

Execute the filter on the input image

◆ ExecuteInternal() [1/3]

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

◆ ExecuteInternal() [2/3]

template<class TImageType >
Image itk::simple::ExtractImageFilter::ExecuteInternal ( const TImageType *  image1,
unsigned int  outputDimension,
std::integral_constant< unsigned int, 1 >  meta 
)
private

◆ ExecuteInternal() [3/3]

template<class TImageType , unsigned int OutputDimension>
Image itk::simple::ExtractImageFilter::ExecuteInternal ( const TImageType *  image1,
unsigned int  outputDimension,
std::integral_constant< unsigned int, OutputDimension >  meta 
)
private

◆ GetDirectionCollapseToStrategy()

DirectionCollapseToStrategyType itk::simple::ExtractImageFilter::GetDirectionCollapseToStrategy ( ) const
inline

Get the currently set strategy for collapsing directions of physical space.

Definition at line 139 of file sitkExtractImageFilter.h.

◆ GetIndex()

std::vector<int> itk::simple::ExtractImageFilter::GetIndex ( ) const
inline

Get the starting index to extract.

Definition at line 107 of file sitkExtractImageFilter.h.

◆ GetName()

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

Name of this class

Implements itk::simple::ProcessObject.

Definition at line 142 of file sitkExtractImageFilter.h.

◆ GetSize()

std::vector<unsigned int> itk::simple::ExtractImageFilter::GetSize ( ) const
inline

Get the size of the region to extract.

Definition at line 97 of file sitkExtractImageFilter.h.

◆ SetDirectionCollapseToStrategy()

Self& itk::simple::ExtractImageFilter::SetDirectionCollapseToStrategy ( DirectionCollapseToStrategyType  DirectionCollapseToStrategy)
inline

Set the strategy to be used to collapse physical space dimensions.

DIRECTIONCOLLAPSETOIDENTITY Set the strategy so that all collapsed images have an identity direction. Use this strategy when you know that retention of the physical space orientation of the collapsed image is not important.

DIRECTIONCOLLAPSETOGUESS Set the strategy so that all collapsed images where output direction is the sub-matrix if it is positive definite, else return identity. This is backwards compatible with ITKv3, but is highly discouraged because the results are difficult to anticipate under differing data scenarios.

DIRECTIONCOLLAPSETOSUBMATRIX Set the strategy so that all collapsed images where output direction is the sub-matrix if it is positive definite, else throw an exception. Use this strategy when it is known that properly identified physical space sub-volumes can be reliably extracted from a higher dimensional space. For example when the application programmer knows that a 4D image is 3D+time, and that the 3D sub-space is properly defined.

Definition at line 135 of file sitkExtractImageFilter.h.

◆ SetIndex()

Self& itk::simple::ExtractImageFilter::SetIndex ( std::vector< int >  Index)
inline

Set the starting index of the input image to extract.

The index defaults to all zeros.

Definition at line 103 of file sitkExtractImageFilter.h.

◆ SetSize()

Self& itk::simple::ExtractImageFilter::SetSize ( std::vector< unsigned int >  Size)
inline

Set the size of the region to extract.

The size of the region to extract should be specified. Dimensions which have a size of 0 are collapsed. The number of non-zero sized determines the output dimension.

Definition at line 93 of file sitkExtractImageFilter.h.

◆ ToString()

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

Print ourselves out

Reimplemented from itk::simple::ProcessObject.

Friends And Related Function Documentation

◆ detail::MemberFunctionAddressor< MemberFunctionType >

Definition at line 161 of file sitkExtractImageFilter.h.

Member Data Documentation

◆ m_DirectionCollapseToStrategy

DirectionCollapseToStrategyType itk::simple::ExtractImageFilter::m_DirectionCollapseToStrategy {itk::simple::ExtractImageFilter::DIRECTIONCOLLAPSETOGUESS}
private

Definition at line 176 of file sitkExtractImageFilter.h.

◆ m_Index

std::vector<int> itk::simple::ExtractImageFilter::m_Index {std::vector<int>(SITK_MAX_DIMENSION, 0)}
private

Definition at line 174 of file sitkExtractImageFilter.h.

◆ m_InPlace

bool itk::simple::ExtractImageFilter::m_InPlace {false}
private

Definition at line 179 of file sitkExtractImageFilter.h.

◆ m_MemberFactory

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

Definition at line 163 of file sitkExtractImageFilter.h.

◆ m_Size

std::vector<unsigned int> itk::simple::ExtractImageFilter::m_Size {std::vector<unsigned int>(SITK_MAX_DIMENSION, 1)}
private

Definition at line 172 of file sitkExtractImageFilter.h.


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