ITK
6.0.0
Insight Toolkit
|
#include <itkResampleImageFilter.h>
Resample an image via a coordinate transform.
ResampleImageFilter resamples an existing image through some coordinate transform, interpolating via some image function. The class is templated over the types of the input and output images.
Note that the choice of interpolator function can be important. This function is set via SetInterpolator(). The default is LinearInterpolateImageFunction<InputImageType, TInterpolatorPrecisionType>, which is reasonable for ordinary medical images. However, some synthetic images have pixels drawn from a finite prescribed set. An example would be a mask indicating the segmentation of a brain into a small number of tissue types. For such an image, one does not want to interpolate between different pixel values, and so NearestNeighborInterpolateImageFunction< InputImageType, TCoordRep > would be a better choice.
If an sample is taken from outside the image domain, the default behavior is to use a default pixel value. If different behavior is desired, an extrapolator function can be set with SetExtrapolator().
Output information (spacing, size and direction) for the output image should be set. This information has the normal defaults of unit spacing, zero origin and identity direction. Optionally, the output information can be obtained from a reference image. If the reference image is provided and UseReferenceImage is On, then the spacing, origin and direction of the reference image will be used.
Since this filter produces an image which is a different size than its input, it needs to override several of the methods defined in ProcessObject in order to properly manage the pipeline execution model. In particular, this filter overrides ProcessObject::GenerateInputRequestedRegion() and ProcessObject::GenerateOutputInformation().
This filter is implemented as a multithreaded filter. It provides a DynamicThreadedGenerateData() method for its implementation.
Definition at line 90 of file itkResampleImageFilter.h.
Static Public Member Functions | |
static Pointer | New () |
Static Public Member Functions inherited from itk::ImageToImageFilter< TInputImage, TOutputImage > | |
static double | GetGlobalDefaultCoordinateTolerance () |
static double | GetGlobalDefaultDirectionTolerance () |
static void | SetGlobalDefaultCoordinateTolerance (double) |
static void | SetGlobalDefaultDirectionTolerance (double) |
Static Public Member Functions inherited from itk::Object | |
static bool | GetGlobalWarningDisplay () |
static void | GlobalWarningDisplayOff () |
static void | GlobalWarningDisplayOn () |
static Pointer | New () |
static void | SetGlobalWarningDisplay (bool val) |
Static Public Member Functions inherited from itk::LightObject | |
static void | BreakOnError () |
static Pointer | New () |
Static Public Attributes | |
static constexpr unsigned int | InputImageDimension = TInputImage::ImageDimension |
static constexpr unsigned int | OutputImageDimension = TOutputImage::ImageDimension |
Static Public Attributes inherited from itk::ImageToImageFilter< TInputImage, TOutputImage > | |
static constexpr unsigned int | InputImageDimension = TInputImage::ImageDimension |
static constexpr unsigned int | OutputImageDimension = TOutputImage::ImageDimension |
Static Public Attributes inherited from itk::ImageSource< TOutputImage > | |
static constexpr unsigned int | OutputImageDimension = TOutputImage::ImageDimension |
Static Protected Member Functions | |
template<typename TComponent > | |
static itkLegacyMacro(virtual PixelType CastPixelWithBoundsChecking(const InterpolatorOutputType value, const ComponentType minComponent, const ComponentType maxComponent) const ;) private PixelComponentType | CastComponentWithBoundsChecking (const TComponent value) |
static PixelType | CastPixelWithBoundsChecking (const ComponentType value) |
template<typename TPixel > | |
static PixelType | CastPixelWithBoundsChecking (const TPixel value) |
Static Protected Member Functions inherited from itk::ImageSource< TOutputImage > | |
static const ImageRegionSplitterBase * | GetGlobalDefaultSplitter () |
static ITK_THREAD_RETURN_FUNCTION_CALL_CONVENTION | ThreaderCallback (void *arg) |
Static Protected Member Functions inherited from itk::ProcessObject | |
template<typename TSourceObject > | |
static void | MakeRequiredOutputs (TSourceObject &sourceObject, const DataObjectPointerArraySizeType numberOfRequiredOutputs) |
static constexpr float | progressFixedToFloat (uint32_t fixed) |
static uint32_t | progressFloatToFixed (float f) |
Protected Attributes | |
PixelType | m_DefaultPixelValue {} |
ExtrapolatorPointerType | m_Extrapolator {} |
InterpolatorPointerType | m_Interpolator {} |
DirectionType | m_OutputDirection {} |
OriginPointType | m_OutputOrigin {} |
SpacingType | m_OutputSpacing {} |
IndexType | m_OutputStartIndex {} |
SizeType | m_Size {} |
bool | m_UseReferenceImage { false } |
Protected Attributes inherited from itk::ImageSource< TOutputImage > | |
bool | m_DynamicMultiThreading { true } |
Protected Attributes inherited from itk::ProcessObject | |
TimeStamp | m_OutputInformationMTime {} |
bool | m_Updating {} |
Protected Attributes inherited from itk::LightObject | |
std::atomic< int > | m_ReferenceCount {} |
Additional Inherited Members | |
Protected Types inherited from itk::ImageToImageFilter< TInputImage, TOutputImage > | |
using | InputToOutputRegionCopierType = ImageToImageFilterDetail::ImageRegionCopier< Self::OutputImageDimension, Self::InputImageDimension > |
using | OutputToInputRegionCopierType = ImageToImageFilterDetail::ImageRegionCopier< Self::InputImageDimension, Self::OutputImageDimension > |
using itk::ResampleImageFilter< TInputImage, TOutputImage, TInterpolatorPrecisionType, TTransformPrecisionType >::ComponentType = typename InterpolatorConvertType::ComponentType |
Definition at line 145 of file itkResampleImageFilter.h.
using itk::ResampleImageFilter< TInputImage, TOutputImage, TInterpolatorPrecisionType, TTransformPrecisionType >::ConstPointer = SmartPointer<const Self> |
Definition at line 100 of file itkResampleImageFilter.h.
using itk::ResampleImageFilter< TInputImage, TOutputImage, TInterpolatorPrecisionType, TTransformPrecisionType >::ContinuousInputIndexType = ContinuousIndex<TInterpolatorPrecisionType, InputImageDimension> |
Input pixel continuous index typedef
Definition at line 173 of file itkResampleImageFilter.h.
using itk::ResampleImageFilter< TInputImage, TOutputImage, TInterpolatorPrecisionType, TTransformPrecisionType >::DecoratedTransformPointer = typename DecoratedTransformType::Pointer |
Definition at line 134 of file itkResampleImageFilter.h.
using itk::ResampleImageFilter< TInputImage, TOutputImage, TInterpolatorPrecisionType, TTransformPrecisionType >::DecoratedTransformType = DataObjectDecorator<TransformType> |
Definition at line 133 of file itkResampleImageFilter.h.
using itk::ResampleImageFilter< TInputImage, TOutputImage, TInterpolatorPrecisionType, TTransformPrecisionType >::DirectionType = typename TOutputImage::DirectionType |
Definition at line 181 of file itkResampleImageFilter.h.
using itk::ResampleImageFilter< TInputImage, TOutputImage, TInterpolatorPrecisionType, TTransformPrecisionType >::ExtrapolatorPointerType = typename ExtrapolatorType::Pointer |
Definition at line 152 of file itkResampleImageFilter.h.
using itk::ResampleImageFilter< TInputImage, TOutputImage, TInterpolatorPrecisionType, TTransformPrecisionType >::ExtrapolatorType = ExtrapolateImageFunction<InputImageType, TInterpolatorPrecisionType> |
Extrapolator type alias.
Definition at line 151 of file itkResampleImageFilter.h.
using itk::ResampleImageFilter< TInputImage, TOutputImage, TInterpolatorPrecisionType, TTransformPrecisionType >::ImageBaseType = ImageBase<Self::OutputImageDimension> |
base type for images of the current OutputImageDimension
Definition at line 126 of file itkResampleImageFilter.h.
using itk::ResampleImageFilter< TInputImage, TOutputImage, TInterpolatorPrecisionType, TTransformPrecisionType >::IndexType = typename TOutputImage::IndexType |
Image index type alias.
Definition at line 158 of file itkResampleImageFilter.h.
using itk::ResampleImageFilter< TInputImage, TOutputImage, TInterpolatorPrecisionType, TTransformPrecisionType >::InputImageConstPointer = typename InputImageType::ConstPointer |
Definition at line 105 of file itkResampleImageFilter.h.
using itk::ResampleImageFilter< TInputImage, TOutputImage, TInterpolatorPrecisionType, TTransformPrecisionType >::InputImagePointer = typename InputImageType::Pointer |
Definition at line 104 of file itkResampleImageFilter.h.
using itk::ResampleImageFilter< TInputImage, TOutputImage, TInterpolatorPrecisionType, TTransformPrecisionType >::InputImageRegionType = typename InputImageType::RegionType |
Definition at line 107 of file itkResampleImageFilter.h.
using itk::ResampleImageFilter< TInputImage, TOutputImage, TInterpolatorPrecisionType, TTransformPrecisionType >::InputImageType = TInputImage |
Definition at line 102 of file itkResampleImageFilter.h.
using itk::ResampleImageFilter< TInputImage, TOutputImage, TInterpolatorPrecisionType, TTransformPrecisionType >::InputPixelType = typename TInputImage::PixelType |
Definition at line 166 of file itkResampleImageFilter.h.
using itk::ResampleImageFilter< TInputImage, TOutputImage, TInterpolatorPrecisionType, TTransformPrecisionType >::InputPointType = typename InterpolatorType::PointType |
Image point type alias.
Definition at line 161 of file itkResampleImageFilter.h.
using itk::ResampleImageFilter< TInputImage, TOutputImage, TInterpolatorPrecisionType, TTransformPrecisionType >::InterpolatorConvertType = DefaultConvertPixelTraits<InterpolatorOutputType> |
Definition at line 143 of file itkResampleImageFilter.h.
using itk::ResampleImageFilter< TInputImage, TOutputImage, TInterpolatorPrecisionType, TTransformPrecisionType >::InterpolatorOutputType = typename InterpolatorType::OutputType |
Definition at line 141 of file itkResampleImageFilter.h.
using itk::ResampleImageFilter< TInputImage, TOutputImage, TInterpolatorPrecisionType, TTransformPrecisionType >::InterpolatorPointerType = typename InterpolatorType::Pointer |
Definition at line 139 of file itkResampleImageFilter.h.
using itk::ResampleImageFilter< TInputImage, TOutputImage, TInterpolatorPrecisionType, TTransformPrecisionType >::InterpolatorType = InterpolateImageFunction<InputImageType, TInterpolatorPrecisionType> |
Interpolator type alias.
Definition at line 138 of file itkResampleImageFilter.h.
using itk::ResampleImageFilter< TInputImage, TOutputImage, TInterpolatorPrecisionType, TTransformPrecisionType >::LinearInterpolatorPointerType = typename LinearInterpolatorType::Pointer |
Definition at line 148 of file itkResampleImageFilter.h.
using itk::ResampleImageFilter< TInputImage, TOutputImage, TInterpolatorPrecisionType, TTransformPrecisionType >::LinearInterpolatorType = LinearInterpolateImageFunction<InputImageType, TInterpolatorPrecisionType> |
Definition at line 147 of file itkResampleImageFilter.h.
using itk::ResampleImageFilter< TInputImage, TOutputImage, TInterpolatorPrecisionType, TTransformPrecisionType >::OriginPointType = typename TOutputImage::PointType |
Definition at line 180 of file itkResampleImageFilter.h.
using itk::ResampleImageFilter< TInputImage, TOutputImage, TInterpolatorPrecisionType, TTransformPrecisionType >::OutputImagePointer = typename OutputImageType::Pointer |
Definition at line 106 of file itkResampleImageFilter.h.
using itk::ResampleImageFilter< TInputImage, TOutputImage, TInterpolatorPrecisionType, TTransformPrecisionType >::OutputImageRegionType = typename TOutputImage::RegionType |
Typedef to describe the output image region type.
Definition at line 176 of file itkResampleImageFilter.h.
using itk::ResampleImageFilter< TInputImage, TOutputImage, TInterpolatorPrecisionType, TTransformPrecisionType >::OutputImageType = TOutputImage |
Definition at line 103 of file itkResampleImageFilter.h.
using itk::ResampleImageFilter< TInputImage, TOutputImage, TInterpolatorPrecisionType, TTransformPrecisionType >::OutputPointType = typename TOutputImage::PointType |
Definition at line 162 of file itkResampleImageFilter.h.
using itk::ResampleImageFilter< TInputImage, TOutputImage, TInterpolatorPrecisionType, TTransformPrecisionType >::PixelComponentType = typename PixelConvertType::ComponentType |
Definition at line 170 of file itkResampleImageFilter.h.
using itk::ResampleImageFilter< TInputImage, TOutputImage, TInterpolatorPrecisionType, TTransformPrecisionType >::PixelConvertType = DefaultConvertPixelTraits<PixelType> |
Definition at line 168 of file itkResampleImageFilter.h.
using itk::ResampleImageFilter< TInputImage, TOutputImage, TInterpolatorPrecisionType, TTransformPrecisionType >::PixelType = typename TOutputImage::PixelType |
Image pixel value type alias.
Definition at line 165 of file itkResampleImageFilter.h.
using itk::ResampleImageFilter< TInputImage, TOutputImage, TInterpolatorPrecisionType, TTransformPrecisionType >::Pointer = SmartPointer<Self> |
Definition at line 99 of file itkResampleImageFilter.h.
using itk::ResampleImageFilter< TInputImage, TOutputImage, TInterpolatorPrecisionType, TTransformPrecisionType >::ReferenceImageBaseType = ImageBase<OutputImageDimension> |
Typedef the reference image type to be the ImageBase of the OutputImageType
Definition at line 184 of file itkResampleImageFilter.h.
using itk::ResampleImageFilter< TInputImage, TOutputImage, TInterpolatorPrecisionType, TTransformPrecisionType >::Self = ResampleImageFilter |
Standard class type aliases.
Definition at line 97 of file itkResampleImageFilter.h.
using itk::ResampleImageFilter< TInputImage, TOutputImage, TInterpolatorPrecisionType, TTransformPrecisionType >::SizeType = Size<Self::OutputImageDimension> |
Image size type alias.
Definition at line 155 of file itkResampleImageFilter.h.
using itk::ResampleImageFilter< TInputImage, TOutputImage, TInterpolatorPrecisionType, TTransformPrecisionType >::SpacingType = typename TOutputImage::SpacingType |
Image spacing,origin and direction type alias
Definition at line 179 of file itkResampleImageFilter.h.
using itk::ResampleImageFilter< TInputImage, TOutputImage, TInterpolatorPrecisionType, TTransformPrecisionType >::Superclass = ImageToImageFilter<TInputImage, TOutputImage> |
Definition at line 98 of file itkResampleImageFilter.h.
using itk::ResampleImageFilter< TInputImage, TOutputImage, TInterpolatorPrecisionType, TTransformPrecisionType >::TransformPointerType = typename TransformType::ConstPointer |
Definition at line 132 of file itkResampleImageFilter.h.
using itk::ResampleImageFilter< TInputImage, TOutputImage, TInterpolatorPrecisionType, TTransformPrecisionType >::TransformType = Transform<TTransformPrecisionType, Self::OutputImageDimension, Self::InputImageDimension> |
Transform type alias.
Definition at line 131 of file itkResampleImageFilter.h.
|
protected |
|
overrideprotecteddefault |
|
overrideprotectedvirtual |
Set the state of the filter after multi-threading.
Reimplemented from itk::ImageSource< TOutputImage >.
|
overrideprotectedvirtual |
Set up state of filter before multi-threading. InterpolatorType::SetInputImage is not thread-safe and hence has to be set up before DynamicThreadedGenerateData
Reimplemented from itk::ImageSource< TOutputImage >.
|
staticprotected |
Cast pixel from interpolator output to PixelType.
|
staticprotected |
|
staticprotected |
|
overrideprotectedvirtual |
ResampleImageFilter can be implemented as a multithreaded filter. Therefore, this implementation provides a DynamicThreadedGenerateData() routine which is called for each processing thread. The output image data is allocated automatically by the superclass prior to calling DynamicThreadedGenerateData(). DynamicThreadedGenerateData can only write to the portion of the output image specified by the parameter "outputRegionForThread"
Reimplemented from itk::ImageSource< TOutputImage >.
|
overrideprotectedvirtual |
ResampleImageFilter needs a different input requested region than the output requested region. As such, ResampleImageFilter needs to provide an implementation for GenerateInputRequestedRegion() in order to inform the pipeline execution model.
Reimplemented from itk::ImageToImageFilter< TInputImage, TOutputImage >.
|
overrideprotectedvirtual |
ResampleImageFilter produces an image which is a different size than its input. As such, it needs to provide an implementation for GenerateOutputInformation() in order to inform the pipeline execution model. The original documentation of this method is below.
Reimplemented from itk::ProcessObject.
|
virtual |
Get/Set the pixel value when a transformed pixel is outside of the image. The default default pixel value is 0.
|
virtual |
Get/Set the extrapolator function. The default behavior when sampling outside of the input image is to use the DefaultPixelValue. Some other options include NearestNeighborExtrapolateImageFunction.
|
virtual |
Get/Set the interpolator function. The default is LinearInterpolateImageFunction<InputImageType, TInterpolatorPrecisionType>. Some other options are NearestNeighborInterpolateImageFunction (useful for binary masks and other images with a small number of possible pixel values), and BSplineInterpolateImageFunction (which provides a higher order of interpolation).
|
overrideprotectedvirtual |
Compute the Modified Time based on the changed components.
Reimplemented from itk::Object.
|
overridevirtual |
Reimplemented from itk::ImageToImageFilter< TInputImage, TOutputImage >.
|
virtual |
Set the output direction cosine matrix.
|
virtual |
Get the output image origin.
|
virtual |
Get the output image spacing.
|
virtual |
Get the start index of the output largest possible region.
|
virtual |
Get/Set the size of the output image.
|
virtual |
Turn on/off whether a specified reference image should be used to define the output information.
|
protected |
itk::ResampleImageFilter< TInputImage, TOutputImage, TInterpolatorPrecisionType, TTransformPrecisionType >::itkGetInputMacro | ( | ReferenceImage | , |
ReferenceImageBaseType | |||
) |
Get the reference image that is defining the output information.
itk::ResampleImageFilter< TInputImage, TOutputImage, TInterpolatorPrecisionType, TTransformPrecisionType >::itkSetInputMacro | ( | ReferenceImage | , |
ReferenceImageBaseType | |||
) |
Set a reference image to use to define the output information. By default, output information is specified through the SetOutputSpacing, SetOutputOrigin, and SetOutputDirection or SetOutputParametersFromImage methods. Alternatively, this method can be used to specify an image from which to copy the pixel information. UseReferenceImageOn must be set to utilize the reference image.
|
protectedvirtual |
Implementation for resampling that works for with linear transformation types.
|
static |
Method for creation through the object factory.
|
protectedvirtual |
Default implementation for resampling that works for any transformation type.
|
overrideprotectedvirtual |
Methods invoked by Print() to print information about the object including superclasses. Typically not called by the user (use Print() instead) but used in the hierarchical print process to combine the output of several classes.
Reimplemented from itk::ImageToImageFilter< TInputImage, TOutputImage >.
|
virtual |
Get/Set the pixel value when a transformed pixel is outside of the image. The default default pixel value is 0.
|
virtual |
Get/Set the extrapolator function. The default behavior when sampling outside of the input image is to use the DefaultPixelValue. Some other options include NearestNeighborExtrapolateImageFunction.
|
virtual |
Get/Set the interpolator function. The default is LinearInterpolateImageFunction<InputImageType, TInterpolatorPrecisionType>. Some other options are NearestNeighborInterpolateImageFunction (useful for binary masks and other images with a small number of possible pixel values), and BSplineInterpolateImageFunction (which provides a higher order of interpolation).
|
virtual |
Set the output direction cosine matrix.
|
virtual |
Set the output image origin.
|
virtual |
Set the output image origin.
void itk::ResampleImageFilter< TInputImage, TOutputImage, TInterpolatorPrecisionType, TTransformPrecisionType >::SetOutputParametersFromImage | ( | const ImageBaseType * | image | ) |
Helper method to set the output parameters based on this image.
|
virtual |
Set the output image spacing.
|
virtual |
Set the output image spacing.
|
virtual |
Set the start index of the output largest possible region. The default is an index of all zeros.
|
virtual |
Get/Set the size of the output image.
|
virtual |
Get/Set the coordinate transformation. Set the coordinate transform to use for resampling. Note that this must be in physical coordinates and it is the output-to-input transform, NOT the input-to-output transform that you might naively expect. By default the filter uses an Identity transform. You must provide a different transform here, before attempting to run the filter, if you do not want to use the default Identity transform.
|
virtual |
Turn on/off whether a specified reference image should be used to define the output information.
|
virtual |
Turn on/off whether a specified reference image should be used to define the output information.
|
inlineoverrideprotectedvirtual |
Override VerifyInputInformation() since this filter's inputs do not need to occupy the same physical space.
Reimplemented from itk::ImageToImageFilter< TInputImage, TOutputImage >.
Definition at line 300 of file itkResampleImageFilter.h.
|
overridevirtual |
Verifies that the process object has been configured correctly, that all required inputs are set, and needed parameters are set appropriately. If not valid an exceptions will be thrown.
This method is called before UpdateOutputInformation() is propagated to the inputs.
The ProcessObject's implementation verifies that the m_NumberOfRequiredInputs are set and not null.
Reimplemented from itk::ProcessObject.
|
staticconstexpr |
Number of dimensions of input image.
Definition at line 119 of file itkResampleImageFilter.h.
|
protected |
Definition at line 384 of file itkResampleImageFilter.h.
|
protected |
Definition at line 382 of file itkResampleImageFilter.h.
|
protected |
Definition at line 380 of file itkResampleImageFilter.h.
|
protected |
Definition at line 389 of file itkResampleImageFilter.h.
|
protected |
Definition at line 388 of file itkResampleImageFilter.h.
|
protected |
Definition at line 387 of file itkResampleImageFilter.h.
|
protected |
Definition at line 390 of file itkResampleImageFilter.h.
|
protected |
Definition at line 379 of file itkResampleImageFilter.h.
|
protected |
Definition at line 391 of file itkResampleImageFilter.h.
|
staticconstexpr |
Number of dimensions of output image.
Definition at line 116 of file itkResampleImageFilter.h.