This module import functions for Geometric Transformation Filters
-
image_wralea.interpolation.interpolation.crop(img, xmin, ymin, xmax, ymax)[source]
-
image_wralea.interpolation.interpolation.resample(img, transformation, order=1, output_shape=None, output_voxels=None, mode='constant', cval=0.0, prefilter=True)[source]
It resamples a 2-D or 3-D image using a 4*4 transformation matrix or a deformation field .
The value of a point in the result image is determined by spline interpolation of the requested order.
- img
- transformation (array) - Matrix 4x4 or deformation field
- order (int) - optional
order corresponds to the degree of a polynomial used to the spline interpolation
By default, order = 1 (linear interpolation)
- output_shape (tuple) - optional
The output shape can optionally be given.
By default, it is equal to the input shape
- output_type (tuple) - optional
The output data type can optionally be given.
By default, it is equal to the input data type
- output_voxels (tuple) - optional
The output voxels size can optionally be given.
By default, it is equal to the input voxels size
Points outside the boundaries of the input are filled
according to the given mode ("constant", "nearest", "reflect" or "wrap")
By default, the given mode is "constant"
- prefilter (boolean) - optional
The parameter prefilter determines if the input is pre-filtered before interpolation
(necessary for spline interpolation of order > 1)
If False it is assumed that the input is already filtered
Returns Type: | image resampled by the transformation |
-
image_wralea.interpolation.interpolation.wra_rotate(img, angle, axes, reshape, output, order, mode, cval, prefilter)[source]
Rotate an array.
The array is rotated in the plane defined by the two axes given by the
axes parameter using spline interpolation of the requested order.
- input : ndarray
- The input array.
- angle : float
- The rotation angle in degrees.
- axes : tuple of 2 ints, optional
- The two axes that define the plane of rotation. Default is the first
two axes.
- reshape : bool, optional
- If reshape is true, the output shape is adapted so that the input
array is contained completely in the output. Default is True.
- output : ndarray or dtype, optional
- The array in which to place the output, or the dtype of the returned
array.
- order : int, optional
- The order of the spline interpolation, default is 3.
The order has to be in the range 0-5.
- mode : str, optional
- Points outside the boundaries of the input are filled according
to the given mode ('constant', 'nearest', 'reflect' or 'wrap').
Default is 'constant'.
- cval : scalar, optional
- Value used for points outside the boundaries of the input if
mode='constant'. Default is 0.0
- prefilter : bool, optional
- The parameter prefilter determines if the input is pre-filtered with
spline_filter before interpolation (necessary for spline
interpolation of order > 1). If False, it is assumed that the input is
already filtered. Default is True.
- rotate : ndarray or None
- The rotated input. If output is given as a parameter, None is
returned.
-
image_wralea.interpolation.interpolation.wra_shift(img, shift, output, order, mode, cval, prefilter)[source]
Shift an array.
The array is shifted using spline interpolation of the requested order.
Points outside the boundaries of the input are filled according to the
given mode.
- input : ndarray
- The input array.
- shift : float or sequence, optional
- The shift along the axes. If a float, shift is the same for each
axis. If a sequence, shift should contain one value for each axis.
- output : ndarray or dtype, optional
- The array in which to place the output, or the dtype of the returned
array.
- order : int, optional
- The order of the spline interpolation, default is 3.
The order has to be in the range 0-5.
- mode : str, optional
- Points outside the boundaries of the input are filled according
to the given mode ('constant', 'nearest', 'reflect' or 'wrap').
Default is 'constant'.
- cval : scalar, optional
- Value used for points outside the boundaries of the input if
mode='constant'. Default is 0.0
- prefilter : bool, optional
- The parameter prefilter determines if the input is pre-filtered with
spline_filter before interpolation (necessary for spline
interpolation of order > 1). If False, it is assumed that the input is
already filtered. Default is True.
- shift : ndarray or None
- The shifted input. If output is given as a parameter, None is
returned.
-
image_wralea.interpolation.interpolation.wra_zoom(img, zoom, output, order, mode, cval, prefilter)[source]
Zoom an array.
The array is zoomed using spline interpolation of the requested order.
- input : ndarray
- The input array.
- zoom : float or sequence, optional
- The zoom factor along the axes. If a float, zoom is the same for each
axis. If a sequence, zoom should contain one value for each axis.
- output : ndarray or dtype, optional
- The array in which to place the output, or the dtype of the returned
array.
- order : int, optional
- The order of the spline interpolation, default is 3.
The order has to be in the range 0-5.
- mode : str, optional
- Points outside the boundaries of the input are filled according
to the given mode ('constant', 'nearest', 'reflect' or 'wrap').
Default is 'constant'.
- cval : scalar, optional
- Value used for points outside the boundaries of the input if
mode='constant'. Default is 0.0
- prefilter : bool, optional
- The parameter prefilter determines if the input is pre-filtered with
spline_filter before interpolation (necessary for spline
interpolation of order > 1). If False, it is assumed that the input is
already filtered. Default is True.
- zoom : ndarray or None
- The zoomed input. If output is given as a parameter, None is
returned.