#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, TCoordinate > 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.
Inheritance diagram for itk::ResampleImageFilter< TInputImage, TOutputImage, TInterpolatorPrecisionType, TTransformPrecisionType >:
Collaboration diagram for itk::ResampleImageFilter< TInputImage, TOutputImage, TInterpolatorPrecisionType, TTransformPrecisionType >: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 |
Private Member Functions | |
| void | InitializeTransform () |
Static Private Member Functions | |
| static PixelComponentType | CastComponentWithBoundsChecking (const PixelComponentType value) |
| template<typename TComponent> | |
| static PixelComponentType | CastComponentWithBoundsChecking (const TComponent value) |
| static PixelType | CastPixelWithBoundsChecking (const ComponentType value) |
| template<typename TPixel> | |
| static PixelType | CastPixelWithBoundsChecking (const TPixel value) |
Private 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 } |
Additional Inherited Members | |
Protected Types inherited from itk::ImageToImageFilter< TInputImage, TOutputImage > | |
| using | InputToOutputRegionCopierType |
| using | OutputToInputRegionCopierType |
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 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 {} |
| using itk::ResampleImageFilter< TInputImage, TOutputImage, TInterpolatorPrecisionType, TTransformPrecisionType >::ComponentType = typename InterpolatorConvertType::ComponentType |
Definition at line 144 of file itkResampleImageFilter.h.
| using itk::ResampleImageFilter< TInputImage, TOutputImage, TInterpolatorPrecisionType, TTransformPrecisionType >::ConstPointer = SmartPointer<const Self> |
Definition at line 99 of file itkResampleImageFilter.h.
| using itk::ResampleImageFilter< TInputImage, TOutputImage, TInterpolatorPrecisionType, TTransformPrecisionType >::ContinuousInputIndexType = ContinuousIndex<TInterpolatorPrecisionType, InputImageDimension> |
Input pixel continuous index typedef
Definition at line 172 of file itkResampleImageFilter.h.
| using itk::ResampleImageFilter< TInputImage, TOutputImage, TInterpolatorPrecisionType, TTransformPrecisionType >::DecoratedTransformPointer = typename DecoratedTransformType::Pointer |
Definition at line 133 of file itkResampleImageFilter.h.
| using itk::ResampleImageFilter< TInputImage, TOutputImage, TInterpolatorPrecisionType, TTransformPrecisionType >::DecoratedTransformType = DataObjectDecorator<TransformType> |
Definition at line 132 of file itkResampleImageFilter.h.
| using itk::ResampleImageFilter< TInputImage, TOutputImage, TInterpolatorPrecisionType, TTransformPrecisionType >::DirectionType = typename TOutputImage::DirectionType |
Definition at line 180 of file itkResampleImageFilter.h.
| using itk::ResampleImageFilter< TInputImage, TOutputImage, TInterpolatorPrecisionType, TTransformPrecisionType >::ExtrapolatorPointerType = typename ExtrapolatorType::Pointer |
Definition at line 151 of file itkResampleImageFilter.h.
| using itk::ResampleImageFilter< TInputImage, TOutputImage, TInterpolatorPrecisionType, TTransformPrecisionType >::ExtrapolatorType = ExtrapolateImageFunction<InputImageType, TInterpolatorPrecisionType> |
Extrapolator type alias.
Definition at line 150 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 125 of file itkResampleImageFilter.h.
| using itk::ResampleImageFilter< TInputImage, TOutputImage, TInterpolatorPrecisionType, TTransformPrecisionType >::IndexType = typename TOutputImage::IndexType |
Image index type alias.
Definition at line 157 of file itkResampleImageFilter.h.
| using itk::ResampleImageFilter< TInputImage, TOutputImage, TInterpolatorPrecisionType, TTransformPrecisionType >::InputImageConstPointer = typename InputImageType::ConstPointer |
Definition at line 104 of file itkResampleImageFilter.h.
| using itk::ResampleImageFilter< TInputImage, TOutputImage, TInterpolatorPrecisionType, TTransformPrecisionType >::InputImagePointer = typename InputImageType::Pointer |
Definition at line 103 of file itkResampleImageFilter.h.
| using itk::ResampleImageFilter< TInputImage, TOutputImage, TInterpolatorPrecisionType, TTransformPrecisionType >::InputImageRegionType = typename InputImageType::RegionType |
Definition at line 106 of file itkResampleImageFilter.h.
| using itk::ResampleImageFilter< TInputImage, TOutputImage, TInterpolatorPrecisionType, TTransformPrecisionType >::InputImageType = TInputImage |
Definition at line 101 of file itkResampleImageFilter.h.
| using itk::ResampleImageFilter< TInputImage, TOutputImage, TInterpolatorPrecisionType, TTransformPrecisionType >::InputPixelType = typename TInputImage::PixelType |
Definition at line 165 of file itkResampleImageFilter.h.
| using itk::ResampleImageFilter< TInputImage, TOutputImage, TInterpolatorPrecisionType, TTransformPrecisionType >::InputPointType = typename InterpolatorType::PointType |
Image point type alias.
Definition at line 160 of file itkResampleImageFilter.h.
| using itk::ResampleImageFilter< TInputImage, TOutputImage, TInterpolatorPrecisionType, TTransformPrecisionType >::InterpolatorConvertType = DefaultConvertPixelTraits<InterpolatorOutputType> |
Definition at line 142 of file itkResampleImageFilter.h.
| using itk::ResampleImageFilter< TInputImage, TOutputImage, TInterpolatorPrecisionType, TTransformPrecisionType >::InterpolatorOutputType = typename InterpolatorType::OutputType |
Definition at line 140 of file itkResampleImageFilter.h.
| using itk::ResampleImageFilter< TInputImage, TOutputImage, TInterpolatorPrecisionType, TTransformPrecisionType >::InterpolatorPointerType = typename InterpolatorType::Pointer |
Definition at line 138 of file itkResampleImageFilter.h.
| using itk::ResampleImageFilter< TInputImage, TOutputImage, TInterpolatorPrecisionType, TTransformPrecisionType >::InterpolatorType = InterpolateImageFunction<InputImageType, TInterpolatorPrecisionType> |
Interpolator type alias.
Definition at line 137 of file itkResampleImageFilter.h.
| using itk::ResampleImageFilter< TInputImage, TOutputImage, TInterpolatorPrecisionType, TTransformPrecisionType >::LinearInterpolatorPointerType = typename LinearInterpolatorType::Pointer |
Definition at line 147 of file itkResampleImageFilter.h.
| using itk::ResampleImageFilter< TInputImage, TOutputImage, TInterpolatorPrecisionType, TTransformPrecisionType >::LinearInterpolatorType = LinearInterpolateImageFunction<InputImageType, TInterpolatorPrecisionType> |
Definition at line 146 of file itkResampleImageFilter.h.
| using itk::ResampleImageFilter< TInputImage, TOutputImage, TInterpolatorPrecisionType, TTransformPrecisionType >::OriginPointType = typename TOutputImage::PointType |
Definition at line 179 of file itkResampleImageFilter.h.
| using itk::ResampleImageFilter< TInputImage, TOutputImage, TInterpolatorPrecisionType, TTransformPrecisionType >::OutputImagePointer = typename OutputImageType::Pointer |
Definition at line 105 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 175 of file itkResampleImageFilter.h.
| using itk::ResampleImageFilter< TInputImage, TOutputImage, TInterpolatorPrecisionType, TTransformPrecisionType >::OutputImageType = TOutputImage |
Definition at line 102 of file itkResampleImageFilter.h.
| using itk::ResampleImageFilter< TInputImage, TOutputImage, TInterpolatorPrecisionType, TTransformPrecisionType >::OutputPointType = typename TOutputImage::PointType |
Definition at line 161 of file itkResampleImageFilter.h.
| using itk::ResampleImageFilter< TInputImage, TOutputImage, TInterpolatorPrecisionType, TTransformPrecisionType >::PixelComponentType = typename PixelConvertType::ComponentType |
Definition at line 169 of file itkResampleImageFilter.h.
| using itk::ResampleImageFilter< TInputImage, TOutputImage, TInterpolatorPrecisionType, TTransformPrecisionType >::PixelConvertType = DefaultConvertPixelTraits<PixelType> |
Definition at line 167 of file itkResampleImageFilter.h.
| using itk::ResampleImageFilter< TInputImage, TOutputImage, TInterpolatorPrecisionType, TTransformPrecisionType >::PixelType = typename TOutputImage::PixelType |
Image pixel value type alias.
Definition at line 164 of file itkResampleImageFilter.h.
| using itk::ResampleImageFilter< TInputImage, TOutputImage, TInterpolatorPrecisionType, TTransformPrecisionType >::Pointer = SmartPointer<Self> |
Definition at line 98 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 183 of file itkResampleImageFilter.h.
| using itk::ResampleImageFilter< TInputImage, TOutputImage, TInterpolatorPrecisionType, TTransformPrecisionType >::Self = ResampleImageFilter |
Standard class type aliases.
Definition at line 96 of file itkResampleImageFilter.h.
| using itk::ResampleImageFilter< TInputImage, TOutputImage, TInterpolatorPrecisionType, TTransformPrecisionType >::SizeType = Size<Self::OutputImageDimension> |
Image size type alias.
Definition at line 154 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 178 of file itkResampleImageFilter.h.
| using itk::ResampleImageFilter< TInputImage, TOutputImage, TInterpolatorPrecisionType, TTransformPrecisionType >::Superclass = ImageToImageFilter<TInputImage, TOutputImage> |
Definition at line 97 of file itkResampleImageFilter.h.
| using itk::ResampleImageFilter< TInputImage, TOutputImage, TInterpolatorPrecisionType, TTransformPrecisionType >::TransformPointerType = typename TransformType::ConstPointer |
Definition at line 131 of file itkResampleImageFilter.h.
| using itk::ResampleImageFilter< TInputImage, TOutputImage, TInterpolatorPrecisionType, TTransformPrecisionType >::TransformType = Transform<TTransformPrecisionType, Self::OutputImageDimension, Self::InputImageDimension> |
Transform type alias.
Definition at line 130 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 >.
|
staticprivate |
|
staticprivate |
|
staticprivate |
|
staticprivate |
|
virtual |
Create an object from an instance, potentially deferring to a factory. This method allows you to create an instance of an object that is exactly the same type as the referring object. This is useful in cases where an object has been cast back to a base class.
Reimplemented from itk::Object.
|
overrideprotected |
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"
|
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 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 |
|
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 |
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).
|
nodiscardoverrideprotectedvirtual |
Compute the Modified Time based on the changed components.
Reimplemented from itk::Object.
|
virtual |
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 |
|
virtual |
|
virtual |
|
virtual |
Turn on/off whether a specified reference image should be used to define the output information.
|
private |
| 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 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 |
|
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 |
|
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.
|
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 295 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 118 of file itkResampleImageFilter.h.
|
private |
Definition at line 381 of file itkResampleImageFilter.h.
|
private |
Definition at line 379 of file itkResampleImageFilter.h.
|
private |
Definition at line 377 of file itkResampleImageFilter.h.
|
private |
Definition at line 386 of file itkResampleImageFilter.h.
|
private |
Definition at line 385 of file itkResampleImageFilter.h.
|
private |
Definition at line 384 of file itkResampleImageFilter.h.
|
private |
Definition at line 387 of file itkResampleImageFilter.h.
|
private |
Definition at line 376 of file itkResampleImageFilter.h.
|
private |
Definition at line 388 of file itkResampleImageFilter.h.
|
staticconstexpr |
Number of dimensions of output image.
Definition at line 115 of file itkResampleImageFilter.h.