IDS peak ICV v1.5.0
Loading...
Searching...
No Matches
DownsamplingModule Class Reference
Inheritance diagram for DownsamplingModule:

Data Structures

class  Handle
 

Public Member Functions

 DownsamplingModule ()
 Creates an instance of class DownsamplingModule with factors X = 1, Y = 1 and DownsamplingMode = DownsamplingMode.BinningAverage.
 
 DownsamplingModule (DownsamplingMode defaultMode, string customName)
 Creates an instance of class DownsamplingModule with factors X = 1, Y = 1 and the given T:DownsamplingMode and name.
 
void Dispose ()
 Releases all resources used by this class.
 
override Image Process (Image inputImage)
 Applies the downsampling factors and mode to the input image and returns a downsampled copy based on current settings.
 
override object Process (object input)
 Applies the downsampling factors and mode to the input image and returns a downsampled copy based on current settings.
 
override void Serialize (IArchive archive)
 Serializes the object's internal state into the provided archive.
 
override void Deserialize (IArchive archive)
 Restores the object's state from the provided archive.
 
override void ResetToDefault ()
 Resets all parameters to their default values.
 

Properties

string? CustomId [get, set]
 The custom TypeId of the module for serialization purposes.
 
override string TypeId [get]
 The unique type identifier for this module implementation.This should be a unique string identifying the specific implementation of the module.
 
uint X [get, set]
 The current number of columns used for downsampling.
 
uint Y [get, set]
 The current number of rows used for downsampling.
 
IntervalU Range [get]
 Gets the valid range for downsampling factors x and y.
 
DownsamplingMode Mode [get, set]
 The current T:DownsamplingMode.
 
int Version = 1 [get]
 The module version.
 
virtual bool IsEnabled = true [get, set]
 Get whether this module is enabled.
 

Detailed Description

Downsampling is used to decrease the image size.

This module provides comprehensive functionality for image downsampling, which is the process of reducing image resolution and dimensions. It supports multiple algorithms optimized for various use cases.

There are two basic techniques for downsampling:

  • Binning This method reduces resolution by summarizing or averaging groups of pixels in the horizontal (x) and/or vertical (y) directions. It helps preserve image quality by minimizing aliasing artifacts.
  • Decimation This method reduces resolution by selecting (i.e., skipping) pixels at regular intervals along columns (x), rows (y) or both. It is computationally efficient but may introduce aliasing.

The reduction factors are specified separately for the x (columns) and y (rows) directions.

Since
IDSImaging.Peak.ICV 1.3

Constructor & Destructor Documentation

◆ DownsamplingModule() [1/2]

DownsamplingModule ( )
inline

Creates an instance of class DownsamplingModule with factors X = 1, Y = 1 and DownsamplingMode = DownsamplingMode.BinningAverage.

◆ DownsamplingModule() [2/2]

DownsamplingModule ( DownsamplingMode defaultMode,
string customName )
inline

Creates an instance of class DownsamplingModule with factors X = 1, Y = 1 and the given T:DownsamplingMode and name.

Member Function Documentation

◆ Deserialize()

override void Deserialize ( IArchive archive)
inlinevirtual

Restores the object's state from the provided archive.

This function reads and applies all necessary parameters from the given archive to reconstruct the internal state of the object. It ensures that the object is restored to a valid and consistent state.

Note
This function requires that the archive contains all expected fields as produced by a corresponding Serialize call.
Parameters
archiveThe source archive containing the serialized parameters.
Exceptions
IcvCorruptedExceptionThe archive is malformed, misses keys or the values are invalid.
IcvNotSupportedExceptionThe Version entry indicates an unsupported version.
IcvOutOfRangeExceptionThe values are outside of the valid range.

Reimplemented from ModuleBase.

◆ Dispose()

void Dispose ( )
inline

Releases all resources used by this class.

◆ Process() [1/2]

override Image Process ( Image inputImage)
inline

Applies the downsampling factors and mode to the input image and returns a downsampled copy based on current settings.

Note
Supported pixel formats: BayerGR8, BayerGR10, BayerGR12, BayerRG8, BayerRG10, BayerRG12, BayerGB8, BayerGB10, BayerGB12, BayerBG8, BayerBG10, BayerBG12, Mono8, Mono10, Mono12, Mono16, Confidence8, Confidence16, Coord3D_C8, Coord3D_C16, Coord3D_C32f, Coord3D_ABC32f, RGB8, RGB10, RGB12, BGR8, BGR10, BGR12, RGBa8, RGBa10, RGBa12, BGRa8, BGRa10, BGRa12, Mono32f, RGB32f,
Note
This operation disregards any specified image regions and processes the entire image. The alpha channel of the input image (if present) is also ignored. This is because the alpha channel can have different interpretations - such as transparency, segmentation labels, or masks - each of which would require different handling during binning. Consequently, the alpha channel of the output image is always set to the maximum possible pixel value.
Parameters
inputImageThe input image to be processed.
Returns
A new image object that is the transformed result of the input.
Exceptions
IcvNotPossibleExceptionThe inputImage has any other than the supported pixel formats.

◆ Process() [2/2]

override object Process ( object input)
inlinevirtual

Applies the downsampling factors and mode to the input image and returns a downsampled copy based on current settings.

Note
Supported pixel formats: BayerGR8, BayerGR10, BayerGR12, BayerRG8, BayerRG10, BayerRG12, BayerGB8, BayerGB10, BayerGB12, BayerBG8, BayerBG10, BayerBG12, Mono8, Mono10, Mono12, Mono16, Confidence8, Confidence16, Coord3D_C8, Coord3D_C16, Coord3D_C32f, Coord3D_ABC32f, RGB8, RGB10, RGB12, BGR8, BGR10, BGR12, RGBa8, RGBa10, RGBa12, BGRa8, BGRa10, BGRa12, Mono32f, RGB32f,
Note
This operation disregards any specified image regions and processes the entire image. The alpha channel of the input image (if present) is also ignored. This is because the alpha channel can have different interpretations - such as transparency, segmentation labels, or masks - each of which would require different handling during binning. Consequently, the alpha channel of the output image is always set to the maximum possible pixel value.
Parameters
inputThe input image to be processed.
Returns
A new image object that is the transformed result of the input.
Exceptions
IcvNotPossibleExceptionThe input has any other than the supported pixel formats.

Reimplemented from ModuleBase.

◆ ResetToDefault()

override void ResetToDefault ( )
inlinevirtual

Resets all parameters to their default values.

Default values:

  • X = 1
  • Y = 1
  • Mode = initial downsampling mode
Note
The enabled state and CustomId do not change when calling this function.

Reimplemented from ModuleBase.

◆ Serialize()

override void Serialize ( IArchive archive)
inlinevirtual

Serializes the object's internal state into the provided archive.

This function populates the given archive with all parameters required to fully represent the current state of the object. It ensures that the object can be reconstructed or transmitted accurately by saving all relevant data members in a consistent and structured format.

Parameters
archiveThe target archive that will store the serialized parameters.

Reimplemented from ModuleBase.

Property Documentation

◆ CustomId

string? CustomId
getset

The custom TypeId of the module for serialization purposes.

◆ IsEnabled

virtual bool IsEnabled = true
getsetinherited

Get whether this module is enabled.

When disabled, Process returns the input image unchanged.

Implements IModule.

◆ Mode

DownsamplingMode Mode
getset

The current T:DownsamplingMode.

◆ Range

Gets the valid range for downsampling factors x and y.

◆ TypeId

override string TypeId
get

The unique type identifier for this module implementation.This should be a unique string identifying the specific implementation of the module.

Implements IModule.

◆ Version

int Version = 1
getinherited

The module version.

◆ X

uint X
getset

The current number of columns used for downsampling.

◆ Y

uint Y
getset

The current number of rows used for downsampling.