SimpleITK  1.3.0.dev466
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
}
 
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
 
virtual ~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
 

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 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) SITK_NOEXCEPT
 
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.

Note
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
CropImageFilter
itk::simple::Extract for the procedural interface
itk::ExtractImageFilter<InputImageType, typename InputImageType::template Rebind for the Doxygen on the original ITK class.

Definition at line 56 of file sitkExtractImageFilter.h.

Member Typedef Documentation

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

Setup for member function dispatching

Definition at line 124 of file sitkExtractImageFilter.h.

Define the pixels types supported by this filter

Definition at line 68 of file sitkExtractImageFilter.h.

Definition at line 58 of file sitkExtractImageFilter.h.

Member Enumeration Documentation

Enumerator
DIRECTIONCOLLAPSETOUNKOWN 
DIRECTIONCOLLAPSETOIDENTITY 
DIRECTIONCOLLAPSETOSUBMATRIX 
DIRECTIONCOLLAPSETOGUESS 

Definition at line 89 of file sitkExtractImageFilter.h.

Constructor & Destructor Documentation

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

Destructor

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

Default Constructor that takes no arguments and initializes default parameters

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)
private
DirectionCollapseToStrategyType itk::simple::ExtractImageFilter::GetDirectionCollapseToStrategy ( ) const
inline

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 105 of file sitkExtractImageFilter.h.

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

Definition at line 87 of file sitkExtractImageFilter.h.

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

Name of this class

Implements itk::simple::ProcessObject.

Definition at line 107 of file sitkExtractImageFilter.h.

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

Definition at line 78 of file sitkExtractImageFilter.h.

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

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 100 of file sitkExtractImageFilter.h.

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

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

Definition at line 83 of file sitkExtractImageFilter.h.

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

Definition at line 74 of file sitkExtractImageFilter.h.

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

Print ourselves out

Reimplemented from itk::simple::ProcessObject.

Friends And Related Function Documentation

Definition at line 128 of file sitkExtractImageFilter.h.

Member Data Documentation

DirectionCollapseToStrategyType itk::simple::ExtractImageFilter::m_DirectionCollapseToStrategy
private

Definition at line 135 of file sitkExtractImageFilter.h.

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

Definition at line 134 of file sitkExtractImageFilter.h.

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

Definition at line 130 of file sitkExtractImageFilter.h.

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

Definition at line 133 of file sitkExtractImageFilter.h.


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