Xmipp  v3.23.11-Nereus
Functions
Moving average
Collaboration diagram for Moving average:

Functions

int MovingAverage (double InputData[], double OutputData[], long SignalLength, long KernelOrigin, long KernelLength, enum TBoundaryConvention Convention)
 
int MovingAverageVolume (float *VolumeSource, float *VolumeDestination, long Nx, long Ny, long Nz, long KernelOrigin, long KernelLength, enum TBoundaryConvention Convention)
 

Detailed Description

Function Documentation

◆ MovingAverage()

int MovingAverage ( double  InputData[],
double  OutputData[],
long  SignalLength,
long  KernelOrigin,
long  KernelLength,
enum TBoundaryConvention  Convention 
)

Moving average (1D). The specified boundary convention applies to the input data only, not to the kernel. The boundary convention applied to the kernel is FiniteDataSupport.

The kernel has a constant value and sums up to 1.0. The input and the output have the same length. The origin for the kernel is given with respect to the leftmost sample [0].

success: return(!ERROR); failure: return(ERROR)

General structure is as follows:

for (i = 0L; (i < SignalLength); i++) {
Sum = 0.0;
for (j = -Infinity; (j <= Infinity); j++)
Sum += InputData[j] * Kernel[KernelOrigin + i - j];
OutputData[i] = Sum;
}

◆ MovingAverageVolume()

int MovingAverageVolume ( float *  VolumeSource,
float *  VolumeDestination,
long  Nx,
long  Ny,
long  Nz,
long  KernelOrigin,
long  KernelLength,
enum TBoundaryConvention  Convention 
)

Moving average (3D). The specified boundary convention applies to the input data only, not to the kernel. The boundary convention applied to the kernel is FiniteDataSupport. VolumeSource is a (float)volume of size (Nx x Ny x Nz). OutputData is a (float)volume of size (Nx x Ny x Nz). The origin for the kernel is given with respect to the leftmost sample [0]. The 1D kernel is applied successively to each principal direction in a separable fashion.

success: return(!ERROR); failure: return(ERROR).

General structure is as follows:

for (i = 0L; (i < SignalLength); i++) {
Sum = 0.0;
for (j = i - KernelOrigin; (j < (KernelLength + i - KernelOrigin)); j++)
Sum += InputData[j];
OutputData[i] = Sum / KernelLength;
}