![]() |
ImFusion SDK 4.3
|
Low-level algorithms for image processing. More...
Low-level algorithms for image processing.
Depending on the kind of processing algorithm, different overload sets are offered:
computeXYZ()
variant, e.g. computeFlipped().createXYZ()
variant will allocate a new image to store the result of the image processing algorithm.computeXYZ()
variant will accept an additional output image that must already be allocated by the caller. This allows to minimize the number of needed allocations when the output image can be reused such as in streaming use cases for instance.Algorithms that create output images of the same type than the input images offer two overloads: A strong TypedImage<T>
overload as well as an overload taking the MemImage
base class.
Enumerations | |
enum class | Axis { X = 0 , Y = 1 , Z = 2 } |
Enumeration of image axes for processing options. More... | |
enum class | ColorWeighting { Average = 0 , LumaBT601 = 1 , LumaBT709 = 2 } |
Enumeration for the methods used for converting color (3 channels) to grayscale image. More... | |
enum class | BayerPattern { BGGR = 0 , GBRG = 1 , GRGB = 2 , RGGB = 3 } |
Enumeration of bayer patterns https://docs.opencv.org/3.4/de/d25/imgproc_color_conversions.html. | |
enum | ThresholdingOptions { AcceptAboveOrEqual = 1 << 0 , AcceptBelow = 1 << 1 , AcceptInside = 1 << 2 , AcceptOutside = 1 << 3 , UseStorageValues = 1 << 4 , UseOriginalValues = 1 << 5 , MergeChannels = 1 << 6 } |
Bitmask of options that can be passed to createThresholded() and computeThresholded(). More... | |
enum class | Normalization { None = 0 , TypeRange = 1 , ValueRange = 2 , ApplyShiftAndScale = 3 } |
List of available normlization options for createFloat(). More... | |
enum class | ValueDomain { StorageValues , OriginalValues } |
Enumeration of available pixel value domains, cf. Pixel Value Domains. More... | |
Functions | |
bool | copyPixelData (const MemImage &src, const vec3i &srcOffset, MemImage &dst, const vec3i &dstOffset, const vec3i &size) |
Perform a copy of continuous raw image data between two images using all channels. | |
bool | copyPixelData (const MemImage &src, const vec3i &srcPixelOffset, int srcChannelOffset, MemImage &dst, const vec3i &dstPixelOffset, int dstChannelOffset, const vec3i &size, int numChannels) |
Perform a copy of continuous raw image data between two images that can have different numbers of channels. | |
std::unique_ptr< TypedImage< unsigned char > > | createRGBFromBayerPattern (MemImage &image, BayerPattern bayerPattern) |
convert Bayer Pattern Image to a color image | |
void | computeFlipped (MemImage &image, Axis flipAxis) |
Flip the given image in-place. | |
void | computeInverted (MemImage &image, bool useImageRange) |
Invert the pixel intensities of the given image in-place. | |
void | computeClamped (MemImage &image, const vec2 &range, ValueDomain valueDomain) |
Clamp the image intensity of all pixels to the given range (in-place). | |
void | swapEndianness (MemImage &image) |
Reverses the order of bytes for all pixels in the image pixel buffer. | |
Rotate images around their main axes | |
template<typename T> | |
std::unique_ptr< TypedImage< T > > | createRotated (const TypedImage< T > &input, Axis rotationAxis, int angle, Axis flipAxis=Axis(-1)) |
Create a rotated version of the input image. | |
std::unique_ptr< MemImage > | createRotated (const MemImage &input, Axis rotationAxis, int angle, Axis flipAxis=Axis(-1)) |
Create a rotated version of the input image. | |
bool | computeRotated (const MemImage &input, MemImage &output, Axis rotationAxis, int angle, Axis flipAxis=Axis(-1)) |
Create a rotated version of the input image. | |
bool | isOrthogonalRotationMatrix (const mat3 &rotationMatrix, double tolerance=0.0) |
Test whether the given matrix forms an orthogonal rotation matrix that can be passed to the corresponding overloads of createRotated() and computeRotated(). | |
template<typename T> | |
std::unique_ptr< TypedImage< T > > | createRotated (const TypedImage< T > &input, const mat3 &rotationMatrix, double tolerance=0.0) |
Create a rotated version of the input image. | |
std::unique_ptr< MemImage > | createRotated (const MemImage &input, const mat3 &rotationMatrix, double tolerance=0.0) |
Create a rotated version of the input image. | |
bool | computeRotated (const MemImage &input, MemImage &output, const mat3 &rotationMatrix, double tolerance=0.0) |
Create a rotated version of the input image. | |
Crop/pad images | |
template<typename T> | |
std::unique_ptr< TypedImage< T > > | createCropped (const TypedImage< T > &input, vec3i newSize, vec3i offset=vec3i(-1, -1, -1)) |
Create a cropped version of the input image. | |
std::unique_ptr< MemImage > | createCropped (const MemImage &input, const vec3i &newSize, const vec3i &offset) |
Create a cropped version of the input image. | |
bool | computeCropped (const MemImage &input, MemImage &output, const vec3i &offset=vec3i(-1, -1, -1)) |
Create a cropped version of the input image. | |
template<typename T> | |
std::unique_ptr< TypedImage< T > > | createPadded (const TypedImage< T > &input, PaddingMode paddingMode, const vec3i &paddingLLF, const vec3i &paddingURB, bool legacyMirrorPadding=true) |
Create a padded version of the input image where the additional border pixels have a specified value. | |
std::unique_ptr< MemImage > | createPadded (const MemImage &input, PaddingMode paddingMode, const vec3i &paddingLLF, const vec3i &paddingURB, bool legacyMirrorPadding=true) |
Create a padded version of the input image where the additional border pixels have a specified value. | |
bool | computePadded (const MemImage &input, MemImage &output, PaddingMode paddingMode, const vec3i &paddingLLF, const vec3i &paddingURB, bool legacyMirrorPadding=true) |
Create a padded version of the input image where the additional border pixels have a specified value. | |
Resample images | |
template<typename T> | |
std::unique_ptr< TypedImage< T > > | createDownsampled (const TypedImage< T > &input, int dx, int dy, int dz=1, bool zeroMask=false, ReductionMode reductionMode=ReductionMode::Average) |
Create a downsampled version of the input image, where the new image size is specified by an integer factor. | |
std::unique_ptr< MemImage > | createDownsampled (const MemImage &input, int dx, int dy, int dz=1, bool zeroMask=false, ReductionMode reductionMode=ReductionMode::Average) |
Create a downsampled version of the input image, where the new image size is specified by an integer factor. | |
bool | computeDownsampled (const MemImage &input, MemImage &output, int dx, int dy, int dz=1, bool zeroMask=false, ReductionMode reductionMode=ReductionMode::Average) |
Create a downsampled version of the input image, where the new image size is specified by an integer factor. | |
template<typename T> | |
std::unique_ptr< TypedImage< T > > | createResampledToSpacing (const TypedImage< T > &input, SpacingMode spacingAdjustment, const vec3 &spacing, bool zeroMask=false, ReductionMode reductionMode=ReductionMode::Average, InterpolationMode interpolationMode=InterpolationMode::Linear, bool allowDimensionChange=false) |
Create a resampled version of the input image with a dedicated target spacing. | |
std::unique_ptr< MemImage > | createResampledToSpacing (const MemImage &input, SpacingMode spacingAdjustment, const vec3 &spacing, bool zeroMask=false, ReductionMode reductionMode=ReductionMode::Average, InterpolationMode interpolationMode=InterpolationMode::Linear, bool allowDimensionChange=false) |
Create a resampled version of the input image with a dedicated target spacing. | |
bool | computeResampledToSpacing (const MemImage &input, MemImage &output, SpacingMode spacingAdjustment, const vec3 &spacing, bool zeroMask=false, ReductionMode reductionMode=ReductionMode::Average, InterpolationMode interpolationMode=InterpolationMode::Linear, bool allowDimensionChange=false) |
Create a resampled version of the input image with a dedicated target spacing. | |
template<typename T> | |
std::unique_ptr< TypedImage< T > > | createResampledToDimensions (const TypedImage< T > &input, const vec3i &dimensions, bool zeroMask=false, ReductionMode reductionMode=ReductionMode::Average, InterpolationMode interpolationMode=InterpolationMode::Linear) |
Create a resampled version of the input image with a dedicated target resolution. | |
std::unique_ptr< MemImage > | createResampledToDimensions (const MemImage &input, const vec3i &dimensions, bool zeroMask=false, ReductionMode reductionMode=ReductionMode::Average, InterpolationMode interpolationMode=InterpolationMode::Linear) |
Create a resampled version of the input image with a dedicated target resolution. | |
bool | computeResampledToDimensions (const MemImage &input, MemImage &output, const vec3i &dimensions, bool zeroMask=false, ReductionMode reductionMode=ReductionMode::Average, InterpolationMode interpolationMode=InterpolationMode::Linear) |
Create a resampled version of the input image with a dedicated target resolution. | |
Binary thresholding based on pixel values | |
std::unique_ptr< TypedImage< unsigned char > > | createThresholded (const MemImage &input, double value, Flags< ThresholdingOptions > options) |
Create a binary mask image based on the input image's pixel values. | |
bool | computeThresholded (const MemImage &input, TypedImage< unsigned char > &output, double value, Flags< ThresholdingOptions > options) |
Create a binary mask image based on the input image's pixel values. | |
std::unique_ptr< TypedImage< unsigned char > > | createThresholded (const MemImage &input, vec2 interval, Flags< ThresholdingOptions > options) |
Create a binary mask image based on the input image's pixel values. | |
bool | computeThresholded (const MemImage &input, TypedImage< unsigned char > &output, vec2 interval, Flags< ThresholdingOptions > options) |
Create a binary mask image based on the input image's pixel values. | |
Change the pixel representation/format | |
template<typename InputT, typename OutputT> | |
std::unique_ptr< TypedImage< OutputT > > | createConverted (const TypedImage< InputT > &input, std::optional< std::pair< InputT, InputT > > inputRange=std::nullopt, std::optional< std::pair< OutputT, OutputT > > outputRange=std::nullopt) |
Performs a type conversion from a TypedImage<InputT> to a newly created TypedImage<OutputT>. | |
template<typename OutputT> | |
std::unique_ptr< TypedImage< OutputT > > | createConverted (const MemImage &input, std::optional< std::pair< double, double > > inputRange=std::nullopt, std::optional< std::pair< OutputT, OutputT > > outputRange=std::nullopt) |
Performs a type conversion from any MemImage to a newly created TypedImage<OutputT>. | |
std::unique_ptr< TypedImage< float > > | createFloat (const MemImage &input, Normalization valueMapping) |
Create a floating point version of the input image. | |
bool | createFloat (const MemImage &input, TypedImage< float > &output, Normalization valueMapping) |
Create a floating point version of the input image. | |
template<typename T> | |
std::unique_ptr< TypedImage< T > > | createGrayscale (const TypedImage< T > &input, int numChannels=-1, ColorWeighting method=ColorWeighting::Average) |
Create a single-channel version of the input image by averaging pixel values over the first N (or all if -1) channels. | |
bool | computeGrayscale (const MemImage &input, MemImage &output, int numChannels=-1, ColorWeighting method=ColorWeighting::Average) |
Create a single-channel version of the input image by averaging pixel values over first N (or all if -1) channels. | |
std::unique_ptr< MemImage > | createGrayscale (const MemImage &input, int numChannels=-1, ColorWeighting method=ColorWeighting::Average) |
Create a single-channel version of the input image by averaging pixel values over first N (or all if -1) channels. | |
Compute gradients | |
template<typename T> | |
void | computeGradientMagnitude (const TypedImage< T > *img, TypedImage< float > *gradient, bool normalizeResult=true, TypedImage< float > *orientation=0) |
Compute normalized gradient magnitude using 3x3 Sobel filter. | |
template<typename T> | |
void | computeGradient (const TypedImage< T > *img, TypedImage< float > *gx, TypedImage< float > *gy, TypedImage< float > *gNorm=0) |
template<typename T> | |
void | computeGradient2D (const TypedImage< T > *img, TypedImage< float > *gx, TypedImage< float > *gy) |
template<typename T> | |
void | computeGradient3D (const TypedImage< T > *img, TypedImage< float > *gx, TypedImage< float > *gy, TypedImage< float > *gz) |
template<typename T> | |
std::unique_ptr< TypedImage< T > > | addOrRemoveAlphaChannel (const TypedImage< T > &img) |
std::unique_ptr< MemImage > | addOrRemoveAlphaChannel (const MemImage &input) |
void | computeSubpixelEdgeLocationAndOrientation2D (const TypedImage< float > *g, const TypedImage< float > *gx, const TypedImage< float > *gy, float threshold, std::vector< std::pair< vec2, vec2 > > &location) |
void | computeSubpixelEdgeLocationAndOrientation3D (const TypedImage< float > *g, const TypedImage< float > *gx, const TypedImage< float > *gy, const TypedImage< float > *gz, float threshold, std::vector< std::pair< vec3, vec3 > > &location) |
|
strong |
|
strong |
Enumeration for the methods used for converting color (3 channels) to grayscale image.
if the number of channels considered during the conversion is different to 3, then the Average is used independent of the user choice
enum ThresholdingOptions |
Bitmask of options that can be passed to createThresholded() and computeThresholded().
|
strong |
List of available normlization options for createFloat().
|
strong |
Enumeration of available pixel value domains, cf. Pixel Value Domains.
Enumerator | |
---|---|
StorageValues | Values as stored in memory. |
OriginalValues | Values as recorded in the original source if available (e.g. Hounsfield Units for CT images) |
bool copyPixelData | ( | const MemImage & | src, |
const vec3i & | srcOffset, | ||
MemImage & | dst, | ||
const vec3i & | dstOffset, | ||
const vec3i & | size ) |
Perform a copy of continuous raw image data between two images using all channels.
The image sizes do not need to match, you can specify any subregion in both the source and destination image. If the specified region exceeds any of the input/output images' dimensions it will be clamped to fit. Both the image type and the number of channels of src and dst must match.
src | Source image to copy data from |
srcOffset | Pixel offset in source subvolume to copy pixel data from |
dst | Destination image to copy data to |
dstOffset | Pixel offset in destination subvolume to copy pixel data to |
size | Size of subvolume to copy |
bool copyPixelData | ( | const MemImage & | src, |
const vec3i & | srcPixelOffset, | ||
int | srcChannelOffset, | ||
MemImage & | dst, | ||
const vec3i & | dstPixelOffset, | ||
int | dstChannelOffset, | ||
const vec3i & | size, | ||
int | numChannels ) |
Perform a copy of continuous raw image data between two images that can have different numbers of channels.
Neither the image sizes nor the number of channels do need to match, you can specify any subregion in both the source and destination image. If the specified regions exceed any of the input/output images' dimensions/number of channels they will be clamped to fit. The image type of src and dst must match.
src | Source image to copy data from |
srcPixelOffset | Pixel offset in source subvolume to copy pixel data from |
srcChannelOffset | First channel in source subvolume to copy channel data from for each pixel, must be >= 0 |
dst | Destination image to copy data to |
dstPixelOffset | Pixel offset in destination subvolume to copy pixel data to |
dstChannelOffset | First channel in destination subvolume to copy channel data to for each pixel, must be >= 0 |
size | Size of subvolume to copy |
numChannels | Number of channels to copy for each pixel |
std::unique_ptr< TypedImage< T > > createRotated | ( | const TypedImage< T > & | input, |
Axis | rotationAxis, | ||
int | angle, | ||
Axis | flipAxis = Axis(-1) ) |
Create a rotated version of the input image.
This function does only support orthogonal rotations.
input | Input image, will not be modified |
rotationAxis | Rotation axis to rotate around |
angle | Rotation angle in degrees, must be a multiple of 90. A positive angle refers to a counter-clockwise rotation around the rotation axis. For more information about the coordinate system conventions see Coordinate Systems. |
flipAxis | Optional axis to perform an additional flip of the pixel data in. |
std::unique_ptr< MemImage > createRotated | ( | const MemImage & | input, |
Axis | rotationAxis, | ||
int | angle, | ||
Axis | flipAxis = Axis(-1) ) |
Create a rotated version of the input image.
This function only supports orthogonal rotations.
input | Input image, will not be modified |
rotationAxis | Rotation axis to rotate around |
angle | Rotation angle in degrees, must be a multiple of 90 within the interval [-270, 270]. A positive angle refers to a counter-clockwise rotation around the rotation axis. For more information about the coordinate system conventions see Coordinate Systems. |
flipAxis | Optional axis to perform an additional flip of the pixel data. |
bool computeRotated | ( | const MemImage & | input, |
MemImage & | output, | ||
Axis | rotationAxis, | ||
int | angle, | ||
Axis | flipAxis = Axis(-1) ) |
Create a rotated version of the input image.
This function only supports orthogonal rotations.
input | Input image, will not be modified |
output | User provided output image, its descriptor must be compatible with the processing applied to the input image. In case it's not the function returns false. |
rotationAxis | Rotation axis to rotate around |
angle | Rotation angle in degrees, must be a multiple of 90 within the interval [-270, 270]. A positive angle refers to a counter-clockwise rotation around the rotation axis. For more information about the coordinate system conventions see Coordinate Systems. |
flipAxis | Optional axis to perform an additional flip of the pixel data. |
bool isOrthogonalRotationMatrix | ( | const mat3 & | rotationMatrix, |
double | tolerance = 0.0 ) |
Test whether the given matrix forms an orthogonal rotation matrix that can be passed to the corresponding overloads of createRotated() and computeRotated().
rotationMatrix | Rotation matrix to decompose, will fail if not orthogonal. |
tolerance | Maximum allowable deviation of the euler angles from an orthogonal configuration in degrees. |
std::unique_ptr< TypedImage< T > > createRotated | ( | const TypedImage< T > & | input, |
const mat3 & | rotationMatrix, | ||
double | tolerance = 0.0 ) |
Create a rotated version of the input image.
This function does only support 3D volumes and orthogonal rotations.
input | Input image, will not be modified |
rotationMatrix | Rotation matrix to apply, must be orthogonal. |
tolerance | Maximum allowable deviation of the euler angles from an orthogonal configuration in degrees. |
std::unique_ptr< MemImage > createRotated | ( | const MemImage & | input, |
const mat3 & | rotationMatrix, | ||
double | tolerance = 0.0 ) |
Create a rotated version of the input image.
This function does only support 3D volumes and orthogonal rotations.
input | Input image, will not be modified |
rotationMatrix | Rotation matrix to apply, must be orthogonal. |
tolerance | Maximum allowable deviation of the euler angles from an orthogonal configuration in degrees. |
bool computeRotated | ( | const MemImage & | input, |
MemImage & | output, | ||
const mat3 & | rotationMatrix, | ||
double | tolerance = 0.0 ) |
Create a rotated version of the input image.
This function does only support 3D volumes and orthogonal rotations.
input | Input image, will not be modified |
output | User provided output image, its descriptor must be compatible with the processing applied to the input image. In case it's not the function returns false. |
rotationMatrix | Rotation matrix to apply, must be orthogonal. |
tolerance | Maximum allowable deviation of the euler angles from an orthogonal configuration in degrees. |
std::unique_ptr< TypedImage< T > > createCropped | ( | const TypedImage< T > & | input, |
vec3i | newSize, | ||
vec3i | offset = vec3i(-1, -1, -1) ) |
Create a cropped version of the input image.
input | Input image, will not be modified |
newSize | Size of the cropped image |
offset | Pixel offset of cropping region in input image. An offset of -1 will keep put the cropping region in the center of the corresponding axis. |
std::unique_ptr< MemImage > createCropped | ( | const MemImage & | input, |
const vec3i & | newSize, | ||
const vec3i & | offset ) |
Create a cropped version of the input image.
input | Input image, will not be modified |
newSize | Size of the cropped image |
offset | Pixel offset of cropping region in input image. An offset of -1 will keep put the cropping region in the center of the corresponding axis. |
bool computeCropped | ( | const MemImage & | input, |
MemImage & | output, | ||
const vec3i & | offset = vec3i(-1, -1, -1) ) |
Create a cropped version of the input image.
input | Input image, will not be modified |
output | User provided output image, its descriptor is used for the cropping dimensions. |
offset | Pixel offset of cropping region in input image. An offset of -1 will keep put the cropping region in the center of the corresponding axis. |
std::unique_ptr< TypedImage< T > > createPadded | ( | const TypedImage< T > & | input, |
PaddingMode | paddingMode, | ||
const vec3i & | paddingLLF, | ||
const vec3i & | paddingURB, | ||
bool | legacyMirrorPadding = true ) |
Create a padded version of the input image where the additional border pixels have a specified value.
input | Input image, will not be modified |
paddingMode | Padding mode specifying what pixel values to assign to the additional border pixels |
paddingLLF | Number of padding pixels in X, Y, and Z direction at the lower left front corner. |
paddingURB | Number of padding pixels in X, Y, and Z direction at the upper right back corner. |
legacyMirrorPadding | Before SUITE-3748, mirror padding was not computed correctly on URB side. This flag allows to continue use the wrong definition of mirror padding to avoid regressions. Note: this is a temporary parameter and will be deprecated/removed soon. |
std::unique_ptr< MemImage > createPadded | ( | const MemImage & | input, |
PaddingMode | paddingMode, | ||
const vec3i & | paddingLLF, | ||
const vec3i & | paddingURB, | ||
bool | legacyMirrorPadding = true ) |
Create a padded version of the input image where the additional border pixels have a specified value.
input | Input image, will not be modified |
paddingMode | Padding mode specifying what pixel values to assign to the additional border pixels |
paddingLLF | Number of padding pixels in X, Y, and Z direction at the lower left front corner. |
paddingURB | Number of padding pixels in X, Y, and Z direction at the upper right back corner. |
legacyMirrorPadding | Before SUITE-3748, mirror padding was not computed correctly on URB side. This flag allows to continue use the wrong definition of mirror padding to avoid regressions. Note: this is a temporary parameter and will be deprecated/removed soon. |
bool computePadded | ( | const MemImage & | input, |
MemImage & | output, | ||
PaddingMode | paddingMode, | ||
const vec3i & | paddingLLF, | ||
const vec3i & | paddingURB, | ||
bool | legacyMirrorPadding = true ) |
Create a padded version of the input image where the additional border pixels have a specified value.
input | Input image, will not be modified |
output | User provided output image, its descriptor must be compatible with the processing applied to the input image. In case it's not the function returns false. |
paddingMode | Padding mode specifying what pixel values to assign to the additional border pixels |
paddingLLF | Number of padding pixels in X, Y, and Z direction at the lower left front corner. |
paddingURB | Number of padding pixels in X, Y, and Z direction at the upper right back corner. |
legacyMirrorPadding | Before SUITE-3748, mirror padding was not computed correctly on URB side. This flag allows to continue use the wrong definition of mirror padding to avoid regressions. Note: this is a temporary parameter and will be deprecated/removed soon. |
std::unique_ptr< TypedImage< T > > createDownsampled | ( | const TypedImage< T > & | input, |
int | dx, | ||
int | dy, | ||
int | dz = 1, | ||
bool | zeroMask = false, | ||
ReductionMode | reductionMode = ReductionMode::Average ) |
Create a downsampled version of the input image, where the new image size is specified by an integer factor.
input | Input image, will not be modified |
dx | Downsampling factor in X direction |
dy | Downsampling factor in Y direction |
dz | Downsampling factor in Z direction |
zeroMask | If enabled zeros are propagated to avoid masking artifacts |
reductionMode | Filter mode defining how contributing input pixels are combined into the downsampled pixel value |
std::unique_ptr< MemImage > createDownsampled | ( | const MemImage & | input, |
int | dx, | ||
int | dy, | ||
int | dz = 1, | ||
bool | zeroMask = false, | ||
ReductionMode | reductionMode = ReductionMode::Average ) |
Create a downsampled version of the input image, where the new image size is specified by an integer factor.
input | Input image, will not be modified |
dx | Downsampling factor in X direction |
dy | Downsampling factor in Y direction |
dz | Downsampling factor in Z direction |
zeroMask | If enabled, zeros are always propagated (independent of reduction mode) to avoid masking artifacts |
reductionMode | Filter mode defining how contributing input pixels are combined into the downsampled pixel value |
bool computeDownsampled | ( | const MemImage & | input, |
MemImage & | output, | ||
int | dx, | ||
int | dy, | ||
int | dz = 1, | ||
bool | zeroMask = false, | ||
ReductionMode | reductionMode = ReductionMode::Average ) |
Create a downsampled version of the input image, where the new image size is specified by an integer factor.
input | Input image, will not be modified |
output | User provided output image, its descriptor must be compatible with the processing applied to the input image. In case it's not the function returns false. |
dx | Downsampling factor in X direction |
dy | Downsampling factor in Y direction |
dz | Downsampling factor in Z direction |
zeroMask | If enabled, zeros are always propagated (independent of reduction mode) to avoid masking artifacts |
reductionMode | Filter mode defining how contributing input pixels are combined into the downsampled pixel value |
std::unique_ptr< TypedImage< T > > createResampledToSpacing | ( | const TypedImage< T > & | input, |
SpacingMode | spacingAdjustment, | ||
const vec3 & | spacing, | ||
bool | zeroMask = false, | ||
ReductionMode | reductionMode = ReductionMode::Average, | ||
InterpolationMode | interpolationMode = InterpolationMode::Linear, | ||
bool | allowDimensionChange = false ) |
Create a resampled version of the input image with a dedicated target spacing.
input | Input image, will not be modified |
spacingAdjustment | If set to ADJUST, resampling is performed to roughly the desired spacing so that the image extent is kept constant. Otherwise, the exact spacing defined will be used, leading to a potentially different extent. |
spacing | Target spacing of the resampled image |
zeroMask | If enabled, zeros are always propagated (independent of reduction mode) to avoid masking artifacts |
reductionMode | Filter mode defining how contributing input pixels are combined into the downsampled pixel value |
interpolationMode | Interpolation mode for pixel lookup in input image |
allowDimensionChange | If true, 3D images may become 2D images, etc. |
std::unique_ptr< MemImage > createResampledToSpacing | ( | const MemImage & | input, |
SpacingMode | spacingAdjustment, | ||
const vec3 & | spacing, | ||
bool | zeroMask = false, | ||
ReductionMode | reductionMode = ReductionMode::Average, | ||
InterpolationMode | interpolationMode = InterpolationMode::Linear, | ||
bool | allowDimensionChange = false ) |
Create a resampled version of the input image with a dedicated target spacing.
input | Input image, will not be modified |
spacingAdjustment | If set to ADJUST, resampling is performed to roughly the desired spacing so that the image extent is kept constant. Otherwise, the exact spacing defined will be used, leading to a potentially different extent. |
spacing | Target spacing of the resampled image |
zeroMask | If enabled, zeros are always propagated (independent of reduction mode) to avoid masking artifacts |
reductionMode | Filter mode defining how contributing input pixels are combined into the downsampled pixel value |
interpolationMode | Interpolation mode for pixel lookup in input image |
allowDimensionChange | If true, 3D images may become 2D images, etc. |
bool computeResampledToSpacing | ( | const MemImage & | input, |
MemImage & | output, | ||
SpacingMode | spacingAdjustment, | ||
const vec3 & | spacing, | ||
bool | zeroMask = false, | ||
ReductionMode | reductionMode = ReductionMode::Average, | ||
InterpolationMode | interpolationMode = InterpolationMode::Linear, | ||
bool | allowDimensionChange = false ) |
Create a resampled version of the input image with a dedicated target spacing.
input | Input image, will not be modified |
output | User provided output image, its descriptor must be compatible with the processing applied to the input image. In case it's not the function returns false. |
spacingAdjustment | If set to ADJUST, resampling is performed to roughly the desired spacing so that the image extent is kept constant. Otherwise, the exact spacing defined will be used, leading to a potentially different extent. |
spacing | Target spacing of the resampled image |
zeroMask | If enabled, zeros are always propagated (independent of reduction mode) to avoid masking artifacts |
reductionMode | Filter mode defining how contributing input pixels are combined into the downsampled pixel value |
interpolationMode | Interpolation mode for pixel lookup in input image |
allowDimensionChange | If true, 3D images may become 2D images, etc. |
std::unique_ptr< TypedImage< T > > createResampledToDimensions | ( | const TypedImage< T > & | input, |
const vec3i & | dimensions, | ||
bool | zeroMask = false, | ||
ReductionMode | reductionMode = ReductionMode::Average, | ||
InterpolationMode | interpolationMode = InterpolationMode::Linear ) |
Create a resampled version of the input image with a dedicated target resolution.
input | Input image, will not be modified |
dimensions | Target pixel dimensions of resampled image |
zeroMask | If enabled, zeros are always propagated (independent of reduction mode) to avoid masking artifacts |
reductionMode | Filter mode defining how contributing input pixels are combined into the downsampled pixel value |
interpolationMode | Interpolation mode for pixel lookup in input image |
std::unique_ptr< MemImage > createResampledToDimensions | ( | const MemImage & | input, |
const vec3i & | dimensions, | ||
bool | zeroMask = false, | ||
ReductionMode | reductionMode = ReductionMode::Average, | ||
InterpolationMode | interpolationMode = InterpolationMode::Linear ) |
Create a resampled version of the input image with a dedicated target resolution.
input | Input image, will not be modified |
dimensions | Target pixel dimensions of resampled image |
zeroMask | If enabled, zeros are always propagated (independent of reduction mode) to avoid masking artifacts |
reductionMode | Filter mode defining how contributing input pixels are combined into the downsampled pixel value |
interpolationMode | Interpolation mode for pixel lookup in input image |
bool computeResampledToDimensions | ( | const MemImage & | input, |
MemImage & | output, | ||
const vec3i & | dimensions, | ||
bool | zeroMask = false, | ||
ReductionMode | reductionMode = ReductionMode::Average, | ||
InterpolationMode | interpolationMode = InterpolationMode::Linear ) |
Create a resampled version of the input image with a dedicated target resolution.
input | Input image, will not be modified |
output | User provided output image, its descriptor must be compatible with the processing applied to the input image. In case it's not the function returns false. |
dimensions | Target pixel dimensions of resampled image |
zeroMask | If enabled, zeros are always propagated (independent of reduction mode) to avoid masking artifacts |
reductionMode | Filter mode defining how contributing input pixels are combined into the downsampled pixel value |
interpolationMode | Interpolation mode for pixel lookup in input image |
std::unique_ptr< TypedImage< unsigned char > > createThresholded | ( | const MemImage & | input, |
double | value, | ||
Flags< ThresholdingOptions > | options ) |
Create a binary mask image based on the input image's pixel values.
input | Input image, will not be modified |
value | Cutoff value for thresholding, either in storage or in original value domain depending on options. |
options | Set of thresholding options, must meet the following conditions
|
bool computeThresholded | ( | const MemImage & | input, |
TypedImage< unsigned char > & | output, | ||
double | value, | ||
Flags< ThresholdingOptions > | options ) |
Create a binary mask image based on the input image's pixel values.
input | Input image, will not be modified |
output | User provided output image, its descriptor must be compatible with that of the input image. In case it's not the function returns false. |
value | Cutoff value for thresholding, either in storage or in original value domain depending on options. |
options | Set of thresholding options, must meet the following conditions
|
std::unique_ptr< TypedImage< unsigned char > > createThresholded | ( | const MemImage & | input, |
vec2 | interval, | ||
Flags< ThresholdingOptions > | options ) |
Create a binary mask image based on the input image's pixel values.
input | Input image, will not be modified |
interval | Closed interval describing the value range for thresholding, either in storage or in original value domain depending on options. |
options | Set of thresholding options, must meet the following conditions
|
bool computeThresholded | ( | const MemImage & | input, |
TypedImage< unsigned char > & | output, | ||
vec2 | interval, | ||
Flags< ThresholdingOptions > | options ) |
Create a binary mask image based on the input image's pixel values.
input | Input image, will not be modified |
output | User provided output image, its descriptor must be compatible with that of the input image. In case it's not the function returns false. |
interval | Closed interval describing the value range for thresholding, either in storage or in original value domain depending on options. |
options | Set of thresholding options, must meet the following conditions
|
std::unique_ptr< TypedImage< unsigned char > > createRGBFromBayerPattern | ( | MemImage & | image, |
BayerPattern | bayerPattern ) |
convert Bayer Pattern Image to a color image
image | Bayer pattern Image to be converted to RGB, should be a grayscale unsigned 8 bit image |
BayerPattern | the Bayer pattern of the input image |
Flip the given image in-place.
image | Image to flip |
flipAxis | Flip axis |
void computeInverted | ( | MemImage & | image, |
bool | useImageRange ) |
Invert the pixel intensities of the given image in-place.
image | Image to invert |
useImageRange | If true, the output values will be such that the new image minimum will be equal to the old image maximum (and vice versa). Otherwise the full range of the image type will be used to invert the values. |
void computeClamped | ( | MemImage & | image, |
const vec2 & | range, | ||
ValueDomain | valueDomain ) |
Clamp the image intensity of all pixels to the given range (in-place).
image | Input image, will be changed |
range | Value range to which to clamp the image pixels. |
valueDomain | Pixel value domain in which range is specified, cf. Pixel Value Domains. |
std::unique_ptr< TypedImage< OutputT > > createConverted | ( | const TypedImage< InputT > & | input, |
std::optional< std::pair< InputT, InputT > > | inputRange = std::nullopt, | ||
std::optional< std::pair< OutputT, OutputT > > | outputRange = std::nullopt ) |
Performs a type conversion from a TypedImage<InputT> to a newly created TypedImage<OutputT>.
The pixel values are adjusted linearly so that inputRange.first
is mapped to outputRange.first
and inputRange.second
is mapped to outputRange.second
. Shift and scale of the resulting ImageDescriptor are adjusted accordingly so that the original/real-world values remain the same.
InputT
and OutputT
are integral types and the outputRange is larger than the inputRange this function will truncate any floating-point scaling factor between the two to an integer one in order to avoid a re-quantization of the input values. In this case inputRange.second
is mapped to the largest value less or equal than outputRange.second
so that outputRange/inputRange
is an integer division.input | Input image to convert to a different type. |
inputRange | Storage pixel value range of input that should be mapped to outputRange If unset, will use {MIN_T, MAX_T} for integral types and {0.0, 1.0} for floating point types. |
outputRange | Storage pixel value range of the return value to which pixels from inputRange are mapped to. If unset, will use {MIN_T, MAX_T} for integral types and {0.0, 1.0} for floating point types. |
std::unique_ptr< TypedImage< OutputT > > createConverted | ( | const MemImage & | input, |
std::optional< std::pair< double, double > > | inputRange = std::nullopt, | ||
std::optional< std::pair< OutputT, OutputT > > | outputRange = std::nullopt ) |
Performs a type conversion from any MemImage to a newly created TypedImage<OutputT>.
The pixel values are adjusted linearly so that inputRange.first
is mapped to outputRange.first
and inputRange.second
is mapped to outputRange.second
. Shift and scale of the resulting ImageDescriptor are adjusted accordingly so that the original/real-world values remain the same.
InputT
and OutputT
are integral types and the outputRange is larger than the inputRange this function will truncate any floating-point scaling factor between the two to an integer one in order to avoid a re-quantization of the input values. In this case inputRange.second
is mapped to the largest value less or equal than outputRange.second
so that outputRange/inputRange
it is an integer division.input | Input image to convert to a different type. |
inputRange | Storage pixel value range of input that should be mapped to outputRange If unset, will use {MIN_T, MAX_T} for integral types and {0.0, 1.0} for floating point types. |
outputRange | Storage pixel value range of the return value to which pixels from inputRange are mapped to. If unset, will use {MIN_T, MAX_T} for integral types and {0.0, 1.0} for floating point types. |
std::unique_ptr< TypedImage< float > > createFloat | ( | const MemImage & | input, |
Normalization | valueMapping ) |
Create a floating point version of the input image.
input | Input image, will not be modified |
valueMapping | Defines how input pixel intensities are mapped to float |
bool createFloat | ( | const MemImage & | input, |
TypedImage< float > & | output, | ||
Normalization | valueMapping ) |
Create a floating point version of the input image.
input | Input image, will not be modified |
output | User provided output image, its descriptor must be compatible with that of the input image. In case it's not the function returns false. |
valueMapping | Defines how input pixel intensities are mapped to float |
std::unique_ptr< TypedImage< T > > createGrayscale | ( | const TypedImage< T > & | input, |
int | numChannels = -1, | ||
ColorWeighting | method = ColorWeighting::Average ) |
Create a single-channel version of the input image by averaging pixel values over the first N (or all if -1) channels.
input | Input image, will not be modified |
numChannels | Number of channels to be considered |
method | The method used for computing the grayscale values, fall back to Averaging if the number of channels is != 3 |
bool computeGrayscale | ( | const MemImage & | input, |
MemImage & | output, | ||
int | numChannels = -1, | ||
ColorWeighting | method = ColorWeighting::Average ) |
Create a single-channel version of the input image by averaging pixel values over first N (or all if -1) channels.
input | Input image, will not be modified |
output | User provided output image, its descriptor must be compatible with the processing applied to the input image. In case it's not the function returns false. |
numChannels | Number of channels to be considered |
method | The method used for computing the grayscale values, fall back to Averaging if the number of channels is != 3 |
std::unique_ptr< MemImage > createGrayscale | ( | const MemImage & | input, |
int | numChannels = -1, | ||
ColorWeighting | method = ColorWeighting::Average ) |
Create a single-channel version of the input image by averaging pixel values over first N (or all if -1) channels.
input | Input image, will not be modified |
numChannels | Number of channels to be considered |
method | The method used for computing the grayscale values, fall back to Averaging if the number of channels is != 3 |
void computeGradientMagnitude | ( | const TypedImage< T > * | img, |
TypedImage< float > * | gradient, | ||
bool | normalizeResult = true, | ||
TypedImage< float > * | orientation = 0 ) |
Compute normalized gradient magnitude using 3x3 Sobel filter.
The border of the image is set to zero.
img | Input image | |
[out] | gradient | Gradient image. Has to be float type. |
normalizeResult | Normalize result to range [0;1] | |
[out] | orientation | Optional pointer to orientation image receiving gradient orientation |