SimpleITK  1.0.1
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 {
typedef NonLabelPixelIDTypeList PixelIDTypeList
typedef ExtractImageFilter Self
- Public Types inherited from itk::simple::ImageFilter< 1 >
typedef ImageFilter Self
- Public Types inherited from itk::simple::ProcessObject
typedef ProcessObject Self

Public Member Functions

Image Execute (const Image &image1)
Image Execute (const Image &image1, const std::vector< unsigned int > &size, const std::vector< int > &index, ExtractImageFilter::DirectionCollapseToStrategyType directionCollapseToStrategy)
 ExtractImageFilter ()
DirectionCollapseToStrategyType GetDirectionCollapseToStrategy () const
std::vector< int > GetIndex () const
std::string GetName () const
std::vector< unsigned int > GetSize () const
SelfSetDirectionCollapseToStrategy (DirectionCollapseToStrategyType DirectionCollapseToStrategy)
SelfSetIndex (const std::vector< int > &Index)
SelfSetSize (const std::vector< unsigned int > &Size)
std::string ToString () const
 ~ExtractImageFilter ()
- Public Member Functions inherited from itk::simple::ImageFilter< 1 >
 ImageFilter ()
virtual ~ImageFilter ()=0
- Public Member Functions inherited from itk::simple::ProcessObject
virtual void Abort ()
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

Private Types

typedef Image(Self::* MemberFunctionType) (const Image &image1)

Private Member Functions

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

Private Attributes

DirectionCollapseToStrategyType m_DirectionCollapseToStrategy
std::vector< int > m_Index
nsstd::auto_ptr< detail::MemberFunctionFactory< MemberFunctionType > > m_MemberFactory
std::vector< unsigned int > m_Size


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 void SetGlobalDefaultNumberOfThreads (unsigned int n)
static unsigned int GetGlobalDefaultNumberOfThreads ()
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...
- 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) throw ()
virtual void PreUpdate (itk::ProcessObject *p)
virtual void RemoveITKObserver (EventCommand &e)
- Protected Member Functions inherited from itk::simple::NonCopyable
 NonCopyable ()
- Static Protected Member Functions inherited from itk::simple::ImageFilter< 1 >
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 TImageType >
static Image CastITKToImage (TImageType *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)
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 target region must be specified.

ExtractImageFilter also 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 ExtractionRegion must be specified. For any dimension dim where ExtractionRegion.Size[dim] = 0, that dimension is collapsed. The index to collapse on is specified by ExtractionRegion.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 ExtractionRegion.Size = [4,4,4,0] and ExtractionRegion.Index = [0,0,0,2].

The number of dimension in ExtractionRegion.Size and Index must = InputImageDimension. The number of non-zero dimensions in ExtractionRegion.Size must = OutputImageDimension.

The output image produced by this filter will have the same origin as the input image, while the ImageRegion of the output image will start at the starting index value provided in the ExtractRegion parameter. If you are looking for a filter that will re-compute the origin of the output image, and provide an output image region whose index is set to zeros, then you may want to use the RegionOfInterestImageFilter . The output spacing is is simply the collapsed version of the input spacing.

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. It is REQUIRED that a strategy be explicitly requested (i.e. there is no working default). Direction Collapsing Strategies: 1) DirectionCollapseToUnknown(); This is the default and the filter can not run when this is set. The reason is to explicitly force the application developer to define their desired behavior. 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 ThreadedGenerateData() method for its implementation.

This filter is derived from InPlaceImageFilter . When the input to this filter matched the output requirested region, like with streaming filter for input, then setting this filter to run in-place will result in no copying of the bulk pixel data.
See also
Wiki Examples:

Definition at line 62 of file sitkExtractImageFilter.h.

Member Typedef Documentation

typedef Image(Self::* itk::simple::ExtractImageFilter::MemberFunctionType) (const Image &image1)

Setup for member function dispatching

Definition at line 131 of file sitkExtractImageFilter.h.

Define the pixels types supported by this filter

Definition at line 74 of file sitkExtractImageFilter.h.

Definition at line 64 of file sitkExtractImageFilter.h.

Member Enumeration Documentation


Definition at line 95 of file sitkExtractImageFilter.h.

Constructor & Destructor Documentation

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

Default Constructor that takes no arguments and initializes default parameters

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


Member Function Documentation

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

Execute the filter on the input image

Image itk::simple::ExtractImageFilter::Execute ( const Image image1,
const std::vector< unsigned int > &  size,
const std::vector< int > &  index,
ExtractImageFilter::DirectionCollapseToStrategyType  directionCollapseToStrategy 

Execute the filter on the input image with the given parameters

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

NOTE: The SetDirectionCollapseToUknown is explicitly not defined. It is a state that a filter can be in only when it is first instantiate prior to being initialized. Get the currently set strategy for collapsing directions of physical space.

Definition at line 111 of file sitkExtractImageFilter.h.

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

Definition at line 93 of file sitkExtractImageFilter.h.

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

Name of this class

Implements itk::simple::ProcessObject.

Definition at line 113 of file sitkExtractImageFilter.h.

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

Definition at line 84 of file sitkExtractImageFilter.h.

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

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

itk::itkExtractImageFilter::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.

itk::itkExtractImageFilter::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 scenerios.

itk::itkExtractImageFilter::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 106 of file sitkExtractImageFilter.h.

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

odo the internal setting of the method needs work!!!

Definition at line 89 of file sitkExtractImageFilter.h.

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

Definition at line 80 of file sitkExtractImageFilter.h.

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

Print ourselves out

Reimplemented from itk::simple::ProcessObject.

Friends And Related Function Documentation

Definition at line 136 of file sitkExtractImageFilter.h.

Member Data Documentation

DirectionCollapseToStrategyType itk::simple::ExtractImageFilter::m_DirectionCollapseToStrategy

Definition at line 143 of file sitkExtractImageFilter.h.

std::vector<int> itk::simple::ExtractImageFilter::m_Index

Definition at line 142 of file sitkExtractImageFilter.h.

nsstd::auto_ptr<detail::MemberFunctionFactory<MemberFunctionType> > itk::simple::ExtractImageFilter::m_MemberFactory

Definition at line 138 of file sitkExtractImageFilter.h.

std::vector<unsigned int> itk::simple::ExtractImageFilter::m_Size

Definition at line 141 of file sitkExtractImageFilter.h.

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