![]() |
ImFusion SDK 4.3
|
Helper functions for N-linear interpolation of N-cells(pixel, voxel, etc. ) More...
Helper functions for N-linear interpolation of N-cells(pixel, voxel, etc. )
Typedefs | |
| template<int N> | |
| using | vecNd = Eigen::Matrix<double, N, 1> |
| template<int N> | |
| using | vecNi = Eigen::Matrix<int, N, 1> |
Functions | |
| template<typename T, int N> | |
| void | linear (const T *nCellData, const vecNi< N > &dimensions, int nChannels, const vecNd< N > &position, double *output) |
| N-linear interpolation. | |
| template<typename T> | |
| void | linear (const T *nCellData, int dimensions, int nChannels, double position, double *output) |
| Convenience overload for 1D linear interpolation. | |
| template<typename T, int N> | |
| void | linear (const TypedImage< T > &img, const vecNd< N > &position, double *output) |
| Convenience overload for N-dimensional linear interpolation of a TypedImage. | |
| template<typename T, int N> | |
| void | linearClampToBorder (const T *nCellData, const vecNi< N > &dim, int nChannels, const vecNd< N > &position, double *output, const double *borderVal, bool interpolateBorder, bool *wasInside=nullptr) |
| N-dimensional linear interpolation with border value. | |
| template<typename T> | |
| void | linearClampToBorder (const T *nCellData, int dim, int nChannels, double position, double *output, const double *borderVal, bool interpolateBorder, bool *wasInside=nullptr) |
| Convenience overload for 1D linear interpolation with border value. | |
| template<typename T, int N> | |
| void | linearClampToBorder (const TypedImage< T > &img, const vecNd< N > &position, double *output, const double *borderVal, bool interpolateBorder, bool *wasInside=nullptr) |
| Convenience overload for N-dimensional linear interpolation with border value of a TypedImage. | |
| template<typename T, int N> | |
| void | linearClampToEdge (const T *nCellData, const vecNi< N > &dim, int nChannels, vecNd< N > position, double *output) |
| N-dimensional linear interpolation with clamping. | |
| template<typename T> | |
| void | linearClampToEdge (const T *nCellData, int dim, int nChannels, double position, double *output) |
| Convenience overload for 1D linear interpolation with clamping. | |
| template<typename T, int N> | |
| void | linearClampToEdge (const TypedImage< T > &img, const vecNd< N > &position, double *output) |
| Convenience overload for N-dimensional linear interpolation with clamping of a TypedImage. | |
| template<typename T, int N> | |
| void | linearClampToEdge (const T *nCellData, const vecNi< N > &dim, int nChannels, const vecNd< N > &position, double *output, bool &wasInside) |
| N-dimensional linear interpolation with clamping. | |
| template<typename T> | |
| void | linearClampToEdge (const T *nCellData, int dim, int nChannels, double position, double *output, bool &wasInside) |
| Convenience overload for 1D linear interpolation with clamping. | |
| template<typename T, int N> | |
| void | linearClampToEdge (const TypedImage< T > &img, const vecNd< N > &position, double *output, bool &insideVolume) |
| Convenience overload for N-dimensional linear interpolation with clamping of a TypedImage. | |
| template<typename T, int N> | |
| bool | linearLegacy (const T *nCellData, const vecNi< N > &dim, int nChannels, const vecNd< N > &position, double *output, const double *borderVal, bool clamp) |
| N-dimensional linear interpolation with same clamping behavior as the deprecated Math::interp functions. | |
| void linear | ( | const T * | nCellData, |
| const vecNi< N > & | dimensions, | ||
| int | nChannels, | ||
| const vecNd< N > & | position, | ||
| double * | output ) |
N-linear interpolation.
The N-cells are assumed to be centered on integer coordinates and have a diameter of 1. Note that this fast version does not do any validity checks on the lookup position and may crash if out of bounds.
| nCellData | Raw N-cell data in the shape of dimensions and nChannels |
| dimensions | Number of N-cells in each dimension in input data |
| nChannels | Number of color channels in input data |
| position | Lookup coordinate in N-cell space |
| output | Output buffer for interpolated value, buffer needs to be able to hold nChannels values |
| T | Type of the N-cell data to interpolate |
| N | Dimensionality of the image to interpolate |
| void linear | ( | const T * | nCellData, |
| int | dimensions, | ||
| int | nChannels, | ||
| double | position, | ||
| double * | output ) |
Convenience overload for 1D linear interpolation.
N-linear interpolation.
The N-cells are assumed to be centered on integer coordinates and have a diameter of 1. Note that this fast version does not do any validity checks on the lookup position and may crash if out of bounds.
| nCellData | Raw N-cell data in the shape of dimensions and nChannels |
| dimensions | Number of N-cells in each dimension in input data |
| nChannels | Number of color channels in input data |
| position | Lookup coordinate in N-cell space |
| output | Output buffer for interpolated value, buffer needs to be able to hold nChannels values |
| T | Type of the N-cell data to interpolate |
| N | Dimensionality of the image to interpolate |
| void linear | ( | const TypedImage< T > & | img, |
| const vecNd< N > & | position, | ||
| double * | output ) |
Convenience overload for N-dimensional linear interpolation of a TypedImage.
The N-cells are assumed to be centered on integer coordinates and have a diameter of 1. Note that this fast version does not do any validity checks on the lookup position and may crash if out of bounds.
| img | Input image to perform the interpolation on |
| position | Lookup coordinate in N-cell space |
| output | Output buffer for interpolated value, buffer needs to be able to hold nChannels values |
| T | Type of the N-cell data to interpolate |
| N | Dimensionality of the image to interpolate |
| void linearClampToBorder | ( | const T * | nCellData, |
| const vecNi< N > & | dim, | ||
| int | nChannels, | ||
| const vecNd< N > & | position, | ||
| double * | output, | ||
| const double * | borderVal, | ||
| bool | interpolateBorder, | ||
| bool * | wasInside = nullptr ) |
N-dimensional linear interpolation with border value.
The N-cells are assumed to be centered on integer coordinates and have a diameter of 1. This version treats all N-cells outside of the given volume as having the value borderVal.
| nCellData | Raw N-cell data in the shape of dimensions and nChannels |
| dimensions | Number of N-cells in each dimension in input data |
| nChannels | Number of color channels in input data |
| position | Lookup coordinate in N-cell space |
| output | Output buffer for interpolated value, buffer needs to be able to hold nChannels values |
| borderVal | Intensity value outside the volume, buffer needs to hold nChannels values |
| interpolateBorder | Whether borderVal may be interpolated with the volume content when slightly out of bounds (OpenGL behavior) |
| wasInside | Optional output variable indicating whether position was inside the volume |
| T | Type of the N-cell data to interpolate |
| N | Dimensionality of the image to interpolate |
| void linearClampToBorder | ( | const T * | nCellData, |
| int | dim, | ||
| int | nChannels, | ||
| double | position, | ||
| double * | output, | ||
| const double * | borderVal, | ||
| bool | interpolateBorder, | ||
| bool * | wasInside = nullptr ) |
Convenience overload for 1D linear interpolation with border value.
N-dimensional linear interpolation with border value.
The N-cells are assumed to be centered on integer coordinates and have a diameter of 1. This version treats all N-cells outside of the given volume as having the value borderVal.
| nCellData | Raw N-cell data in the shape of dimensions and nChannels |
| dimensions | Number of N-cells in each dimension in input data |
| nChannels | Number of color channels in input data |
| position | Lookup coordinate in N-cell space |
| output | Output buffer for interpolated value, buffer needs to be able to hold nChannels values |
| borderVal | Intensity value outside the volume, buffer needs to hold nChannels values |
| interpolateBorder | Whether borderVal may be interpolated with the volume content when slightly out of bounds (OpenGL behavior) |
| wasInside | Optional output variable indicating whether position was inside the volume |
| T | Type of the N-cell data to interpolate |
| N | Dimensionality of the image to interpolate |
| void linearClampToBorder | ( | const TypedImage< T > & | img, |
| const vecNd< N > & | position, | ||
| double * | output, | ||
| const double * | borderVal, | ||
| bool | interpolateBorder, | ||
| bool * | wasInside = nullptr ) |
Convenience overload for N-dimensional linear interpolation with border value of a TypedImage.
The N-cells are assumed to be centered on integer coordinates and have a diameter of 1. This version treats all N-cells outside of the given volume as having the value borderVal.
| nCellData | Raw N-cell data in the shape of dimensions and nChannels |
| position | Lookup coordinate in N-cell space |
| output | Output buffer for interpolated value, buffer needs to be able to hold nChannels values |
| borderVal | Intensity value outside the volume, buffer needs to hold nChannels values |
| interpolateBorder | Whether borderVal may be interpolated with the volume content when slightly out of bounds (OpenGL behavior) |
| wasInside | Optional output variable indicating whether position was inside the volume |
| T | Type of the N-cell data to interpolate |
| N | Dimensionality of the image to interpolate |
| void linearClampToEdge | ( | const T * | nCellData, |
| const vecNi< N > & | dim, | ||
| int | nChannels, | ||
| vecNd< N > | position, | ||
| double * | output ) |
N-dimensional linear interpolation with clamping.
The N-cells are assumed to be centered on integer coordinates and have a diameter of 1. This version clamps the lookup position to end up inside the volume.
| N-cellData | Raw N-cell data in the shape of dimensions and nChannels |
| dimensions | Number of N-cells in each dimension in input data |
| nChannels | Number of color channels in input data |
| position | Lookup coordinate in N-cell space |
| output | Output buffer for interpolated value, buffer needs to be able to hold nChannels values |
| T | Type of the N-cell data to interpolate |
| N | Dimensionality of the image to interpolate |
| void linearClampToEdge | ( | const T * | nCellData, |
| int | dim, | ||
| int | nChannels, | ||
| double | position, | ||
| double * | output ) |
Convenience overload for 1D linear interpolation with clamping.
N-dimensional linear interpolation with clamping.
The N-cells are assumed to be centered on integer coordinates and have a diameter of 1. This version clamps the lookup position to end up inside the volume.
| N-cellData | Raw N-cell data in the shape of dimensions and nChannels |
| dimensions | Number of N-cells in each dimension in input data |
| nChannels | Number of color channels in input data |
| position | Lookup coordinate in N-cell space |
| output | Output buffer for interpolated value, buffer needs to be able to hold nChannels values |
| T | Type of the N-cell data to interpolate |
| N | Dimensionality of the image to interpolate |
| void linearClampToEdge | ( | const TypedImage< T > & | img, |
| const vecNd< N > & | position, | ||
| double * | output ) |
Convenience overload for N-dimensional linear interpolation with clamping of a TypedImage.
The N-cells are assumed to be centered on integer coordinates and have a diameter of 1. This version clamps the lookup position to end up inside the volume.
| nCellData | Raw N-cell data in the shape of dimensions and nChannels |
| position | Lookup coordinate in N-cell space |
| output | Output buffer for interpolated value, buffer needs to be able to hold nChannels values |
| T | Type of the N-cell data to interpolate |
| N | Dimensionality of the image to interpolate |
| void linearClampToEdge | ( | const T * | nCellData, |
| const vecNi< N > & | dim, | ||
| int | nChannels, | ||
| const vecNd< N > & | position, | ||
| double * | output, | ||
| bool & | wasInside ) |
N-dimensional linear interpolation with clamping.
The N-cells are assumed to be centered on integer coordinates and have a diameter of 1. This version clamps the lookup position to end up inside the volume and additionally outputs whether the original position was valid. Note that there is computational overhead for this additional output and that a version without it is available as well.
| nCellData | Raw N-cell data in the shape of dimensions and nChannels |
| dimensions | Number of N-cells in each dimension in input data |
| nChannels | Number of color channels in input data |
| position | Lookup coordinate in N-cell space |
| output | Output buffer for interpolated value, buffer needs to be able to hold nChannels values |
| wasInside | Output variable whether the coordinate in position was inside the volume and did not have to be clamped |
| T | Type of the N-cell data to interpolate |
| N | Dimensionality of the image to interpolate |
| void linearClampToEdge | ( | const T * | nCellData, |
| int | dim, | ||
| int | nChannels, | ||
| double | position, | ||
| double * | output, | ||
| bool & | wasInside ) |
Convenience overload for 1D linear interpolation with clamping.
N-dimensional linear interpolation with clamping.
The N-cells are assumed to be centered on integer coordinates and have a diameter of 1. This version clamps the lookup position to end up inside the volume and additionally outputs whether the original position was valid. Note that there is computational overhead for this additional output and that a version without it is available as well.
| nCellData | Raw N-cell data in the shape of dimensions and nChannels |
| dimensions | Number of N-cells in each dimension in input data |
| nChannels | Number of color channels in input data |
| position | Lookup coordinate in N-cell space |
| output | Output buffer for interpolated value, buffer needs to be able to hold nChannels values |
| wasInside | Output variable whether the coordinate in position was inside the volume and did not have to be clamped |
| T | Type of the N-cell data to interpolate |
| N | Dimensionality of the image to interpolate |
| void linearClampToEdge | ( | const TypedImage< T > & | img, |
| const vecNd< N > & | position, | ||
| double * | output, | ||
| bool & | insideVolume ) |
Convenience overload for N-dimensional linear interpolation with clamping of a TypedImage.
The N-cells are assumed to be centered on integer coordinates and have a diameter of 1. This version clamps the lookup position to end up inside the volume and additionally outputs whether the original position was valid. Note that there is computational overhead for this additional output and that a version without it is available as well.
| nCellData | Raw N-cell data in the shape of dimensions and nChannels |
| position | Lookup coordinate in N-cell space |
| output | Output buffer for interpolated value, buffer needs to be able to hold nChannels values |
| wasInside | Output variable whether the coordinate in position was inside the volume and did not have to be clamped |
| T | Type of the N-cell data to interpolate |
| N | Dimensionality of the image to interpolate |
| bool linearLegacy | ( | const T * | nCellData, |
| const vecNi< N > & | dim, | ||
| int | nChannels, | ||
| const vecNd< N > & | position, | ||
| double * | output, | ||
| const double * | borderVal, | ||
| bool | clamp ) |
N-dimensional linear interpolation with same clamping behavior as the deprecated Math::interp functions.
Interpolates using N-cell coordinates.
The N-cells are assumed to be centered on integer coordinates and have a diameter of 1. The boundary behavior is as follows:
| v | N-cell data |
| dim | Data size in N-cells |
| nChannels | Number of color channels in input data |
| x | Lookup coordinate in N-cells |
| output | Interpolated value, buffer needs to be able to hold nChannels values |
| borderVal | Intensity value outside the volume, buffer needs to hold nChannels values |
| clamp | Controls out of bounds clamping behavior, see above |