#include <itkImageToImageFilterDetail.h>
Inheritance diagram for itk::ImageToImageFilterDetail::ImageRegionCopier:
Public Methods | |
virtual void | operator() (ImageRegion< D1 > &destRegion, const ImageRegion< D2 > &srcRegion) const |
Function object used for dispatching to various routines to copy a region (start index and size). Most filters use this function object as trivial copy because they require the input image dimension to match the output image dimension. However, some filters like itk::ExtractImageFilter can support output images of a lower dimension that the input.
This function object is used by the default implementation of ImageToImageFilter::GenerateInputRequestedRegion(). It can also be used in routines like ImageSource::ThreadedGenerateData() where a filter may need to map the the output region for a particular thread to an input region.
This copier uses a "dispatch pattern" to call one of three overloaded functions depending on whether the source and destination dimensions are the same, the source is of a higher dimension than the destination, or the source is of a lower dimension than the destination. The use of an overloaded function is required for proper compilation of the various cases.
For the latter two cases, trivial implementations are used. If the source dimension is a lower dimension than the destination, the output region information is copied into the first portion of the destination region and the rest of the input region is set to zero. If the source region is a higher dimension than the destination, the first portion of the source region is copied to the destination region.
ImageToImageFilter has an ivar which is a ImageRegionCopier. If a filter needs a different default behavior, it can call the ImageToImageFilter::SetRegionCopier() method passing in a subclass of the ImageToImageFilterDetail::RegionCopier function object. This would typically be done in the constructor of the filter. The ExtractImageFilter overrides this function object so that if the input image is a higher dimension than the output image, the filter can control "where" in the input image the output subimage is extracted (as opposed to mapping to first few dimensions of the input).
Definition at line 322 of file itkImageToImageFilterDetail.h.
|
Reimplemented in itk::ImageToImageFilterDetail::ExtractImageFilterRegionCopier< D1, D2 >. Definition at line 325 of file itkImageToImageFilterDetail.h. |